summaryrefslogtreecommitdiffstats
path: root/contrib/serf/build/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/serf/build/check.py')
-rwxr-xr-xcontrib/serf/build/check.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/contrib/serf/build/check.py b/contrib/serf/build/check.py
new file mode 100755
index 0000000..7dfcda9
--- /dev/null
+++ b/contrib/serf/build/check.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+#
+# check.py : Run all the test cases.
+#
+# ====================================================================
+# Copyright 2013 Justin Erenkrantz and Greg Stein
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ====================================================================
+
+import sys
+import glob
+import subprocess
+import os
+
+
+if __name__ == '__main__':
+ # get the test directory from the commandline, if set.
+ if len(sys.argv) > 1:
+ testdir = sys.argv[1]
+ else:
+ testdir = 'test'
+
+ # define test executable paths
+ if sys.platform == 'win32':
+ SERF_RESPONSE_EXE = 'serf_response.exe'
+ TEST_ALL_EXE = 'test_all.exe'
+ else:
+ SERF_RESPONSE_EXE = 'serf_response'
+ TEST_ALL_EXE = 'test_all'
+ SERF_RESPONSE_EXE = os.path.join(testdir, SERF_RESPONSE_EXE)
+ TEST_ALL_EXE = os.path.join(testdir, TEST_ALL_EXE)
+
+ # Find test responses and run them one by one
+ for case in glob.glob(testdir + "/testcases/*.response"):
+ print "== Testing %s ==" % (case)
+ try:
+ subprocess.check_call([SERF_RESPONSE_EXE, case])
+ except subprocess.CalledProcessError:
+ print "ERROR: test case %s failed" % (case)
+
+ print "== Running the unit tests =="
+ try:
+ subprocess.check_call(TEST_ALL_EXE)
+ except subprocess.CalledProcessError:
+ print "ERROR: test(s) failed in test_all"
OpenPOWER on IntegriCloud