diff options
author | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
commit | 173a4f43a911175643bda81ee675e8d9269056ea (patch) | |
tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /test/Modules/fmodules-validate-once-per-build-session.c | |
parent | 88f7a7d5251a2d813460274c92decc143a11569b (diff) | |
download | FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.zip FreeBSD-src-173a4f43a911175643bda81ee675e8d9269056ea.tar.gz |
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_350/final@216957
Diffstat (limited to 'test/Modules/fmodules-validate-once-per-build-session.c')
-rw-r--r-- | test/Modules/fmodules-validate-once-per-build-session.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/Modules/fmodules-validate-once-per-build-session.c b/test/Modules/fmodules-validate-once-per-build-session.c new file mode 100644 index 0000000..346d5a7 --- /dev/null +++ b/test/Modules/fmodules-validate-once-per-build-session.c @@ -0,0 +1,45 @@ +#include "foo.h" + +// Clear the module cache. +// RUN: rm -rf %t +// RUN: mkdir -p %t/Inputs +// RUN: mkdir -p %t/modules-to-compare + +// === +// Create a module with system headers. +// RUN: echo 'void meow(void);' > %t/Inputs/foo.h +// RUN: echo 'module Foo [system] { header "foo.h" }' > %t/Inputs/module.map + +// === +// Compile the module. +// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp +// RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-before.pcm + +// === +// Use it, and make sure that we did not recompile it. +// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp +// RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm + +// RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm + +// === +// Change the sources. +// RUN: echo 'void meow2(void);' > %t/Inputs/foo.h + +// === +// Use the module, and make sure that we did not recompile it, even though the sources changed. +// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1390000000 -fmodules-validate-once-per-build-session %s +// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp +// RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm + +// RUN: diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm + +// === +// Recompile the module if the today's date is before 01 January 2030. +// RUN: %clang_cc1 -cc1 -fmodules -fdisable-module-hash -fmodules-cache-path=%t/modules-cache -fsyntax-only -I %t/Inputs -fbuild-session-timestamp=1893456000 -fmodules-validate-once-per-build-session %s +// RUN: ls -R %t/modules-cache | grep Foo.pcm.timestamp +// RUN: cp %t/modules-cache/Foo.pcm %t/modules-to-compare/Foo-after.pcm + +// RUN: not diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm |