]> granicus.if.org Git - strace/blob - tests/match.awk
strace: terminate itself if interrupted by a signal
[strace] / tests / match.awk
1 #!/bin/gawk
2 #
3 # Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
4 # All rights reserved.
5 #
6 # SPDX-License-Identifier: GPL-2.0-or-later
7
8 # s[] is array of match strings
9 # r[] is array of match patterns
10
11 NR > lines { next }
12
13 {
14         if (s[NR]) {
15                 if ($0 == s[NR])
16                         next
17                 print "Line " NR " does not match expected string: " s[NR]
18         } else {
19                 if (match($0, r[NR]))
20                         next
21                 print "Line " NR " does not match expected pattern: " r[NR]
22         }
23
24         fail = 1
25 }
26
27 END {
28         if (fail == 0 && NR != lines) {
29                 fail = 1
30                 print "Expected " lines " lines, found " NR " line(s)."
31         }
32         exit fail
33 }