diff options
author | Marco Poletti <poletti.marco@gmail.com> | 2017-06-17 17:41:38 +0100 |
---|---|---|
committer | Marco Poletti <poletti.marco@gmail.com> | 2017-06-17 17:41:38 +0100 |
commit | fb3c20259675f68c2984b6a2cb4c32df4c013f23 (patch) | |
tree | cdb2fba57bd4c9856b3641cb1750af1f57adf011 /tests/fruit_test_common.py | |
parent | a8fa8a9e4c6c8cc2094dd394d1d2d959e19e4697 (diff) | |
download | google-fruit-fb3c20259675f68c2984b6a2cb4c32df4c013f23.tar.gz |
Avoid copying testing files to the build directory.
These copies could cause confusion while developing Fruit if CMake doesn't re-run and the copy in the build directory becomes stale.
After this commit, tests must be run from the tests/ subdirectory of the build root, not from the build root itself.
Diffstat (limited to 'tests/fruit_test_common.py')
-rw-r--r-- | tests/fruit_test_common.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/fruit_test_common.py b/tests/fruit_test_common.py index 5bf8d3c..44671ed 100644 --- a/tests/fruit_test_common.py +++ b/tests/fruit_test_common.py @@ -30,6 +30,9 @@ from fruit_test_config import * run_under_valgrind = RUN_TESTS_UNDER_VALGRIND.lower() not in ('false', 'off', 'no', '0', '') +def pretty_print_command(command): + return ' '.join('"' + x + '"' for x in command) + class CommandFailedException(Exception): def __init__(self, command, stdout, stderr, error_code): self.command = command @@ -46,12 +49,12 @@ class CommandFailedException(Exception): Stderr: {stderr} - ''').format(command=self.command, error_code=self.error_code, stdout=self.stdout, stderr=self.stderr) + ''').format(command=pretty_print_command(self.command), error_code=self.error_code, stdout=self.stdout, stderr=self.stderr) def run_command(executable, args=[], modify_env=lambda env: env): command = [executable] + args modified_env = modify_env(os.environ) - print('Executing command:', ' '.join('"' + x + '"' for x in command)) + print('Executing command:', pretty_print_command(command)) try: p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, env=modified_env) (stdout, stderr) = p.communicate() @@ -85,7 +88,7 @@ class CompilationFailedException(Exception): Ran command: {command} Error message: {error_message} - ''').format(command=self.command, error_message=self.error_message) + ''').format(command=pretty_print_command(self.command), error_message=self.error_message) class PosixCompiler: def __init__(self): |