From: Elvira Khabirova Date: Thu, 20 Aug 2015 21:09:32 +0000 (+0300) Subject: tests: add times-fail.test X-Git-Tag: v4.11~224 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d77b562d3c3d8f376efec1b6e0bd70d348934c8;p=strace tests: add times-fail.test * 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. --- diff --git a/tests/.gitignore b/tests/.gitignore index d9a0a757..624aaae6 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -48,6 +48,7 @@ statfs sysinfo time times +times-fail uid uid16 uid32 diff --git a/tests/Makefile.am b/tests/Makefile.am index 24e255eb..5ae29e48 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..f3202b1f --- /dev/null +++ b/tests/times-fail.c @@ -0,0 +1,18 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include + +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 index 00000000..6e596fab --- /dev/null +++ b/tests/times-fail.test @@ -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