tests: rewrite getdents test in C for better coverage
* tests/getdents.awk: Remove.
* tests/getdents.out: Remove.
* tests/getdents.c: New file.
* tests/getdents.test: Rewrite.
* tests/getdents64.c: New file.
* tests/getdents64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getdents and getdents64.
(TESTS): Add getdents64.test.
(EXTRA_DIST): Remove getdents.awk and getdents.out.
* tests/.gitignore: Add getdents and getdents64.
diff --git a/tests/getdents.test b/tests/getdents.test
index 3fa1c8d..62911b8 100755
--- a/tests/getdents.test
+++ b/tests/getdents.test
@@ -1,33 +1,16 @@
#!/bin/sh
-# Check that getdents/getdents64 syscalls are traced properly.
+# Check getdents syscall decoding.
. "${srcdir=.}/init.sh"
-check_prog gawk
-AWKPATH="$srcdir" gawk -f "$srcdir"/getdents.awk "$srcdir"/getdents.out ||
- framework_skip_ 'gawk does not work properly'
+rm -rf -- "$LOG".dir
+run_prog > /dev/null
-check_prog ls
-check_prog mkdir
-check_prog rm
-check_prog seq
-check_prog touch
+OUT="$LOG.out"
+run_strace -a22 -vegetdents $args > "$OUT"
-dir="$LOG.dir"
-rm -rf -- "$dir"
-mkdir -- "$dir" ||
- framework_skip_ 'failed to create a directory'
-
-touch -- "$dir/$(for i in $(seq 1 127); do echo A; done; echo Z)" ||
- framework_skip_ 'failed to create a file'
-
-ls -- "$dir" > /dev/null ||
- framework_skip_ 'failed to list a directory'
-
-run_strace -vegetdents,getdents64 ls -- "$dir" > /dev/null
-match_awk
-
-rm -rf -- "$dir"
+match_diff "$OUT" "$LOG"
+rm -f "$OUT"
exit 0