]> granicus.if.org Git - strace/blob - tests/inject-nf.test
Remove XLAT_END
[strace] / tests / inject-nf.test
1 #!/bin/sh -efu
2 #
3 # Check decoding of return values injected into a syscall that "never fails".
4 #
5 # Copyright (c) 2018 The strace developers.
6 # All rights reserved.
7 #
8 # SPDX-License-Identifier: GPL-2.0-or-later
9
10 . "${srcdir=.}/scno_tampering.sh"
11
12 case "$STRACE_ARCH" in
13 alpha)
14         SYSCALL=getpgrp
15         ;;
16 *)
17         SYSCALL=getpid
18         ;;
19 esac
20
21 run_prog
22 prog="$args"
23 fault_args="-a9 -e trace=${SYSCALL} -e inject=${SYSCALL}:retval="
24
25 test_rval()
26 {
27         local rval
28         rval="$1"; shift
29
30         run_strace $fault_args$rval $prog $rval > "$EXP"
31         match_diff "$LOG" "$EXP"
32 }
33
34 test_rval 0
35 test_rval 1
36 test_rval 0x7fffffff
37 test_rval 0x80000000
38 test_rval 0xfffff000
39 test_rval 0xfffffffe
40 test_rval 0xffffffff
41
42 case "$SIZEOF_KERNEL_LONG_T" in
43 8)
44         test_rval         0x80000000
45         test_rval         0xfffff000
46         test_rval         0xfffffffe
47         test_rval         0xffffffff
48         test_rval        0x100000000
49         test_rval 0x7fffffffffffffff
50         test_rval 0x8000000000000000
51         test_rval 0xfffffffffffff000
52         test_rval 0xfffffffffffffffe
53         test_rval 0xffffffffffffffff
54         ;;
55 esac