|
16 | 16 | NAME_MAX=int(subprocess.check_output(["getconf", "NAME_MAX", "."]))
|
17 | 17 |
|
18 | 18 | test_num=0
|
| 19 | +pass_num=0 |
| 20 | +fail_num=0 |
19 | 21 |
|
20 | 22 | code='''#!/usr/bin/perl
|
21 | 23 | print "Executed interpreter! Args:\n";
|
|
42 | 44 | # ...
|
43 | 45 | def test(name, size, good=True, leading="", root="./", target="/perl",
|
44 | 46 | fill="A", arg="", newline="\n", hashbang="#!"):
|
45 |
| - global test_num, tests, NAME_MAX |
| 47 | + global test_num, pass_num, fail_num, tests, NAME_MAX |
46 | 48 | test_num += 1
|
47 | 49 | if test_num > tests:
|
48 | 50 | raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)"
|
@@ -80,16 +82,20 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
|
80 | 82 | if good:
|
81 | 83 | print("ok %d - binfmt_script %s (successful good exec)"
|
82 | 84 | % (test_num, name))
|
| 85 | + pass_num += 1 |
83 | 86 | else:
|
84 | 87 | print("not ok %d - binfmt_script %s succeeded when it should have failed"
|
85 | 88 | % (test_num, name))
|
| 89 | + fail_num = 1 |
86 | 90 | else:
|
87 | 91 | if good:
|
88 | 92 | print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)"
|
89 | 93 | % (test_num, name, proc.returncode))
|
| 94 | + fail_num = 1 |
90 | 95 | else:
|
91 | 96 | print("ok %d - binfmt_script %s (correctly failed bad exec)"
|
92 | 97 | % (test_num, name))
|
| 98 | + pass_num += 1 |
93 | 99 |
|
94 | 100 | # Clean up crazy binaries
|
95 | 101 | os.unlink(script)
|
@@ -166,6 +172,8 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
|
166 | 172 | test(name="two-under-leading", size=int(SIZE/2), leading=" ")
|
167 | 173 | test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ")
|
168 | 174 |
|
| 175 | +print("# Totals: pass:%d fail:%d xfail:0 xpass:0 skip:0 error:0" % (pass_num, fail_num)) |
| 176 | + |
169 | 177 | if test_num != tests:
|
170 | 178 | raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d"
|
171 | 179 | % (test_num, tests))
|
0 commit comments