teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0366-tests-fix-personality-tests-on-ppc64-and-aarch64.patch

1abbee
From 89a7c7e55af18c4f18c0d83c244dbe20ddb85515 Mon Sep 17 00:00:00 2001
1abbee
From: Jan Synacek <jsynacek@redhat.com>
1abbee
Date: Fri, 29 Jul 2016 15:03:02 +0200
1abbee
Subject: [PATCH] tests: fix personality tests on ppc64 and aarch64
1abbee
1abbee
Resolves: #1361049
1abbee
---
1abbee
 src/shared/util.c                     | 16 ++++++++++++++++
1abbee
 src/test/test-execute.c               |  6 ++++++
1abbee
 test/exec-personality-aarch64.service |  7 +++++++
1abbee
 test/exec-personality-ppc64.service   |  7 +++++++
1abbee
 4 files changed, 36 insertions(+)
1abbee
 create mode 100644 test/exec-personality-aarch64.service
1abbee
 create mode 100644 test/exec-personality-ppc64.service
1abbee
1abbee
diff --git a/src/shared/util.c b/src/shared/util.c
c62b8e
index f75ed9dd42..3030261524 100644
1abbee
--- a/src/shared/util.c
1abbee
+++ b/src/shared/util.c
1abbee
@@ -6986,6 +6986,22 @@ unsigned long personality_from_string(const char *p) {
1abbee
 
1abbee
         if (streq(p, "s390"))
1abbee
                 return PER_LINUX;
1abbee
+
1abbee
+#elif defined(__powerpc64__)
1abbee
+
1abbee
+#  if defined(__BIG_ENDIAN__)
1abbee
+        if (streq(p, "ppc64"))
1abbee
+                return PER_LINUX;
1abbee
+#  else
1abbee
+        if (streq(p, "ppc64le"))
1abbee
+                return PER_LINUX;
1abbee
+#  endif
1abbee
+
1abbee
+#elif defined(__aarch64__)
1abbee
+
1abbee
+        if (streq(p, "aarch64"))
1abbee
+                return PER_LINUX;
1abbee
+
1abbee
 #endif
1abbee
 
1abbee
         /* personality(7) documents that 0xffffffffUL is used for
1abbee
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
c62b8e
index 38522a168d..5a02960e76 100644
1abbee
--- a/src/test/test-execute.c
1abbee
+++ b/src/test/test-execute.c
1abbee
@@ -83,6 +83,12 @@ static void test_exec_personality(Manager *m) {
1abbee
 #elif defined(__s390__)
1abbee
         test(m, "exec-personality-s390.service", 0, CLD_EXITED);
1abbee
 
1abbee
+#elif defined(__powerpc64__)
1abbee
+        test(m, "exec-personality-ppc64.service", 0, CLD_EXITED);
1abbee
+
1abbee
+#elif defined(__aarch64__)
1abbee
+        test(m, "exec-personality-aarch64.service", 0, CLD_EXITED);
1abbee
+
1abbee
 #else
1abbee
         test(m, "exec-personality-x86.service", 0, CLD_EXITED);
1abbee
 #endif
1abbee
diff --git a/test/exec-personality-aarch64.service b/test/exec-personality-aarch64.service
1abbee
new file mode 100644
c62b8e
index 0000000000..8511174411
1abbee
--- /dev/null
1abbee
+++ b/test/exec-personality-aarch64.service
1abbee
@@ -0,0 +1,7 @@
1abbee
+[Unit]
1abbee
+Description=Test for Personality=aarch64
1abbee
+
1abbee
+[Service]
1abbee
+ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "aarch64")'
1abbee
+Type=oneshot
1abbee
+Personality=aarch64
1abbee
diff --git a/test/exec-personality-ppc64.service b/test/exec-personality-ppc64.service
1abbee
new file mode 100644
c62b8e
index 0000000000..4432074e67
1abbee
--- /dev/null
1abbee
+++ b/test/exec-personality-ppc64.service
1abbee
@@ -0,0 +1,7 @@
1abbee
+[Unit]
1abbee
+Description=Test for Personality=ppc64
1abbee
+
1abbee
+[Service]
1abbee
+ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "ppc64" -o $(uname -m) = "ppc64le")'
1abbee
+Type=oneshot
1abbee
+Personality=ppc64