valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

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

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