Skip to content

Commit 9f7f4ac

Browse files
committed
[Clang][Modules] Add a target to build-explicit.cpp test. NFC
This test relies on two modules being different sizes, which is not always true with different architectures. Make the test x86 specific at the moment to ensure it does not fail spuriously.
1 parent e723e15 commit 9f7f4ac

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

clang/test/Modules/explicit-build.cpp

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
// Requires a specific target as the "module file has a different size than expected" is not reliable on all architectures.
2+
// REQUIRES: x86-registered-target
3+
14
// RUN: rm -rf %t
25

36
// -------------------------------
47
// Build chained modules A, B, and C
5-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
8+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
69
// RUN: -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/a.pcm \
710
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty
811
//
9-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
12+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
1013
// RUN: -fmodule-file=%t/a.pcm \
1114
// RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/b.pcm \
1215
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty
1316
//
14-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
17+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
1518
// RUN: -fmodule-file=%t/b.pcm \
1619
// RUN: -fmodule-name=c -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/c.pcm \
1720
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty
@@ -20,7 +23,7 @@
2023

2124
// -------------------------------
2225
// Build B with an implicit build of A
23-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
26+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
2427
// RUN: -fmodule-name=b -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/b-not-a.pcm \
2528
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-B-NO-A %s
2629
//
@@ -29,36 +32,36 @@
2932

3033
// -------------------------------
3134
// Check that we can use the explicitly-built A, B, and C modules.
32-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
35+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
3336
// RUN: -I%S/Inputs/explicit-build \
3437
// RUN: -fmodule-file=%t/a.pcm \
3538
// RUN: -verify %s -DHAVE_A
3639
//
37-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
40+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
3841
// RUN: -I%S/Inputs/explicit-build \
3942
// RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \
4043
// RUN: -fmodule-file=%t/a.pcm \
4144
// RUN: -verify %s -DHAVE_A
4245
//
43-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
46+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
4447
// RUN: -I%S/Inputs/explicit-build \
4548
// RUN: -fmodule-file=%t/b.pcm \
4649
// RUN: -verify %s -DHAVE_A -DHAVE_B
4750
//
48-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
51+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
4952
// RUN: -I%S/Inputs/explicit-build \
5053
// RUN: -fmodule-file=%t/a.pcm \
5154
// RUN: -fmodule-file=%t/b.pcm \
5255
// RUN: -verify %s -DHAVE_A -DHAVE_B
5356
//
54-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
57+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
5558
// RUN: -I%S/Inputs/explicit-build \
5659
// RUN: -fmodule-file=%t/a.pcm \
5760
// RUN: -fmodule-file=%t/b.pcm \
5861
// RUN: -fmodule-file=%t/c.pcm \
5962
// RUN: -verify %s -DHAVE_A -DHAVE_B -DHAVE_C
6063
//
61-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
64+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
6265
// RUN: -I%S/Inputs/explicit-build \
6366
// RUN: -fmodule-file=%t/a.pcm \
6467
// RUN: -fmodule-file=%t/c.pcm \
@@ -67,12 +70,12 @@
6770
// -------------------------------
6871
// Check that -fmodule-file= in a module build makes the file transitively
6972
// available even if it's not used.
70-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \
73+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \
7174
// RUN: -fmodule-file=%t/b.pcm \
7275
// RUN: -fmodule-name=d -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/d.pcm \
7376
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty
7477
//
75-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \
78+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fno-implicit-modules -Rmodule-build -fno-modules-error-recovery \
7679
// RUN: -I%S/Inputs/explicit-build \
7780
// RUN: -fmodule-file=%t/d.pcm \
7881
// RUN: -verify %s -DHAVE_A -DHAVE_B
@@ -104,35 +107,35 @@
104107

105108
// -------------------------------
106109
// Check that we can use a mixture of implicit and explicit modules.
107-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
110+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
108111
// RUN: -I%S/Inputs/explicit-build \
109112
// RUN: -fmodule-file=%t/b-not-a.pcm \
110113
// RUN: -verify %s -DHAVE_A -DHAVE_B
111114

112115
// -------------------------------
113116
// Try to use two different flavors of the 'a' module.
114-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
117+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
115118
// RUN: -fmodule-file=%t/a.pcm \
116119
// RUN: -fmodule-file=%t/b-not-a.pcm \
117120
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-MULTIPLE-AS %s
118121
//
119-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
122+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
120123
// RUN: -fmodule-file=%t/a.pcm \
121124
// RUN: -fmodule-file=%t/b-not-a.pcm \
122125
// RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \
123126
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-MULTIPLE-AS %s
124127
//
125-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
128+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
126129
// RUN: -fmodule-name=a -emit-module %S/Inputs/explicit-build/module.modulemap -o %t/a-alt.pcm \
127130
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty
128131
//
129-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
132+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
130133
// RUN: -fmodule-file=%t/a.pcm \
131134
// RUN: -fmodule-file=%t/a-alt.pcm \
132135
// RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \
133136
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-MULTIPLE-AS %s
134137
//
135-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
138+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
136139
// RUN: -fmodule-file=%t/a-alt.pcm \
137140
// RUN: -fmodule-file=%t/a.pcm \
138141
// RUN: -fmodule-map-file=%S/Inputs/explicit-build/module.modulemap \
@@ -142,11 +145,11 @@
142145

143146
// -------------------------------
144147
// Try to import a PCH with -fmodule-file=
145-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
148+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
146149
// RUN: -fmodule-name=a -emit-pch %S/Inputs/explicit-build/a.h -o %t/a.pch -DBUILDING_A_PCH \
147150
// RUN: 2>&1 | FileCheck --check-prefix=CHECK-NO-IMPLICIT-BUILD %s --allow-empty
148151
//
149-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
152+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
150153
// RUN: -fmodule-file=%t/a.pch \
151154
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-A-AS-PCH %s
152155
//
@@ -157,20 +160,20 @@
157160
//
158161
// RUN: touch %t/not.pcm
159162
//
160-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
163+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
161164
// RUN: -fmodule-file=%t/not.pcm \
162165
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-BAD-FILE %s
163166
//
164167
// CHECK-BAD-FILE: fatal error: file '{{.*}}not.pcm' is not a valid precompiled module file: file too small to contain AST file magic
165168

166-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
169+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
167170
// RUN: -fmodule-file=%t/nonexistent.pcm \
168171
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-FILE %s
169172
//
170173
// CHECK-NO-FILE: fatal error: module file '{{.*}}nonexistent.pcm' not found: module file not found
171174

172175
// RUN: mv %t/a.pcm %t/a-tmp.pcm
173-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
176+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
174177
// RUN: -I%S/Inputs/explicit-build \
175178
// RUN: -fmodule-file=%t/c.pcm \
176179
// RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-NO-FILE-INDIRECT %s
@@ -185,7 +188,7 @@
185188
// Check that we don't get upset if B's timestamp is newer than C's.
186189
// RUN: touch %t/b.pcm
187190
//
188-
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
191+
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
189192
// RUN: -I%S/Inputs/explicit-build \
190193
// RUN: -fmodule-file=%t/c.pcm \
191194
// RUN: -verify %s -DHAVE_A -DHAVE_B -DHAVE_C
@@ -194,7 +197,7 @@
194197
//
195198
// RUN: cp %t/b-not-a.pcm %t/b.pcm
196199
//
197-
// RUN: not %clang_cc1 -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
200+
// RUN: not %clang_cc1 -triple=x86_64-linux-gnu -x c++ -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-build -fno-modules-error-recovery \
198201
// RUN: -I%S/Inputs/explicit-build \
199202
// RUN: -fmodule-file=%t/c.pcm \
200203
// RUN: %s -DHAVE_A -DHAVE_B -DHAVE_C 2>&1 | FileCheck --check-prefix=CHECK-MISMATCHED-B %s

0 commit comments

Comments
 (0)