summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/fmodules-validate-once-per-build-session.c
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-02-12 10:40:07 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-02-12 10:40:07 +0000
commitfdd4f30f0e25f5df164f724d9d324f84bd749a6c (patch)
tree78fe864410f97fc90de26bd350589ed28318551b /clang/test/Modules/fmodules-validate-once-per-build-session.c
parentf430da4de68b5569634b03df30b38d1133dc169b (diff)
downloadbcm5719-llvm-fdd4f30f0e25f5df164f724d9d324f84bd749a6c.tar.gz
bcm5719-llvm-fdd4f30f0e25f5df164f724d9d324f84bd749a6c.zip
'svn add' files I forgot for r201224 (Add an option to allow Clang verify
source files for a module only once during) llvm-svn: 201225
Diffstat (limited to 'clang/test/Modules/fmodules-validate-once-per-build-session.c')
-rw-r--r--clang/test/Modules/fmodules-validate-once-per-build-session.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/clang/test/Modules/fmodules-validate-once-per-build-session.c b/clang/test/Modules/fmodules-validate-once-per-build-session.c
new file mode 100644
index 00000000000..dac8a7197e0
--- /dev/null
+++ b/clang/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: find %t/modules-cache -name Foo.pcm | xargs -I {} cp {} %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: find %t/modules-cache -name Foo.pcm | xargs -I {} cp {} %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: find %t/modules-cache -name Foo.pcm | xargs -I {} cp {} %t/modules-to-compare/Foo-after.pcm
+
+// RUN: not diff %t/modules-to-compare/Foo-before.pcm %t/modules-to-compare/Foo-after.pcm
OpenPOWER on IntegriCloud