]> granicus.if.org Git - strace/blob - tests/caps.awk
tests: handle the case when all 64 process capability bits are set
[strace] / tests / caps.awk
1 BEGIN {
2   fail = 0
3   lines = 3
4   cap = "(0|CAP_[A-Z_]+(\\|CAP_[A-Z_]+)*|CAP_[A-Z_]+(\\|CAP_[A-Z_]+){37}\\|0xffffffc0)"
5   capget = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, \\{" cap ", " cap ", " cap "\\}\\) = 0$"
6 }
7
8 NR == 1 {if (match($0, capget)) next}
9
10 NR == 2 && $0 == "capset({_LINUX_CAPABILITY_VERSION_3, 0}, {CAP_DAC_OVERRIDE|CAP_WAKE_ALARM, CAP_DAC_READ_SEARCH|CAP_BLOCK_SUSPEND, 0}) = -1 EPERM (Operation not permitted)" {next}
11
12 NR == lines && $0 == "+++ exited with 0 +++" {next}
13
14 {
15   print "Line " NR " does not match."
16   fail = 1
17   exit 1
18 }
19
20 END {
21   if (fail == 0 && NR != lines) {
22     print "Expected " lines " lines, found " NR " line(s)."
23     exit 1
24   }
25 }