Author: yicuixi
Date: 2025-09-20T22:31:46+08:00
New Revision: 941ea28f3f4f12e49b5e511299a2bf7214795630

URL: 
https://github.com/llvm/llvm-project/commit/941ea28f3f4f12e49b5e511299a2bf7214795630
DIFF: 
https://github.com/llvm/llvm-project/commit/941ea28f3f4f12e49b5e511299a2bf7214795630.diff

LOG: [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 <qin_17...@126.com>

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/test/Modules/no-stale-modtime.m 
b/clang/test/Modules/no-stale-modtime.m
index 92c18ac591add..aa16eb1db5f68 100644
--- a/clang/test/Modules/no-stale-modtime.m
+++ b/clang/test/Modules/no-stale-modtime.m
@@ -3,33 +3,45 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
-// This could be replaced by diamond_*, except we want to modify the top header
-// RUN: echo '@import l; @import r;' > %t/b.h
-// RUN: echo '@import t; // fromt l' > %t/l.h
-// RUN: echo '@import t; // fromt r' > %t/r.h
+// RUN: split-file %s %t
 
-// RUN: echo '// top' > %t/t.h-1
 // RUN: cat %t/t.h-1 > %t/t.h
 
-// RUN: echo 'module b { header "b.h" } module l { header "l.h" }' > 
%t/module.modulemap-1
-// RUN: echo 'module r { header "r.h" } module t { header "t.h" }' > 
%t/module.modulemap-2
-// RUN: cat %t/module.modulemap-1 %t/module.modulemap-2 > %t/module.modulemap
-
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t 
-fdisable-module-hash \
-// RUN:     -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
-// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
+// RUN:     -I %t -fsyntax-only %t/main.m -Rmodule-build 2>&1 \
+// RUN: | FileCheck -check-prefix=REBUILD-ALL %t/main.m
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t 
-fdisable-module-hash \
-// RUN:     -I %t -fsyntax-only %s -Rmodule-build -verify
+// RUN:     -I %t -fsyntax-only %t/main.m -Rmodule-build -verify
 
 // Add an identifier to ensure everything depending on t is out of date
-// RUN: echo 'extern int a;' > %t/t.h-2
 // RUN: cat %t/t.h-1 %t/t.h-2 > %t/t.h
 
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t 
-fdisable-module-hash \
-// RUN:     -I %t -fsyntax-only %s -Rmodule-build 2>&1 \
-// RUN: | FileCheck -check-prefix=REBUILD-ALL %s
+// RUN:     -I %t -fsyntax-only %t/main.m -Rmodule-build 2>&1 \
+// RUN: | FileCheck -check-prefix=REBUILD-ALL %t/main.m
 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t 
-fdisable-module-hash \
-// RUN:     -I %t -fsyntax-only %s -Rmodule-build -verify
+// RUN:     -I %t -fsyntax-only %t/main.m -Rmodule-build -verify
+
+//--- b.h
+@import l; @import r;
+
+//--- l.h
+@import t; // fromt l
+
+//--- r.h
+@import t; // fromt r
+
+//--- t.h-1
+// top
+
+//--- t.h-2
+extern int a;
+
+//--- module.modulemap
+module b { header "b.h" } module l { header "l.h" }
+module r { header "r.h" } module t { header "t.h" }
+
+//--- main.m
 
 // REBUILD-ALL: building module 'b'
 // REBUILD-ALL: building module 'l'
@@ -38,5 +50,4 @@
 
 // Use -verify when expecting no modules to be rebuilt.
 // expected-no-diagnostics
-
 @import b;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to