diff options
| -rw-r--r-- | libcxx/test/libcxx/test/format.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/libcxx/test/libcxx/test/format.py b/libcxx/test/libcxx/test/format.py index 238dcdb29af..19c9fc742a4 100644 --- a/libcxx/test/libcxx/test/format.py +++ b/libcxx/test/libcxx/test/format.py @@ -64,20 +64,24 @@ class LibcxxTestFormat(object): return (lit.Test.UNSUPPORTED, "A lit.local.cfg marked this unsupported") - res = lit.TestRunner.parseIntegratedTestScript( + script = lit.TestRunner.parseIntegratedTestScript( test, require_script=is_sh_test) # Check if a result for the test was returned. If so return that # result. - if isinstance(res, lit.Test.Result): - return res + if isinstance(script, lit.Test.Result): + return script if lit_config.noExecute: return lit.Test.Result(lit.Test.PASS) - # res is not an instance of lit.test.Result. Expand res into its parts. - script, tmpBase, execDir = res + # Check that we don't have run lines on tests that don't support them. if not is_sh_test and len(script) != 0: lit_config.fatal('Unsupported RUN line found in test %s' % name) + tmpDir, tmpBase = lit.TestRunner.getTempPaths(test) + substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, + tmpBase) + script = lit.TestRunner.applySubstitutions(script, substitutions) + # Dispatch the test based on its suffix. if is_sh_test: if not isinstance(self.executor, LocalExecutor): @@ -86,11 +90,11 @@ class LibcxxTestFormat(object): return lit.Test.UNSUPPORTED, 'ShTest format not yet supported' return lit.TestRunner._runShTest(test, lit_config, self.execute_external, script, - tmpBase, execDir) + tmpBase) elif is_fail_test: return self._evaluate_fail_test(test) elif is_pass_test: - return self._evaluate_pass_test(test, tmpBase, execDir, lit_config) + return self._evaluate_pass_test(test, tmpBase, lit_config) else: # No other test type is supported assert False @@ -98,7 +102,8 @@ class LibcxxTestFormat(object): def _clean(self, exec_path): # pylint: disable=no-self-use libcxx.util.cleanFile(exec_path) - def _evaluate_pass_test(self, test, tmpBase, execDir, lit_config): + def _evaluate_pass_test(self, test, tmpBase, lit_config): + execDir = os.path.dirname(test.getExecPath()) source_path = test.getSourcePath() exec_path = tmpBase + '.exe' object_path = tmpBase + '.o' |

