| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! /bin/sh | | 1 | #! /bin/sh |
2 | # $NetBSD: accept.sh,v 1.1 2021/06/29 09:44:25 rillig Exp $ | | 2 | # $NetBSD: accept.sh,v 1.2 2021/07/11 12:07:14 rillig Exp $ |
3 | # | | 3 | # |
4 | # Copyright (c) 2021 The NetBSD Foundation, Inc. | | 4 | # Copyright (c) 2021 The NetBSD Foundation, Inc. |
5 | # All rights reserved. | | 5 | # All rights reserved. |
6 | # | | 6 | # |
7 | # Redistribution and use in source and binary forms, with or without | | 7 | # Redistribution and use in source and binary forms, with or without |
8 | # modification, are permitted provided that the following conditions | | 8 | # modification, are permitted provided that the following conditions |
9 | # are met: | | 9 | # are met: |
10 | # 1. Redistributions of source code must retain the above copyright | | 10 | # 1. Redistributions of source code must retain the above copyright |
11 | # notice, this list of conditions and the following disclaimer. | | 11 | # notice, this list of conditions and the following disclaimer. |
12 | # 2. Redistributions in binary form must reproduce the above copyright | | 12 | # 2. Redistributions in binary form must reproduce the above copyright |
13 | # notice, this list of conditions and the following disclaimer in the | | 13 | # notice, this list of conditions and the following disclaimer in the |
14 | # documentation and/or other materials provided with the distribution. | | 14 | # documentation and/or other materials provided with the distribution. |
15 | # | | 15 | # |
| @@ -34,34 +34,37 @@ | | | @@ -34,34 +34,37 @@ |
34 | set -eu | | 34 | set -eu |
35 | | | 35 | |
36 | . './t_integration.sh' | | 36 | . './t_integration.sh' |
37 | | | 37 | |
38 | for pattern in "$@"; do | | 38 | for pattern in "$@"; do |
39 | for test in *$pattern*.c; do | | 39 | for test in *$pattern*.c; do |
40 | base=${test%.*} | | 40 | base=${test%.*} |
41 | cfile="$base.c" | | 41 | cfile="$base.c" |
42 | expfile="$base.exp" | | 42 | expfile="$base.exp" |
43 | tmpfile="$base.exp.tmp" | | 43 | tmpfile="$base.exp.tmp" |
44 | ln_file="$base.ln" | | 44 | ln_file="$base.ln" |
45 | | | 45 | |
46 | configure_test_case "$cfile" | | 46 | configure_test_case "$cfile" |
| | | 47 | # shellcheck disable=SC2154 |
47 | if [ $skip = yes ]; then | | 48 | if [ $skip = yes ]; then |
48 | continue | | 49 | continue |
49 | fi | | 50 | fi |
50 | | | 51 | |
51 | if [ ! -f "$ln_file" ]; then | | 52 | if [ ! -f "$ln_file" ]; then |
52 | ln_file='/dev/null' | | 53 | ln_file='/dev/null' |
53 | fi | | 54 | fi |
54 | | | 55 | |
| | | 56 | # shellcheck disable=SC2154 |
| | | 57 | # shellcheck disable=SC2086 |
55 | if "$lint1" $flags "$base.c" "$ln_file" > "$tmpfile"; then | | 58 | if "$lint1" $flags "$base.c" "$ln_file" > "$tmpfile"; then |
56 | if [ -s "$tmpfile" ]; then | | 59 | if [ -s "$tmpfile" ]; then |
57 | echo "$base produces output but exits successfully" | | 60 | echo "$base produces output but exits successfully" |
58 | sed 's,^,| ,' "$tmpfile" | | 61 | sed 's,^,| ,' "$tmpfile" |
59 | fi | | 62 | fi |
60 | rm -f "$expfile" "$tmpfile" | | 63 | rm -f "$expfile" "$tmpfile" |
61 | else | | 64 | else |
62 | if [ -f "$tmpfile" ] && cmp -s "$tmpfile" "$expfile"; then | | 65 | if [ -f "$tmpfile" ] && cmp -s "$tmpfile" "$expfile"; then |
63 | rm "$tmpfile" | | 66 | rm "$tmpfile" |
64 | else | | 67 | else |
65 | echo "replacing $base" | | 68 | echo "replacing $base" |
66 | mv "$tmpfile" "$expfile" | | 69 | mv "$tmpfile" "$expfile" |
67 | fi | | 70 | fi |