Skip to content

Commit 1352a40

Browse files
committed
Add test with multiple TUs in one command line
1 parent ed0b755 commit 1352a40

File tree

6 files changed

+37
-7
lines changed

6 files changed

+37
-7
lines changed

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ def remark_mbd_connection :
284284
Remark<"Successfully connected to module build daemon at %0">,
285285
InGroup<ModuleBuildDaemon>;
286286
def remark_mbd_handshake :
287-
Remark<"Successfully completed handshake with module build daemon">,
287+
Remark<"Clang invocation responsible for %0 successfully completed handshake "
288+
"with module build daemon">,
288289
InGroup<ModuleBuildDaemon>;
289290

290291
def warn_eagerly_load_for_standard_cplusplus_modules : Warning<

clang/lib/Tooling/ModuleBuildDaemon/Frontend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ void spawnModuleBuildDaemonAndHandshake(const CompilerInvocation &Clang,
145145
return;
146146
}
147147

148-
Diag.Report(diag::remark_mbd_handshake);
148+
Diag.Report(diag::remark_mbd_handshake)
149+
<< Clang.getFrontendOpts().Inputs[0].getFile();
149150
return;
150151
}
151152

clang/test/ModuleBuildDaemon/daemon-crash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: rm -rf mbd-crash %t
44

55
// timeout should exit with status 124 which is treated as a failure by lit on
6-
// windows. Ideally we would be like to check the exit code and only return true
6+
// windows. Ideally we would like to check the exit code and only return true
77
// if it equals 124 but lit does not support global bash sysmbols like $?
88

99
// RUN: timeout --signal=SIGKILL 2 %clang -cc1modbuildd mbd-crash -v || true

clang/test/ModuleBuildDaemon/daemon-launch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: rm -rf mbd-launch %t
44

55
// timeout should exit with status 124 which is treated as a failure by lit on
6-
// windows. Ideally we would be like to check the exit code and only return true
6+
// windows. Ideally we would like to check the exit code and only return true
77
// if it equals 124 but lit does not support global bash sysmbols like $?
88

99
// RUN: timeout --signal=SIGTERM 2 %clang -cc1modbuildd mbd-launch -v || true

clang/test/ModuleBuildDaemon/handshake.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//--- main.c
88
int main() {return 0;}
99

10+
// Return true regardless so lit test does not exit before daemon is killed
1011
// RUN: %clang -fmodule-build-daemon=mbd-handshake -Rmodule-build-daemon %t/main.c &> %t/output-new || true
1112
// RUN: %clang -fmodule-build-daemon=mbd-handshake -Rmodule-build-daemon %t/main.c &> %t/output-existing || true
1213
// RUN: %kill-process "-cc1modbuildd mbd-handshake"
@@ -15,11 +16,11 @@ int main() {return 0;}
1516
// RUN: cat %t/output-existing | sed 's:\\\\\?:/:g' | FileCheck %s --check-prefix=CHECK-EXIST
1617

1718
// CHECK: remark: Successfully spawned module build daemon [-Rmodule-build-daemon]
18-
// CHECK: remark: Successfully connected to module build daemon at mbd-handshake/mbd.sock [-Rmodule-build-daemon]
19-
// CHECK: remark: Successfully completed handshake with module build daemon [-Rmodule-build-daemon]
19+
// CHECK-NEXT: remark: Successfully connected to module build daemon at mbd-handshake/mbd.sock [-Rmodule-build-daemon]
20+
// CHECK-NEXT: remark: Clang invocation responsible for {{.*main.c}} successfully completed handshake with module build daemon [-Rmodule-build-daemon]
2021

2122
// Check that a clang invocation can handshake with an existing module build daemon
22-
// CHECK-EXIST: remark: Successfully completed handshake with module build daemon [-Rmodule-build-daemon]
23+
// CHECK-EXIST: remark: Clang invocation responsible for {{.*main.c}} successfully completed handshake with module build daemon [-Rmodule-build-daemon]
2324

2425
// Make sure mbd.err is empty
2526
// RUN: [ ! -s "mbd-launch/mbd.err" ] && true || false
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Check that a driver command line with multiple translation units can create two
2+
// frontend invocations which can successfully handshake with the module build daemon
3+
4+
// RUN: %kill-process "-cc1modbuildd mbd-multiple-tu"
5+
// RUN: rm -rf mbd-multiple-tu %t
6+
// RUN: split-file %s %t
7+
8+
//--- foo.c
9+
int foo() {return 0;}
10+
11+
//--- main.c
12+
int foo();
13+
int main() {return foo();}
14+
15+
// Return true regardless so lit test does not exit before daemon is killed
16+
// RUN: %clang -fmodule-build-daemon=mbd-multiple-tu -Rmodule-build-daemon %t/main.c %t/foo.c &> %t/output || true
17+
// RUN: %kill-process "-cc1modbuildd mbd-multiple-tu"
18+
19+
// RUN: cat %t/output | sed 's:\\\\\?:/:g' | FileCheck %s
20+
21+
// CHECK: remark: Successfully spawned module build daemon [-Rmodule-build-daemon]
22+
// CHECK-NEXT: remark: Successfully connected to module build daemon at mbd-multiple-tu/mbd.sock [-Rmodule-build-daemon]
23+
// CHECK-DAG: remark: Clang invocation responsible for {{.*main.c}} successfully completed handshake with module build daemon [-Rmodule-build-daemon]
24+
// CHECK-DAG: remark: Clang invocation responsible for {{.*foo.c}} successfully completed handshake with module build daemon [-Rmodule-build-daemon]
25+
26+
// Make sure mbd.err is empty
27+
// RUN: [ ! -s "mbd-launch/mbd.err" ] && true || false

0 commit comments

Comments
 (0)