Skip to content

Commit 16f18a3

Browse files
authored
Fix the following CAS related test for Windows (#11475)
Clang :: ClangScanDeps/include-tree-working-directory.c
1 parent 63c6105 commit 16f18a3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

clang/test/ClangScanDeps/include-tree-working-directory.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
// CACHE-HIT: remark: compile job cache hit
2121

2222
// RUN: cat %t/tu.rsp | sed -E 's|.*"-fcas-include-tree" "(llvmcas://[[:xdigit:]]+)".*|\1|' > %t/tu.casid
23-
// RUN: clang-cas-test -cas %t/cas -print-include-tree @%t/tu.casid | FileCheck %s -DPREFIX=%/t
23+
// RUN: clang-cas-test -cas %t/cas -print-include-tree @%t/tu.casid | %PathSanitizingFileCheck --sanitize PREFIX=%/t %s
2424

25-
// CHECK: [[PREFIX]]/t.c llvmcas://
25+
// CHECK: PREFIX{{/|\\}}t.c llvmcas://
2626
// CHECK: 1:1 <built-in> llvmcas://
27-
// CHECK: 2:1 [[PREFIX]]/relative/h1.h llvmcas://
27+
// CHECK: 2:1 PREFIX{{/|\\}}relative{{/|\\}}h1.h llvmcas://
2828
// CHECK: Files:
29-
// CHECK: [[PREFIX]]/t.c llvmcas://
30-
// CHECK: [[PREFIX]]/relative/h1.h llvmcas://
29+
// CHECK: PREFIX{{/|\\}}t.c llvmcas://
30+
// CHECK: PREFIX{{/|\\}}relative{{/|\\}}h1.h llvmcas://
3131

3232
/// Using a different working directory should cache hit as well.
3333
/// FIXME: Working directory affects some codegen options added by clang driver, preserve them to make sure the cache hit.
34-
// RUN: sed -e "s|DIR|%/t|g" %t/cdb2.json.template > %t/cdb2.json
34+
// RUN: sed -e "s|DIR|%/t|g" %t/cdb2.json.template | sed -e "s|SEP|%{fs-sep-yaml}|g" > %t/cdb2.json
3535
// RUN: clang-scan-deps -compilation-database %t/cdb2.json -format experimental-include-tree-full -cas-path %t/cas \
3636
// RUN: > %t/deps2.json
3737
// RUN: %deps-to-rsp %t/deps2.json --tu-index 0 > %t/tu2.rsp
@@ -48,7 +48,7 @@
4848
//--- cdb2.json.template
4949
[{
5050
"directory": "DIR/other",
51-
"command": "clang -c DIR/t.c -I DIR/relative -working-directory DIR/other -o DIR/t2.o -MD -serialize-diagnostics DIR/t2.dia -fdebug-compilation-dir=DIR -fcoverage-compilation-dir=DIR",
51+
"command": "clang -c DIRSEPt.c -I DIRSEPrelative -working-directory DIR/other -o DIR/t2.o -MD -serialize-diagnostics DIR/t2.dia -fdebug-compilation-dir=DIR -fcoverage-compilation-dir=DIR",
5252
"file": "DIR/t.c"
5353
}]
5454

llvm/utils/lit/lit/TestRunner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@ def getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=False):
15301530
("%{fs-src-root}", pathlib.Path(sourcedir).anchor),
15311531
("%{fs-tmp-root}", pathlib.Path(tmpBase).anchor),
15321532
("%{fs-sep}", os.path.sep),
1533+
("%{fs-sep-yaml}", "\\\\\\\\\\\\\\\\" if kIsWindows else "/"),
15331534
]
15341535
)
15351536

0 commit comments

Comments
 (0)