* getrandom.c: New file. * Makefile.am (strace_SOURCES): Add it. * linux/dummy.h (sys_getrandom): Remove. * linux/syscall.h (sys_getrandom): New prototype. * xlat/getrandom_flags.in: New file. * tests/getrandom.c: New file. * tests/getrandom.awk: New file. * tests/getrandom.test: New test. * tests/Makefile.am (check_PROGRAMS): Add getrandom. (TESTS): Add getrandom.test. (EXTRA_DIST): Add getrandom.awk. * tests/.gitignore: Add getrandom.
27 lines
554 B
Awk
27 lines
554 B
Awk
BEGIN {
|
|
r[1] = "^getrandom\\(\"(\\\\x[0-9a-f][0-9a-f]){3}\", 3, 0\\) += 3$"
|
|
r[2] = "^getrandom\\(\"(\\\\x[0-9a-f][0-9a-f]){3}\"\\.\\.\\., 4, GRND_NONBLOCK\\) += 4$"
|
|
r[3] = "^getrandom\\(0x[[0-9a-f]+, 4, GRND_NONBLOCK\\|GRND_RANDOM\\|0x3000\\) += -1 "
|
|
r[4] = "^\\+\\+\\+ exited with 0 \\+\\+\\+$"
|
|
lines = 4
|
|
fail = 0
|
|
}
|
|
|
|
NR > lines { exit 1 }
|
|
|
|
{
|
|
if (match($0, r[NR]))
|
|
next
|
|
|
|
print "Line " NR " does not match."
|
|
fail = 1
|
|
}
|
|
|
|
END {
|
|
if (fail == 0 && NR != lines) {
|
|
fail = 1
|
|
print "Expected " lines " lines, found " NR " line(s)."
|
|
}
|
|
exit fail
|
|
}
|