]> granicus.if.org Git - strace/commitdiff
tests: add times-fail.test
authorElvira Khabirova <lineprinter0@gmail.com>
Thu, 20 Aug 2015 21:09:32 +0000 (00:09 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 28 Aug 2015 08:46:24 +0000 (08:46 +0000)
* tests/times-fail.c: New file.
* tests/times-fail.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add times-fail.
(TESTS): Add times-fail.test.
* tests/.gitignore: Add times-fail.

tests/.gitignore
tests/Makefile.am
tests/times-fail.c [new file with mode: 0644]
tests/times-fail.test [new file with mode: 0755]

index d9a0a75729944918f25407da83317e0a4a26b6d7..624aaae6fb56dd87d9709a977ab79ac258b56352 100644 (file)
@@ -48,6 +48,7 @@ statfs
 sysinfo
 time
 times
+times-fail
 uid
 uid16
 uid32
index 24e255ebcd4edb03a9872304bbcebec80331e399..5ae29e489228b7e92c6977b529b46b70ed7c9a20 100644 (file)
@@ -61,6 +61,7 @@ check_PROGRAMS = \
        sysinfo \
        time \
        times \
+       times-fail \
        uid \
        uid16 \
        uid32 \
@@ -141,6 +142,7 @@ TESTS = \
        sun_path.test \
        time.test \
        times.test \
+       times-fail.test \
        umovestr.test \
        umovestr2.test \
        unix-yy.test \
diff --git a/tests/times-fail.c b/tests/times-fail.c
new file mode 100644 (file)
index 0000000..f3202b1
--- /dev/null
@@ -0,0 +1,18 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+int
+main (void)
+{
+       if (syscall(__NR_times, 0x42) != -1)
+               return 77;
+       puts("times(0x42) = -1 EFAULT (Bad address)");
+       puts("+++ exited with 0 +++");
+
+       return 0;
+}
diff --git a/tests/times-fail.test b/tests/times-fail.test
new file mode 100755 (executable)
index 0000000..6e596fa
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Check decoding of failing times syscall
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -a12 -etimes $args > "$OUT"
+match_diff "$OUT" "$LOG"
+rm -f "$OUT"
+
+exit 0