From b5efa61aed77d70d4de569a2d68af66f8f5acd3d Mon Sep 17 00:00:00 2001 From: Guillaume Chanel <Guillaume.Chanel@unige.ch> Date: Tue, 18 Oct 2022 10:07:33 +0200 Subject: [PATCH] Test folders are deleted only on demand --- .gitlab-ci.yml | 2 +- tests/test.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79a9e55..5fb5f96 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,4 +35,4 @@ test: before_script: - apt clean && apt update -qy && apt -y install python3-colorama script: - - tests/test.py "$EXEC_NAME" + - tests/test.py -d "$EXEC_NAME" diff --git a/tests/test.py b/tests/test.py index 0d8bb07..fcda368 100755 --- a/tests/test.py +++ b/tests/test.py @@ -41,7 +41,7 @@ class Test: self.root = pathlib.Path(root) self.root.chmod(0o750) # TODO: add as command line option ? else: - root=pathlib.Path('root') + self.root=pathlib.Path(root) def __del__(self): @@ -257,8 +257,9 @@ if __name__=="__main__": parser = argparse.ArgumentParser(description='Test an ultra-cp program according to the I/O TP.') parser.add_argument('prog_path', help='the tested program path (must be an executable file)') parser.add_argument('-p', '--no-zero-mode', dest='no_perms', action='store_false', help='tests will NOT include files without any permission (only applies to concerned tests)') + parser.add_argument('-d', '--delete-tests', dest='delete_tests', action='store_false', help='delete the test folders when tests are over') args = parser.parse_args() - t = Test(args.prog_path) + t = Test(args.prog_path, delete_root=args.delete_tests) t.test_listing(args.no_perms) t.test_file_copy() t.test_file_dir_copy() @@ -268,4 +269,8 @@ if __name__=="__main__": t.test_replace_time_or_size() t.test_option_a() t.test_option_f() + + if not args.delete_tests: + print('Tests can be found in folder: {}'.format(t.root)) + sys.exit(test_failed) -- GitLab