[clang][modules] NFC: Simplify and clarify test

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.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D120463
This commit is contained in:
Jan Svoboda 2022-03-07 10:21:30 +01:00
parent d9633d1490
commit 242b24c184
3 changed files with 25 additions and 13 deletions

View File

@ -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