]>
git.saurik.com Git - apple/dyld.git/blob - testing/run_all_dyld_tests.py
14 # Parse dyld's BATS input file and run each test
16 if __name__
== "__main__":
17 batsPlist
= plistlib
.readPlist("/AppleInternal/CoreOS/BATS/unit_tests/dyld.plist")
18 tests
= batsPlist
["Tests"]
22 cwd
= test
["WorkingDirectory"]
26 testName
= test
["TestName"]
29 runOutput
= subprocess
.check_output(cmd
,stderr
= subprocess
.STDOUT
)
30 lines
= runOutput
.splitlines()
36 line
= line
.lstrip().rstrip()
37 #print testName + ": " + line
38 beginIndex
= string
.find(line
, "[BEGIN]")
40 beginName
= line
[beginIndex
+ 7:].lstrip()
42 currentTestName
= beginName
43 passIndex
= string
.find(line
, "[PASS]")
45 passName
= line
[passIndex
+ 6:].lstrip()
47 if passName
!= currentTestName
:
48 print >> sys
.stderr
, "[PASS] name does not match [BEGIN] name for test " + testName
49 failIndex
= string
.find(line
, "[FAIL]")
51 failName
= line
[failIndex
+ 6:].lstrip()
53 if failName
!= currentTestName
:
54 print >> sys
.stderr
, "[FAIL] name does not match [BEGIN] name for test " + testName
56 if not passed
and not failed
:
57 print >> sys
.stderr
, "[BEGIN] found [PASS] or [FAIL] for test " + testName
59 print >> sys
.stderr
, "Missing [BEGIN] for test " + testName
61 print "PASSED: " + testName
62 passedCount
= passedCount
+ 1
64 print "FAILED: " + testName
65 failedCount
= failedCount
+ 1
66 except subprocess
.CalledProcessError
as e
:
67 print >> sys
.stderr
, "FAILED: " + testName
+ " (execution failure)"
68 print "Total PASS count: " + str(passedCount
)
69 print "Total FAIL count: " + str(failedCount
)
73 testsTopDir
= "/AppleInternal/CoreOS/tests/dyld/"
74 for f
in os
.listdir(testsTopDir
):
75 testRunner
= testsTopDir
+ f
+ "/run.sh"
76 if os
.path
.isfile(testRunner
):
78 runOutput
= subprocess
.check_output([testRunner
],stderr
= subprocess
.STDOUT
)
79 lines
= runOutput
.splitlines()
85 line
= line
.lstrip().rstrip()
86 #print f + ": " + line
87 beginIndex
= string
.find(line
, "[BEGIN]")
89 beginName
= line
[beginIndex
+ 7:].lstrip()
91 currentTestName
= beginName
92 passIndex
= string
.find(line
, "[PASS]")
94 passName
= line
[passIndex
+ 6:].lstrip()
96 if passName
!= currentTestName
:
97 print >> sys
.stderr
, "[PASS] name does not match [BEGIN] name for test " + f
98 failIndex
= string
.find(line
, "[FAIL]")
100 failName
= line
[failIndex
+ 6:].lstrip()
102 if failName
!= currentTestName
:
103 print >> sys
.stderr
, "[FAIL] name does not match [BEGIN] name for test " + f
105 if not passed
and not failed
:
106 print >> sys
.stderr
, "[BEGIN] found [PASS] or [FAIL] for test " + f
108 print >> sys
.stderr
, "Missing [BEGIN] for test " + f
113 except subprocess
.CalledProcessError
as e
:
114 print >> sys
.stderr
, "FAILED: " + f
+ " (execution failure)"