1// Test checking that we're hashing a system version file in the
2// module hash.
3
4// First, build a system root.
5// RUN: rm -rf %t
6// RUN: mkdir -p %t/usr/include
7// RUN: cp %S/Inputs/Modified/A.h %t/usr/include
8// RUN: cp %S/Inputs/Modified/B.h %t/usr/include
9// RUN: cp %S/Inputs/Modified/module.map %t/usr/include
10
11// Run once with no system version file. We should end up with one module.
12// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -isysroot %t -I %t/usr/include %s -verify
13// RUN: ls -R %t | grep -c "ModA.*pcm" | grep 1
14
15// Add a system version file and run again. We should now have two
16// module variants.
17// RUN: mkdir -p %t/System/Library/CoreServices
18// RUN: echo "hello" > %t/System/Library/CoreServices/SystemVersion.plist
19// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -isysroot %t -I %t/usr/include %s -verify
20// RUN: ls -R %t | grep -c "ModA.*pcm" | grep 2
21
22// Change the system version file and run again. We should now have three
23// module variants.
24// RUN: mkdir -p %t/System/Library/CoreServices
25// RUN: echo "modules" > %t/System/Library/CoreServices/SystemVersion.plist
26// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -isysroot %t -I %t/usr/include %s -verify
27// RUN: ls -R %t | grep -c "ModA.*pcm" | grep 3
28
29// expected-no-diagnostics
30@import ModA;
31
32