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