daandemeyer / rpms / systemd

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