]> granicus.if.org Git - strace/commitdiff
tests: fix build and run on alpha with fresh kernel headers
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 15 Jul 2019 17:11:27 +0000 (17:11 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 15 Jul 2019 17:11:27 +0000 (17:11 +0000)
Fix tests on alpha with Linux kernel headers containing commits
v5.1-rc1~160^2~3^2~12 and v5.1-rc1~160^2~3^2~1.

* tests/getegid.c: Include "scno.h".
(main): Use sprintrc.
* tests/geteuid.c: Likewise.
* tests/getppid.c: Likewise.
* tests/getgid.c [__NR_getgid == __NR_getxgid]: Skip.
* tests/getuid.c [__NR_getuid == __NR_getxuid]: Skip.
* tests/getpid.c [__NR_getpid == __NR_getxpid]: Skip.
* tests/umount2.c (__NR_umount2): Remove.
(TEST_SYSCALL_NR): New macro.
(main): Use it instead of __NR_umount2.
* tests/ksysent.sed: Remove new __NR_get[gup]id aliases to traditional
__NR_getx[gup]id names (on alpha).
Prioritize __NR_umount over __NR_umount2, __NR_osf_shmat over __NR_shmat.
* NEWS: Mention these fixes.

NEWS
tests/getegid.c
tests/geteuid.c
tests/getgid.c
tests/getpid.c
tests/getppid.c
tests/getuid.c
tests/ksysent.sed
tests/umount2.c

diff --git a/NEWS b/NEWS
index 7b40cf7dbb6ddabc973382177c230b48e167ee95..27a012c7b6c0ba15d582d728d5ce64f8fc6712f2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 Noteworthy changes in release ?.? (????-??-??)
 ==============================================
 
+* Bug fixes
+  * Fixed tests on alpha with Linux kernel headers 5.1+.
+
 Noteworthy changes in release 5.2 (2019-07-12)
 ==============================================
 
index 2e0754b77580512ace941dc625f69aa4879d5523..89fc15c554c939b7dce6c8946c79cece7912c159 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "tests.h"
 #include <asm/unistd.h>
+#include "scno.h"
 
 #ifdef __NR_getegid
 
@@ -16,7 +17,7 @@
 int
 main(void)
 {
-       printf("getegid() = %ld\n", syscall(__NR_getegid));
+       printf("getegid() = %s\n", sprintrc(syscall(__NR_getegid)));
        return 0;
 }
 
index 430df1c6526bfaf88644140def29d116002fd7a8..ff0c2edbc795b2cf8668b43854ff303537d8f4cc 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "tests.h"
 #include <asm/unistd.h>
+#include "scno.h"
 
 #ifdef __NR_geteuid
 
@@ -16,7 +17,7 @@
 int
 main(void)
 {
-       printf("geteuid() = %ld\n", syscall(__NR_geteuid));
+       printf("geteuid() = %s\n", sprintrc(syscall(__NR_geteuid)));
        return 0;
 }
 
index 1bd705023f616cd58b59cc95619f18315d42db8e..c407ec1f10b96e44a95d8e9aed5e9cf8464c2930 100644 (file)
@@ -8,7 +8,7 @@
 #include "tests.h"
 #include <asm/unistd.h>
 
-#ifdef __NR_getgid
+#if defined __NR_getgid && (!defined __NR_getxgid || __NR_getxgid != __NR_getgid)
 
 # include <stdio.h>
 # include <unistd.h>
index 5e88e052a343390ed4789c6e9a158d565eb2d4b8..7af628c005429801f111b5b2a4e8a4a6935247a4 100644 (file)
@@ -8,7 +8,7 @@
 #include "tests.h"
 #include <asm/unistd.h>
 
-#ifdef __NR_getpid
+#if defined __NR_getpid && (!defined __NR_getxpid || __NR_getxpid != __NR_getpid)
 
 # include <stdio.h>
 # include <unistd.h>
index 718d0691d9f8acfabc42ec029df955d75c32b169..974ff536ce48a26bc6b20de207dcadd658d4f257 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "tests.h"
 #include <asm/unistd.h>
+#include "scno.h"
 
 #ifdef __NR_getppid
 
@@ -16,7 +17,7 @@
 int
 main(void)
 {
-       printf("getppid() = %ld\n", syscall(__NR_getppid));
+       printf("getppid() = %s\n", sprintrc(syscall(__NR_getppid)));
        puts("+++ exited with 0 +++");
        return 0;
 }
index 56f6c9021e69b53bbd38e45ca4b245fb280cab14..3691ced03456556e9a5bf864f5009152e027b531 100644 (file)
@@ -8,7 +8,7 @@
 #include "tests.h"
 #include <asm/unistd.h>
 
-#ifdef __NR_getuid
+#if defined __NR_getuid && (!defined __NR_getxuid || __NR_getxuid != __NR_getuid)
 
 # include <stdio.h>
 # include <unistd.h>
index c35ba22fe93ee22767a78f221a4e0c43d4ff41dc..88f0a52a5703b405f0b0226aba28fb9478cad7d3 100644 (file)
@@ -8,6 +8,9 @@
 # should not have been exported at all
 /#define[[:space:]]+__NR_(sys_epoll_|arch_specific_syscall|arm_sync_file_range|syscalls|syscall_count|syscall_max|available|reserved|unused)/d
 
+# remove new aliases to traditional names on alpha
+/#define[[:space:]]+__NR_get[gup]id[[:space:]]+__NR_getx[gup]id$/d
+
 # should not have been named this way
 s/__NR_(arm|xtensa)_fadvise64_64/__NR_fadvise64_64/
 
@@ -17,4 +20,12 @@ s/__NR_madvise1/__NR_madvise/
 s/__NR_paccept/__NR_accept4/
 
 # generate
+
+# prioritize __NR_umount over __NR_umount2
+s/#define[[:space:]]+__NR_(umount)2([[:space:]].*)?$/#if defined __NR_\12 \&\& (!defined __NR_\1 || __NR_\1 != __NR_\12)\n[__NR_\12 \& 0xffff] = "\12",\n#endif/p
+
+# prioritize __NR_osf_shmat over __NR_shmat
+s/#define[[:space:]]+__NR_(shmat)([[:space:]].*)?$/#if defined __NR_\1 \&\& (!defined __NR_osf_\1 || __NR_osf_\1 != __NR_\1)\n[__NR_\1 \& 0xffff] = "\1",\n#endif/p
+
+# generic
 s/#define[[:space:]]+__NR_([a-z_][^[:space:]]+)([[:space:]].*)?$/#ifdef __NR_\1\n[__NR_\1 \& 0xffff] = "\1",\n#endif/p
index d313d5978a9b6b4d09658ce7a532765a2bc1585f..2d07e11eb2e10f3c12e41cb23a5e5e78578317e1 100644 (file)
 #include <asm/unistd.h>
 
 #if defined __NR_umount2 && (!defined __NR_umount || __NR_umount2 != __NR_umount)
+# define TEST_SYSCALL_NR __NR_umount2
 # define TEST_SYSCALL_STR "umount2"
 #else
-# define __NR_umount2 __NR_umount
+# define TEST_SYSCALL_NR __NR_umount
 # define TEST_SYSCALL_STR "umount"
 #endif
 
@@ -25,7 +26,7 @@ main(void)
        static const char sample[] = "umount2.sample";
        if (mkdir(sample, 0700))
                perror_msg_and_fail("mkdir: %s", sample);
-       (void) syscall(__NR_umount2, sample, 31);
+       (void) syscall(TEST_SYSCALL_NR, sample, 31);
        printf("%s(\"%s\", MNT_FORCE|MNT_DETACH|MNT_EXPIRE|UMOUNT_NOFOLLOW|0x10)"
               " = -1 EINVAL (%m)\n", TEST_SYSCALL_STR, sample);
        if (rmdir(sample))