3 # check.py : Run all the test cases.
5 # ===================================================================
\r
6 # Licensed to the Apache Software Foundation (ASF) under one
\r
7 # or more contributor license agreements. See the NOTICE file
\r
8 # distributed with this work for additional information
\r
9 # regarding copyright ownership. The ASF licenses this file
\r
10 # to you under the Apache License, Version 2.0 (the
\r
11 # "License"); you may not use this file except in compliance
\r
12 # with the License. You may obtain a copy of the License at
\r
14 # http://www.apache.org/licenses/LICENSE-2.0
\r
16 # Unless required by applicable law or agreed to in writing,
\r
17 # software distributed under the License is distributed on an
\r
18 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
\r
19 # KIND, either express or implied. See the License for the
\r
20 # specific language governing permissions and limitations
\r
21 # under the License.
\r
22 # ===================================================================
\r
31 if __name__ == '__main__':
32 # get the test directory from the commandline, if set.
39 test_builddir = sys.argv[2]
41 test_builddir = 'test'
43 # define test executable paths
44 if sys.platform == 'win32':
45 SERF_RESPONSE_EXE = 'serf_response.exe'
46 TEST_ALL_EXE = 'test_all.exe'
48 SERF_RESPONSE_EXE = 'serf_response'
49 TEST_ALL_EXE = 'test_all'
50 SERF_RESPONSE_EXE = os.path.join(test_builddir, SERF_RESPONSE_EXE)
51 TEST_ALL_EXE = os.path.join(test_builddir, TEST_ALL_EXE)
53 # Find test responses and run them one by one
54 for case in glob.glob(testdir + "/testcases/*.response"):
55 print "== Testing %s ==" % (case)
57 subprocess.check_call([SERF_RESPONSE_EXE, case])
58 except subprocess.CalledProcessError:
59 print "ERROR: test case %s failed" % (case)
62 print "== Running the unit tests =="
64 subprocess.check_call(TEST_ALL_EXE)
65 except subprocess.CalledProcessError:
66 print "ERROR: test(s) failed in test_all"