Repository: incubator-impala Updated Branches: refs/heads/master d21728c0a -> 5a158dbcd
IMPALA-4543: Properly escape ignored tests subdirectories. In the shell, double-quoted strings are not very close to "raw" strings; double quotes end the string, but parameter expansion is also performed forstrings like "${FOO}". To pass strings from Python to the shell, I have replaced double quotes with single quotes and escaped the single quote characters in the strings. While I am here, add better logging in TestExecutor.run_tests to make errors like this easier to diagnose. Change-Id: I006eb559ec5f5b5b0379997fab945116dfc7e8d7 Reviewed-on: http://gerrit.cloudera.org:8080/5242 Reviewed-by: Jim Apple <jbapple-imp...@apache.org> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/5a158dbc Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/5a158dbc Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/5a158dbc Branch: refs/heads/master Commit: 5a158dbcd1330ebddc372ffe8d1374775a81fcab Parents: d21728c Author: Jim Apple <jbapple-imp...@apache.org> Authored: Mon Nov 28 06:20:16 2016 -0800 Committer: Impala Public Jenkins <impala-public-jenk...@gerrit.cloudera.org> Committed: Wed Nov 30 22:30:39 2016 +0000 ---------------------------------------------------------------------- tests/run-tests.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/5a158dbc/tests/run-tests.py ---------------------------------------------------------------------- diff --git a/tests/run-tests.py b/tests/run-tests.py index de32741..7acc7a9 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -62,7 +62,11 @@ class TestExecutor: self.tests_failed = False def run_tests(self, args): - exit_code = pytest.main(args) + try: + exit_code = pytest.main(args) + except: + sys.stderr.write("Unexpected exception with pytest {}".format(args)) + raise if exit_code != 0 and self._exit_on_error: sys.exit(exit_code) self.tests_failed = exit_code != 0 or self.tests_failed @@ -137,7 +141,12 @@ def build_test_args(log_base_name, valid_dirs): def build_ignore_dir_arg_list(valid_dirs): """ Builds a list of directories to ignore """ subdirs = [subdir for subdir in os.listdir(TEST_DIR) if os.path.isdir(subdir)] - return ' '.join(['--ignore="%s"' % d for d in set(subdirs) - set(valid_dirs)]) + # In bash, in single-quoted strings, single quotes cannot appear - not even escaped! + # Instead, one must close the string with a single-quote, insert a literal single-quote + # (escaped, so bash doesn't think you're starting a new string), then start your + # single-quoted string again. That works out to the four-character sequence '\''. + return ' '.join(["--ignore='%s'" % d.replace("'", "'\''") + for d in set(subdirs) - set(valid_dirs)]) if __name__ == "__main__":