1// REQUIRES: shell
2// RUN: rm -rf %t
3
4// A from path 1
5// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path1/A -DDIRECT -DEXPECTED_PATH=1
6
7// A from path 2
8// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path2/A -DDIRECT -DEXPECTED_PATH=2
9
10// Confirm that we have two pcm files (one for each 'A').
11// RUN: find %t -name "A-*.pcm" | count 2
12
13// DependsOnA, using A from path 1
14// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -DEXPECTED_PATH=1
15
16// Confirm that we have three pcm files (one for each 'A', and one for 'DependsOnA')
17// RUN: find %t -name "*.pcm" | count 3
18
19// DependsOnA, using A from path 2
20// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -DEXPECTED_PATH=2
21
22// Confirm that we still have three pcm files, since DependsOnA will be rebuilt
23// RUN: find %t -name "*.pcm" | count 3
24
25#ifdef DIRECT
26@import A;
27#else
28@import DependsOnA;
29#endif
30
31#if FROM_PATH != EXPECTED_PATH
32#error "Got the wrong module!"
33#endif
34
35// expected-no-diagnostics
36