jansvoboda11 created this revision.
jansvoboda11 added reviewers: ilyakuteev, Bigcheese, dexonsmith.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch simplifies a test that checks only used module map files are 
reported as input files in PCM files.

Instead of using opaque `diff`, this patch uses `clang -module-file-info` and 
`FileCheck` to verify this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120463

Files:
  clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap
  clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap
  clang/test/Modules/add-remove-irrelevant-module-map.m


Index: clang/test/Modules/add-remove-irrelevant-module-map.m
===================================================================
--- clang/test/Modules/add-remove-irrelevant-module-map.m
+++ clang/test/Modules/add-remove-irrelevant-module-map.m
@@ -1,16 +1,30 @@
-// RUN: rm -rf %t
-// RUN: rm -rf %t.mcp
-// RUN: mkdir -p %t
+// RUN: rm -rf %t && mkdir %t
+// RUN: split-file %s %t
 
-// Build without b.modulemap
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t.mcp -fdisable-module-hash 
-fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap %s -verify
-// RUN: cp %t.mcp/a.pcm %t/a.pcm
+//--- a.modulemap
+module a {}
 
-// Build with b.modulemap
-// RUN: rm -rf %t.mcp
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t.mcp -fdisable-module-hash 
-fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap 
-fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap %s -verify
-// RUN: not diff %t.mcp/a.pcm %t/a.pcm
+//--- b.modulemap
+module b {}
 
+//--- test-simple.m
 // expected-no-diagnostics
-
 @import a;
+
+// Build without b.modulemap:
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t/cache -fdisable-module-hash \
+// RUN:   -fmodule-map-file=%t/a.modulemap %t/test-simple.m -verify
+// RUN: mv %t/cache %t/cache-without-b
+
+// Build with b.modulemap:
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t/cache -fdisable-module-hash \
+// RUN:   -fmodule-map-file=%t/a.modulemap -fmodule-map-file=%t/b.modulemap 
%t/test-simple.m -verify
+// RUN: mv %t/cache %t/cache-with-b
+
+// Neither PCM file considers 'b.modulemap' an input:
+//
+// RUN: %clang_cc1 -module-file-info %t/cache-without-b/a.pcm | FileCheck %s
+// RUN: %clang_cc1 -module-file-info %t/cache-with-b/a.pcm | FileCheck %s
+// CHECK-NOT: Input file: {{.*}}/b.modulemap
Index: clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap
===================================================================
--- clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap
+++ /dev/null
@@ -1 +0,0 @@
-module b { }
Index: clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap
===================================================================
--- clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap
+++ /dev/null
@@ -1 +0,0 @@
-module a { }


Index: clang/test/Modules/add-remove-irrelevant-module-map.m
===================================================================
--- clang/test/Modules/add-remove-irrelevant-module-map.m
+++ clang/test/Modules/add-remove-irrelevant-module-map.m
@@ -1,16 +1,30 @@
-// RUN: rm -rf %t
-// RUN: rm -rf %t.mcp
-// RUN: mkdir -p %t
+// RUN: rm -rf %t && mkdir %t
+// RUN: split-file %s %t
 
-// Build without b.modulemap
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap %s -verify
-// RUN: cp %t.mcp/a.pcm %t/a.pcm
+//--- a.modulemap
+module a {}
 
-// Build with b.modulemap
-// RUN: rm -rf %t.mcp
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash -fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap -fmodule-map-file=%S/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap %s -verify
-// RUN: not diff %t.mcp/a.pcm %t/a.pcm
+//--- b.modulemap
+module b {}
 
+//--- test-simple.m
 // expected-no-diagnostics
-
 @import a;
+
+// Build without b.modulemap:
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -fdisable-module-hash \
+// RUN:   -fmodule-map-file=%t/a.modulemap %t/test-simple.m -verify
+// RUN: mv %t/cache %t/cache-without-b
+
+// Build with b.modulemap:
+//
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -fdisable-module-hash \
+// RUN:   -fmodule-map-file=%t/a.modulemap -fmodule-map-file=%t/b.modulemap %t/test-simple.m -verify
+// RUN: mv %t/cache %t/cache-with-b
+
+// Neither PCM file considers 'b.modulemap' an input:
+//
+// RUN: %clang_cc1 -module-file-info %t/cache-without-b/a.pcm | FileCheck %s
+// RUN: %clang_cc1 -module-file-info %t/cache-with-b/a.pcm | FileCheck %s
+// CHECK-NOT: Input file: {{.*}}/b.modulemap
Index: clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap
===================================================================
--- clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/b.modulemap
+++ /dev/null
@@ -1 +0,0 @@
-module b { }
Index: clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap
===================================================================
--- clang/test/Modules/Inputs/AddRemoveIrrelevantModuleMap/a.modulemap
+++ /dev/null
@@ -1 +0,0 @@
-module a { }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D120463: [... Jan Svoboda via Phabricator via cfe-commits

Reply via email to