From: Eli Bendersky Date: Fri, 27 Dec 2013 15:03:54 +0000 (-0800) Subject: Adding test/all_tests.py and a Travis configuration file X-Git-Tag: v0.22~17 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d1a9e1e6050e0e29d83f605e03a097c3a2f8f78;p=pyelftools.git Adding test/all_tests.py and a Travis configuration file --- diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8c6680d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: python +python: + - "2.7" + - "3.2" + - "3.3" +script: python test/all_tests.py + diff --git a/setup.py b/setup.py index a105774..7270411 100644 --- a/setup.py +++ b/setup.py @@ -46,5 +46,3 @@ setup( scripts=['scripts/readelf.py'] ) - - diff --git a/test/all_tests.py b/test/all_tests.py new file mode 100755 index 0000000..4cb8e3c --- /dev/null +++ b/test/all_tests.py @@ -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()) diff --git a/test/utils.py b/test/utils.py index 908cfcc..ff58678 100644 --- a/test/utils.py +++ b/test/utils.py @@ -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