Skip to content

Commit 941ea28

Browse files
authored
[NFC][clang] Refactor no-stable-modtime.m test use split-file (#159924)
This PR refactor no-stable-modtime.m to use split-file Signed-off-by: yicuixi <[email protected]>
1 parent 23efc67 commit 941ea28

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

clang/test/Modules/no-stale-modtime.m

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,45 @@
33

44
// RUN: rm -rf %t
55
// RUN: mkdir -p %t
6-
// This could be replaced by diamond_*, except we want to modify the top header
7-
// RUN: echo '@import l; @import r;' > %t/b.h
8-
// RUN: echo '@import t; // fromt l' > %t/l.h
9-
// RUN: echo '@import t; // fromt r' > %t/r.h
6+
// RUN: split-file %s %t
107

11-
// RUN: echo '// top' > %t/t.h-1
128
// RUN: cat %t/t.h-1 > %t/t.h
139

14-
// RUN: echo 'module b { header "b.h" } module l { header "l.h" }' > %t/module.modulemap-1
15-
// RUN: echo 'module r { header "r.h" } module t { header "t.h" }' > %t/module.modulemap-2
16-
// RUN: cat %t/module.modulemap-1 %t/module.modulemap-2 > %t/module.modulemap
17-
1810
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
19-
// RUN: -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
20-
// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
11+
// RUN: -I %t -fsyntax-only %t/main.m -Rmodule-build 2>&1 \
12+
// RUN: | FileCheck -check-prefix=REBUILD-ALL %t/main.m
2113
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
22-
// RUN: -I %t -fsyntax-only %s -Rmodule-build -verify
14+
// RUN: -I %t -fsyntax-only %t/main.m -Rmodule-build -verify
2315

2416
// Add an identifier to ensure everything depending on t is out of date
25-
// RUN: echo 'extern int a;' > %t/t.h-2
2617
// RUN: cat %t/t.h-1 %t/t.h-2 > %t/t.h
2718

2819
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
29-
// RUN: -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
30-
// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
20+
// RUN: -I %t -fsyntax-only %t/main.m -Rmodule-build 2>&1 \
21+
// RUN: | FileCheck -check-prefix=REBUILD-ALL %t/main.m
3122
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fdisable-module-hash \
32-
// RUN: -I %t -fsyntax-only %s -Rmodule-build -verify
23+
// RUN: -I %t -fsyntax-only %t/main.m -Rmodule-build -verify
24+
25+
//--- b.h
26+
@import l; @import r;
27+
28+
//--- l.h
29+
@import t; // fromt l
30+
31+
//--- r.h
32+
@import t; // fromt r
33+
34+
//--- t.h-1
35+
// top
36+
37+
//--- t.h-2
38+
extern int a;
39+
40+
//--- module.modulemap
41+
module b { header "b.h" } module l { header "l.h" }
42+
module r { header "r.h" } module t { header "t.h" }
43+
44+
//--- main.m
3345

3446
// REBUILD-ALL: building module 'b'
3547
// REBUILD-ALL: building module 'l'
@@ -38,5 +50,4 @@
3850

3951
// Use -verify when expecting no modules to be rebuilt.
4052
// expected-no-diagnostics
41-
4253
@import b;

0 commit comments

Comments
 (0)