Adding test/all_tests.py and a Travis configuration file
authorEli Bendersky <eliben@gmail.com>
Fri, 27 Dec 2013 15:03:54 +0000 (07:03 -0800)
committerEli Bendersky <eliben@gmail.com>
Fri, 27 Dec 2013 15:03:54 +0000 (07:03 -0800)
.travis.yml [new file with mode: 0644]
setup.py
test/all_tests.py [new file with mode: 0755]
test/utils.py

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..8c6680d
--- /dev/null
@@ -0,0 +1,7 @@
+language: python
+python:
+  - "2.7"
+  - "3.2"
+  - "3.3"
+script: python test/all_tests.py
+
index a105774a6ee6c316a28ff82e00d3396dbf7039bd..727041111afab07cc46736516567f822eee7ca5e 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -46,5 +46,3 @@ setup(
 \r
     scripts=['scripts/readelf.py']\r
 )\r
-\r
-    \r
diff --git a/test/all_tests.py b/test/all_tests.py
new file mode 100755 (executable)
index 0000000..4cb8e3c
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+#-------------------------------------------------------------------------------
+# test/all_tests.py
+#
+# Run all pyelftools tests.
+#
+# Eli Bendersky (eliben@gmail.com)
+# This code is in the public domain
+#-------------------------------------------------------------------------------
+from __future__ import print_function
+import subprocess, sys
+from utils import is_in_rootdir
+
+def run_test_script(path):
+    cmd = [sys.executable, path]
+    print("Running '%s'" % ' '.join(cmd))
+    subprocess.check_call(cmd)
+
+def main():
+    if not is_in_rootdir():
+        testlog.error('Error: Please run me from the root dir of pyelftools!')
+        return 1
+    run_test_script('test/run_all_unittests.py')
+    run_test_script('test/run_examples_test.py')
+    run_test_script('test/run_readelf_tests.py')
+
+if __name__ == '__main__':
+    sys.exit(main())
index 908cfcc529cd8912fd82dc4760c0df46f3aa246d..ff586780f5d528370cf1cdbfff5ea24c316edb81 100644 (file)
@@ -19,7 +19,7 @@ def setup_syspath():
         sys.path.insert(0, '.')
 
 
-def run_exe(exe_path, args):
+def run_exe(exe_path, args=[]):
     """ Runs the given executable as a subprocess, given the
         list of arguments. Captures its return code (rc) and stdout and
         returns a pair: rc, stdout_str