3 # check.py : Run all the test cases.
5 # ====================================================================
6 # Copyright 2013 Justin Erenkrantz and Greg Stein
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ====================================================================
27 if __name__ == '__main__':
28 # get the test directory from the commandline, if set.
34 # define test executable paths
35 if sys.platform == 'win32':
36 SERF_RESPONSE_EXE = 'serf_response.exe'
37 TEST_ALL_EXE = 'test_all.exe'
39 SERF_RESPONSE_EXE = 'serf_response'
40 TEST_ALL_EXE = 'test_all'
41 SERF_RESPONSE_EXE = os.path.join(testdir, SERF_RESPONSE_EXE)
42 TEST_ALL_EXE = os.path.join(testdir, TEST_ALL_EXE)
44 # Find test responses and run them one by one
45 for case in glob.glob(testdir + "/testcases/*.response"):
46 print "== Testing %s ==" % (case)
48 subprocess.check_call([SERF_RESPONSE_EXE, case])
49 except subprocess.CalledProcessError:
50 print "ERROR: test case %s failed" % (case)
53 print "== Running the unit tests =="
55 subprocess.check_call(TEST_ALL_EXE)
56 except subprocess.CalledProcessError:
57 print "ERROR: test(s) failed in test_all"