1*67e74705SXin Li// RUN: rm -rf %t/ModuleCache 2*67e74705SXin Li// RUN: mkdir -p %t/Inputs/usr/include 3*67e74705SXin Li// RUN: touch %t/Inputs/usr/include/foo.h 4*67e74705SXin Li// RUN: echo 'module Foo [system] { header "foo.h" }' > %t/Inputs/usr/include/module.map 5*67e74705SXin Li 6*67e74705SXin Li//// 7*67e74705SXin Li// Build a module using a system header 8*67e74705SXin Li// 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 9*67e74705SXin Li// RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 10*67e74705SXin Li 11*67e74705SXin Li//// 12*67e74705SXin Li// Modify the system header, and confirm that we don't notice without -fmodules-validate-system-headers. 13*67e74705SXin Li// The pcm file in the cache should fail to validate. 14*67e74705SXin Li// RUN: echo ' ' >> %t/Inputs/usr/include/foo.h 15*67e74705SXin Li// 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 16*67e74705SXin Li// RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 17*67e74705SXin Li 18*67e74705SXin Li//// 19*67e74705SXin Li// Now make sure we rebuild the module when -fmodules-validate-system-headers is set. 20*67e74705SXin Li// 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 21*67e74705SXin Li// RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 22*67e74705SXin Li 23*67e74705SXin Li 24*67e74705SXin Li//// 25*67e74705SXin Li// This should override -fmodules-validate-once-per-build-session 26*67e74705SXin Li// RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 27*67e74705SXin Li// 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 28*67e74705SXin Li// RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 29*67e74705SXin Li 30*67e74705SXin Li// Modify the system header... 31*67e74705SXin Li// RUN: echo ' ' >> %t/Inputs/usr/include/foo.h 32*67e74705SXin Li 33*67e74705SXin Li// Don't recompile due to -fmodules-validate-once-per-build-session 34*67e74705SXin Li// 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 35*67e74705SXin Li// RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 36*67e74705SXin Li 37*67e74705SXin Li// Now add -fmodules-validate-system-headers and rebuild 38*67e74705SXin Li// 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 39*67e74705SXin Li// RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved 40*67e74705SXin Li 41*67e74705SXin Li@import Foo; 42