aboutsummaryrefslogtreecommitdiff
path: root/test/Modules/system_version.m
blob: 85b3263f7256f04af981adcfa38876112820e16a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Test checking that we're hashing a system version file in the
// module hash.
// REQUIRES: shell

// First, build a system root.
// RUN: rm -rf %t
// RUN: mkdir -p %t/usr/include
// RUN: cp %S/Inputs/Modified/A.h %t/usr/include
// RUN: cp %S/Inputs/Modified/B.h %t/usr/include
// RUN: cp %S/Inputs/Modified/module.map %t/usr/include

// Run once with no system version file. We should end up with one module.
// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify
// RUN: ls -R %t | grep -c ModA.pcm| grep 1

// Add a system version file and run again. We should now have two
// module variants.
// RUN: mkdir -p %t/System/Library/CoreServices
// RUN: echo "hello" > %t/System/Library/CoreServices/SystemVersion.plist
// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify
// RUN: ls -R %t | grep -c ModA.pcm| grep 2

// Change the system version file and run again. We should now have three
// module variants.
// RUN: mkdir -p %t/System/Library/CoreServices
// RUN: echo "modules" > %t/System/Library/CoreServices/SystemVersion.plist
// RUN: %clang_cc1 -fmodules-cache-path=%t/cache -fmodules -isysroot %t -I %t/usr/include %s -verify
// RUN: ls -R %t | grep -c ModA.pcm| grep 3

// expected-no-diagnostics
@import ModA;