55
55
'integer-assignments1/test.desc'
56
56
]))
57
57
58
- if len (sys .argv ) != 2 :
59
- sys .stderr .write ('Usage: check.py <path-to-cbmc>' )
58
+ # TODO maybe consider looking them up on PATH, but direct paths are
59
+ # harder to get wrong
60
+ if len (sys .argv ) != 3 :
61
+ sys .stderr .write ('Usage: check.py <path-to-cbmc> <path-to-xmllint>' )
60
62
CbmcPath = os .path .abspath (sys .argv [1 ])
61
- XsdValidateJar = os .path .join ( this_script_dir , 'validate-xsd/build/libs/validate-xsd-1.0-SNAPSHOT-uber.jar' )
63
+ XmlLintPath = os .path .abspath ( sys . argv [ 2 ] )
62
64
63
65
64
66
class ChangeDir :
@@ -89,7 +91,8 @@ def __init__(self, total_specs):
89
91
90
92
def check_spec (self , spec_path ):
91
93
self .total_test_count += 1
92
- sys .stdout .write ('*** Checking [{}/{}] {}... ' .format (self .total_test_count , self .total_specs , spec_path ))
94
+ sys .stdout .write ('*** Checking [{}/{}] {}... ' .format (
95
+ self .total_test_count , self .total_specs , spec_path ))
93
96
sys .stdout .flush ()
94
97
spec_dir = os .path .dirname (spec_path )
95
98
spec = self .read_spec (spec_path )
@@ -113,17 +116,21 @@ def read_trace_into(self, trace_file, args):
113
116
stdout = trace_file )
114
117
115
118
def check_trace (self , spec_path , trace_file ):
116
- validate_result = subprocess .run (['java' , '-jar' , XsdValidateJar , TraceXsdSpec ],
119
+ validate_result = subprocess .run ([XmlLintPath ,
120
+ '--noout' , # we don't want it to print the XML we pipe in
121
+ '--schema' , TraceXsdSpec ,
122
+ '-' # read from STDIN
123
+ ],
117
124
stdin = trace_file ,
118
125
stdout = subprocess .PIPE ,
119
126
stderr = subprocess .PIPE )
120
127
if validate_result .returncode == 0 :
121
- print ( '[SUCCESS]' )
128
+ sys . stdout . buffer . write ( b '[SUCCESS]\n ' )
122
129
else :
123
- print ( '[FAILURE]' )
130
+ sys . stdout . buffer . write ( b '[FAILURE]\n ' )
124
131
self .failed_tests .append (spec_path )
125
- sys .stdout .buffer .write (validate_result .stdout )
126
- sys .stdout .buffer .write (validate_result .stderr )
132
+ sys .stdout .buffer .write (validate_result .stdout )
133
+ sys .stdout .buffer .write (validate_result .stderr )
127
134
128
135
def read_spec (self , spec_path ):
129
136
with open (spec_path ) as spec_file :
@@ -149,17 +156,6 @@ def report(self):
149
156
print (spec )
150
157
151
158
152
- def run_gradle (args ):
153
- with ChangeDir ('validate-xsd' ):
154
- if os .name == 'nt' :
155
- subprocess .check_call (['cmd' , '/c' , 'gradlew.bat' ] + args )
156
- else :
157
- subprocess .check_call (['./gradlew' ] + args )
158
-
159
-
160
- # ensure that the uberjar exists and is up to date
161
- run_gradle (['uberjar' ])
162
-
163
159
test_desc_files = list (
164
160
filter (lambda s : s not in ExcludedTests , glob .glob (os .path .join (test_base_dir , '*/*.desc' ))))
165
161
validator = Validator (total_specs = len (test_desc_files ))
0 commit comments