diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index 19f35fc7e212f..a1a797da47dc7 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -217,8 +217,8 @@ def expand_glob(arg, cwd): def expand_glob_expressions(args, cwd): - result = [args[0]] - for arg in args[1:]: + result = [] + for arg in args: result.extend(expand_glob(arg, cwd)) return result @@ -776,8 +776,8 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper): # FIXME: Standardize on the builtin echo implementation. We can use a # temporary file to sidestep blocking pipe write issues. - # Ensure args[0] is hashable. - args[0] = expand_glob(args[0], cmd_shenv.cwd)[0] + # Expand all glob expressions + args = expand_glob_expressions(args, cmd_shenv.cwd) inproc_builtin = inproc_builtins.get(args[0], None) if inproc_builtin and (args[0] != "echo" or len(cmd.commands) == 1): @@ -875,9 +875,6 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper): named_temp_files.append(f.name) args[i] = arg.replace(kDevNull, f.name) - # Expand all glob expressions - args = expand_glob_expressions(args, cmd_shenv.cwd) - # On Windows, do our own command line quoting for better compatibility # with some core utility distributions. if kIsWindows: diff --git a/llvm/utils/lit/tests/shtest-glob.py b/llvm/utils/lit/tests/shtest-glob.py index ae90f31907d49..e7840bd1be40a 100644 --- a/llvm/utils/lit/tests/shtest-glob.py +++ b/llvm/utils/lit/tests/shtest-glob.py @@ -5,8 +5,7 @@ # # END. -# CHECK: UNRESOLVED: shtest-glob :: glob-echo.txt ({{[^)]*}}) -# CHECK: TypeError: string argument expected, got 'GlobItem' +# CHECK: PASS: shtest-glob :: glob-echo.txt ({{[^)]*}}) # CHECK: FAIL: shtest-glob :: glob-mkdir.txt ({{[^)]*}}) # CHECK: # error: command failed with exit status: 1