blob: 904c5c0d75fee70af528c36c573d3b95a483f3b8 [file] [log] [blame]
Dmitry V. Levin68d64242014-09-10 00:07:32 +00001BEGIN {
2 lines = 3
3 fail = 0
4
5 i = "[0-9]+"
6 len = "[1-9]" i
7
8 d_ino = "d_ino=" i
9 d_off = "d_off=" i
10 d_reclen = "d_reclen=" len
Dmitry V. Levinc9297712015-01-25 00:04:20 +000011 d_name_1 = "d_name=\"\\.\""
12 d_name_2 = "d_name=\"\\.\\.\""
13 d_name_3 = "d_name=\"(A\\\\n){127}Z\""
14 d_type_dir = "d_type=DT_DIR"
15 d_type_reg = "d_type=DT_REG"
Dmitry V. Levin68d64242014-09-10 00:07:32 +000016
Dmitry V. Levinc9297712015-01-25 00:04:20 +000017 dirent_1 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_1 ", " d_type_dir "\\}"
18 dirent_2 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_2 ", " d_type_dir "\\}"
19 dirent_3 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_name_3 ", " d_type_reg "\\}"
Dmitry V. Levin68d64242014-09-10 00:07:32 +000020
Dmitry V. Levinc9297712015-01-25 00:04:20 +000021 dirent64_1 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_type_dir ", " d_name_1 "\\}"
22 dirent64_2 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_type_dir ", " d_name_2 "\\}"
23 dirent64_3 = "\\{" d_ino ", " d_off ", " d_reclen ", " d_type_reg ", " d_name_3 "\\}"
24
25 dents = "\\{(" dirent_1 " " dirent_2 "|" dirent_2 " " dirent_1 ") " dirent_3 "\\}"
26 dents64 = "\\{(" dirent64_1 " " dirent64_2 "|" dirent64_2 " " dirent64_1 ") " dirent64_3 "\\}"
27
28 getdents = "^getdents\\(" i ", " dents ", " len "\\) += " len "$"
29 getdents64 = "^getdents64\\(" i ", " dents64 ", " len "\\) += " len "$"
Dmitry V. Levin68d64242014-09-10 00:07:32 +000030}
31
32NR == 1 {if (match($0, getdents) || match($0, getdents64)) next}
33
34NR == 2 && /^getdents(64)?\([0-9]+, \{\}, [1-9][0-9]+\) += 0$/ {next}
35
36NR == lines && /^\+\+\+ exited with 0 \+\+\+$/ {next}
37
38{
39 print "Line " NR " does not match: " $0
40 fail=1
41}
42
43END {
44 if (NR != lines) {
45 print "Expected " lines " lines, found " NR " line(s)."
46 print ""
47 exit 1
48 }
49 if (fail) {
50 print ""
51 exit 1
52 }
53}