Ben Langmuir | dcf7386 | 2014-03-12 00:06:17 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t/ModuleCache |
| 2 | // RUN: mkdir -p %t/Inputs/usr/include |
| 3 | // RUN: touch %t/Inputs/usr/include/foo.h |
| 4 | // RUN: echo 'module Foo [system] { header "foo.h" }' > %t/Inputs/usr/include/module.map |
| 5 | |
| 6 | //// |
| 7 | // Build a module using a system header |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 8 | // RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s |
Ben Langmuir | dcf7386 | 2014-03-12 00:06:17 +0000 | [diff] [blame] | 9 | // RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
| 10 | |
| 11 | //// |
| 12 | // Modify the system header, and confirm that we don't notice without -fmodules-validate-system-headers. |
| 13 | // The pcm file in the cache should fail to validate. |
| 14 | // RUN: echo ' ' >> %t/Inputs/usr/include/foo.h |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 15 | // RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s |
Ben Langmuir | dcf7386 | 2014-03-12 00:06:17 +0000 | [diff] [blame] | 16 | // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
| 17 | |
| 18 | //// |
| 19 | // Now make sure we rebuild the module when -fmodules-validate-system-headers is set. |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 20 | // RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s |
Ben Langmuir | dcf7386 | 2014-03-12 00:06:17 +0000 | [diff] [blame] | 21 | // RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
| 22 | |
Ben Langmuir | 1e25822 | 2014-04-08 15:36:28 +0000 | [diff] [blame] | 23 | |
| 24 | //// |
| 25 | // This should override -fmodules-validate-once-per-build-session |
| 26 | // RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 27 | // RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session |
Ben Langmuir | 1e25822 | 2014-04-08 15:36:28 +0000 | [diff] [blame] | 28 | // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
| 29 | |
| 30 | // Modify the system header... |
| 31 | // RUN: echo ' ' >> %t/Inputs/usr/include/foo.h |
| 32 | |
| 33 | // Don't recompile due to -fmodules-validate-once-per-build-session |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 34 | // RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session |
Ben Langmuir | 1e25822 | 2014-04-08 15:36:28 +0000 | [diff] [blame] | 35 | // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
| 36 | |
| 37 | // Now add -fmodules-validate-system-headers and rebuild |
Richard Smith | 47972af | 2015-06-16 00:08:24 +0000 | [diff] [blame] | 38 | // RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fimplicit-module-maps -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session |
Ben Langmuir | 1e25822 | 2014-04-08 15:36:28 +0000 | [diff] [blame] | 39 | // RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved |
| 40 | |
Ben Langmuir | dcf7386 | 2014-03-12 00:06:17 +0000 | [diff] [blame] | 41 | @import Foo; |