diff options
| -rw-r--r-- | test/test_all.py | 10 | ||||
| -rw-r--r-- | test/utils/testset.py | 44 |
2 files changed, 40 insertions, 14 deletions
diff --git a/test/test_all.py b/test/test_all.py index b3059ae7..22e4a7ca 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -114,8 +114,14 @@ for script in [["symbol_exec.py"], ]: testset += Test(script, base_dir="example") ## Jitter -for script, dep in [(["unpack_upx.py", "box_upx.exe"], []), # Take 5 mins on a Core i5 - (["test_jit_x86_32.py", "x86_32_sc.bin"], []), + +# Take 5 mins on a Core i5 +for jitter in ["tcc", "llvm", "python"]: + testset += Test(["unpack_upx.py", "box_upx.exe"] + ["--jitter", jitter], + base_dir="example", + products=["box_upx_exe_unupx.bin"]) + +for script, dep in [(["test_jit_x86_32.py", "x86_32_sc.bin"], []), (["test_jit_arm.py", "md5_arm", "-a", "A684"], []), (["test_jit_msp430.py", "msp430_sc.bin", "0"], [test_msp430]), diff --git a/test/utils/testset.py b/test/utils/testset.py index ca7022fb..5c508836 100644 --- a/test/utils/testset.py +++ b/test/utils/testset.py @@ -158,23 +158,43 @@ class TestSet(object): # Report task finish message_queue.put(MessageTaskDone(test, error)) + @staticmethod + def fast_unify(seq, idfun=None): + """Order preserving unifying list function + @seq: list to unify + @idfun: marker function (default is identity) + """ + if idfun is None: + idfun = lambda x: x + seen = {} + result = [] + for item in seq: + marker = idfun(item) + + if marker in seen: + continue + seen[marker] = 1 + result.append(item) + return result + def clean(self): "Remove produced files" + # Build the list of products + products = [] + current_directory = os.getcwd() for test in self.tests_done: - # Go to the expected directory - current_directory = os.getcwd() - os.chdir(test.base_dir) - - # Remove files for product in test.products: - try: - os.remove(product) - except OSError: - print "Cleanning error: Unable to remove %s" % product - - # Restore directory - os.chdir(current_directory) + # Get the full product path + products.append(os.path.join(current_directory, test.base_dir, + product)) + + # Unify the list and remove products + for product in TestSet.fast_unify(products): + try: + os.remove(product) + except OSError: + print "Cleanning error: Unable to remove %s" % product def add_additionnal_args(self, args): """Add arguments to used on the test command line |