Index: test/tools/llvm-cov/multithreaded-report.test =================================================================== --- test/tools/llvm-cov/multithreaded-report.test +++ test/tools/llvm-cov/multithreaded-report.test @@ -1,8 +1,5 @@ # Test "report" command with and without multiple threads. -# Temporarily disable the test on Windows as it doesn't support "diff -r". -REQUIRES: shell - RUN: llvm-cov report -num-threads=1 \ RUN: -path-equivalence=/tmp,%S/Inputs \ RUN: -instr-profile %S/Inputs/multithreaded_report/main.profdata \ Index: utils/lit/lit/TestRunner.py =================================================================== --- utils/lit/lit/TestRunner.py +++ utils/lit/lit/TestRunner.py @@ -346,7 +346,7 @@ """executeBuiltinDiff - Compare files line by line.""" args = expand_glob_expressions(cmd.args, cmd_shenv.cwd)[1:] try: - opts, args = getopt.gnu_getopt(args, "wbu", ["strip-trailing-cr"]) + opts, args = getopt.gnu_getopt(args, "wbur", ["strip-trailing-cr"]) except getopt.GetoptError as err: raise InternalShellError(cmd, "Unsupported: 'diff': %s" % str(err)) @@ -354,6 +354,7 @@ ignore_all_space = False ignore_space_change = False unified_diff = False + recursive_diff = False strip_trailing_cr = False for o, a in opts: if o == "-w": @@ -362,6 +363,8 @@ ignore_space_change = True elif o == "-u": unified_diff = True + elif o == "-r": + recursive_diff = True elif o == "--strip-trailing-cr": strip_trailing_cr = True else: @@ -370,6 +373,17 @@ if len(args) != 2: raise InternalShellError(cmd, "Error: missing or extra operand") + def recursivelyReadDir(path): + lines = [] + for dir, subdirList, fileList in os.walk(path): + for file in fileList: + with open(os.path.join(dir, file), 'r') as f: + lines += f.readlines() + if not fileList: + # Add empty dirs for comparison as well. + lines.append('Empty dir "%s'"." % os.path.relpath(dir, path)) + return lines + stderr = StringIO() stdout = StringIO() exitCode = 0 @@ -378,8 +392,11 @@ if not os.path.isabs(file): file = os.path.realpath(os.path.join(cmd_shenv.cwd, file)) filepaths.append(file) - with open(file, 'r') as f: - filelines.append(f.readlines()) + if recursive_diff: + filelines.append(recursivelyReadDir(file)) + else: + with open(file, 'r') as f: + filelines.append(f.readlines()) def compose2(f, g): return lambda x: f(g(x))