]> granicus.if.org Git - strace/commitdiff
tests/uid.test: adopt for alpha
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 16 Jul 2015 09:09:11 +0000 (09:09 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 16 Jul 2015 22:13:56 +0000 (22:13 +0000)
Make the test work on alpha that has getxuid syscall instead of getuid.

* tests/uid.awk (BEGIN): Update getuid regexp to match both getuid
and getxuid syscalls.
* tests/uid.c (main): Allow __NR_getxuid as an alternative
to __NR_getuid.
* tests/uid.test: If getuid syscall is not available, probe for
getxuid syscall.

tests/uid.awk
tests/uid.c
tests/uid.test

index 6f07b44fd22ad96a5e56649feca7ec75e39e46ea..b79aa79fbf649204fc6763a3150797f102cb8999 100644 (file)
@@ -1,6 +1,6 @@
 BEGIN {
   r_uint = "(0|[1-9][0-9]*)"
-  regexp = "^getuid" suffix "\\(\\)[[:space:]]+= " r_uint "$"
+  regexp = "^getx?uid" suffix "\\(\\)[[:space:]]+= " r_uint "$"
   expected = "getuid"
   fail = 0
 }
index 28f548bd0387a4a06c623b9e456277ca8874ff40..f316d805dfb66411cab2cc707f2f67fe0e7464cc 100644 (file)
@@ -9,7 +9,7 @@
 int
 main(void)
 {
-#if defined(__NR_getuid) \
+#if (defined __NR_getuid || defined __NR_getxuid) \
  && defined(__NR_setuid) \
  && defined(__NR_getresuid) \
  && defined(__NR_setreuid) \
@@ -20,6 +20,9 @@ main(void)
        int size;
        int *list = 0;
 
+#ifndef __NR_getuid
+# define __NR_getuid __NR_getxuid
+#endif
        uid = syscall(__NR_getuid);
        assert(syscall(__NR_setuid, uid) == 0);
        {
index 7bbcca7b80574979df60bdbed9116bd2627777bb..e214272d4670da5db4b9bec7889e5b3859ba1fee 100755 (executable)
@@ -9,7 +9,17 @@ w="${uid_t_size-}"
 
 run_prog ./uid$s$w
 
-syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s"
+syscalls=
+for n in "getuid$s" "getxuid$s"; do
+       if $STRACE -e "$n" -h > /dev/null; then
+               syscalls="$n"
+               break
+       fi
+done
+test -n "$syscalls" ||
+        fail_ "neither getuid$s nor getxuid$s is supported on this architecture"
+
+syscalls="$syscalls,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s"
 run_strace -e trace="$syscalls" $args
 
 AWK=gawk