r219030 - test: Disable standard system includes in %clang_cc1

Justin Bogner mail at justinbogner.com
Fri Oct 3 15:18:50 PDT 2014


Author: bogner
Date: Fri Oct  3 17:18:49 2014
New Revision: 219030

URL: http://llvm.org/viewvc/llvm-project?rev=219030&view=rev
Log:
test: Disable standard system includes in %clang_cc1

This adds -nostdsysteminc to the %clang_cc1 expansion, which should
make it harder to accidentally write tests that depend on headers in
/usr/include. It also updates a few tests that use -isysroot <x> and a
darwin triple to omit the triple and use -isystem <x>/usr/include
instead, making them a little bit more general.

Incidentally, this fixes a test failure I'm seeing on darwin in
Modules/stddef.c, that happens because my system finds a stddef.h in
/usr/include.

Modified:
    cfe/trunk/test/Modules/Werror-Wsystem-headers.m
    cfe/trunk/test/Modules/dependency-gen.m
    cfe/trunk/test/Modules/module_file_info.m
    cfe/trunk/test/Modules/validate-system-headers.m
    cfe/trunk/test/PCH/verify_pch.m
    cfe/trunk/test/Preprocessor/headermap-rel2.c
    cfe/trunk/test/lit.cfg

Modified: cfe/trunk/test/Modules/Werror-Wsystem-headers.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Werror-Wsystem-headers.m?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Werror-Wsystem-headers.m (original)
+++ cfe/trunk/test/Modules/Werror-Wsystem-headers.m Fri Oct  3 17:18:49 2014
@@ -5,17 +5,17 @@
 
 // Initial module build
 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
-// RUN:     -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -fsyntax-only %s -verify
+// RUN:     -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify
 // RUN: cp %t/cstd.pcm %t-saved/cstd.pcm
 
 // Even with -Werror don't rebuild a system module
 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
-// RUN:     -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -fsyntax-only %s -verify -Werror
+// RUN:     -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify -Werror
 // RUN: diff %t/cstd.pcm %t-saved/cstd.pcm
 
 // Unless -Wsystem-headers is on
 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fdisable-module-hash \
-// RUN:     -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -fsyntax-only %s -verify \
+// RUN:     -isystem %S/Inputs/System/usr/include -fsyntax-only %s -verify \
 // RUN:     -Werror=unused -Wsystem-headers
 // RUN: not diff %t/cstd.pcm %t-saved/cstd.pcm
 

Modified: cfe/trunk/test/Modules/dependency-gen.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/dependency-gen.m?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/Modules/dependency-gen.m (original)
+++ cfe/trunk/test/Modules/dependency-gen.m Fri Oct  3 17:18:49 2014
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t-mcp
 // RUN: mkdir -p %t-mcp
 
-// RUN: %clang_cc1 -x objective-c -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -dependency-file %t.d.1 -MT %s.o -I %S/Inputs -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s
+// RUN: %clang_cc1 -x objective-c -isystem %S/Inputs/System/usr/include -dependency-file %t.d.1 -MT %s.o -I %S/Inputs -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s
 // RUN: FileCheck %s < %t.d.1
 // CHECK: dependency-gen.m
 // CHECK: Inputs{{.}}diamond_top.h
@@ -10,7 +10,7 @@
 // CHECK-NOT: stdint.h
 
 
-// RUN: %clang_cc1 -x objective-c -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -dependency-file %t.d.2 -MT %s.o -I %S/Inputs -sys-header-deps -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s
+// RUN: %clang_cc1 -x objective-c -isystem %S/Inputs/System/usr/include -dependency-file %t.d.2 -MT %s.o -I %S/Inputs -sys-header-deps -fsyntax-only -fmodules -fmodules-cache-path=%t-mcp %s
 // RUN: FileCheck %s -check-prefix=CHECK-SYS < %t.d.2
 // CHECK-SYS: dependency-gen.m
 // CHECK-SYS: Inputs{{.}}diamond_top.h

Modified: cfe/trunk/test/Modules/module_file_info.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module_file_info.m?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/Modules/module_file_info.m (original)
+++ cfe/trunk/test/Modules/module_file_info.m Fri Oct  3 17:18:49 2014
@@ -17,8 +17,8 @@
 
 // CHECK: Target options:
 // CHECK:     Triple:
-// CHECK:     CPU: 
-// CHECK:     ABI: 
+// CHECK:     CPU:
+// CHECK:     ABI:
 
 // CHECK: Diagnostic options:
 // CHECK:   IgnoreWarnings: Yes
@@ -28,7 +28,7 @@
 // CHECK: Header search options:
 // CHECK:   System root [-isysroot=]: '/'
 // CHECK:   Use builtin include directories [-nobuiltininc]: Yes
-// CHECK:   Use standard system include directories [-nostdinc]: Yes
+// CHECK:   Use standard system include directories [-nostdinc]: No
 // CHECK:   Use standard C++ include directories [-nostdinc++]: Yes
 // CHECK:   Use libc++ (rather than libstdc++) [-stdlib=]:
 

Modified: cfe/trunk/test/Modules/validate-system-headers.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/validate-system-headers.m?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/Modules/validate-system-headers.m (original)
+++ cfe/trunk/test/Modules/validate-system-headers.m Fri Oct  3 17:18:49 2014
@@ -5,37 +5,37 @@
 
 ////
 // Build a module using a system header
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t/Inputs -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s
+// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s
 // RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
 
 ////
 // Modify the system header, and confirm that we don't notice without -fmodules-validate-system-headers.
 // The pcm file in the cache should fail to validate.
 // RUN: echo ' ' >> %t/Inputs/usr/include/foo.h
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t/Inputs -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s
+// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s
 // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
 
 ////
 // Now make sure we rebuild the module when -fmodules-validate-system-headers is set.
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t/Inputs -fmodules -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s
+// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -fmodules-validate-system-headers -fmodules-cache-path=%t/ModuleCache -fdisable-module-hash -x objective-c-header -fsyntax-only %s
 // RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
 
 
 ////
 // This should override -fmodules-validate-once-per-build-session
 // RUN: cp %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t/Inputs -fmodules -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
+// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -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
 // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
 
 // Modify the system header...
 // RUN: echo ' ' >> %t/Inputs/usr/include/foo.h
 
 // Don't recompile due to -fmodules-validate-once-per-build-session
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t/Inputs -fmodules -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
+// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -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
 // RUN: diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
 
 // Now add -fmodules-validate-system-headers and rebuild
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t/Inputs -fmodules -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
+// RUN: %clang_cc1 -isystem %t/Inputs/usr/include -fmodules -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
 // RUN: not diff %t/ModuleCache/Foo.pcm %t/Foo.pcm.saved
 
 // REQUIRES: shell

Modified: cfe/trunk/test/PCH/verify_pch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/verify_pch.m?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/PCH/verify_pch.m (original)
+++ cfe/trunk/test/PCH/verify_pch.m Fri Oct  3 17:18:49 2014
@@ -5,25 +5,25 @@
 // RUN: cp %s %t.h
 //
 // Precompile
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -x objective-c-header -emit-pch -o %t.pch %t.h
+// RUN: %clang_cc1 -isystem %t/usr/include -x objective-c-header -emit-pch -o %t.pch %t.h
 
 // Verify successfully
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch
+// RUN: %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch
 
 // Incompatible lang options ignored
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -x objective-c -fno-builtin -verify-pch %t.pch
+// RUN: %clang_cc1 -isystem %t/usr/include -x objective-c -fno-builtin -verify-pch %t.pch
 
 // Stale dependency
 // RUN: echo ' ' >> %t.h
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch 2> %t.log.2
+// RUN: not %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch 2> %t.log.2
 // RUN: FileCheck -check-prefix=CHECK-STALE-DEP %s < %t.log.2
 // CHECK-STALE-DEP: file '{{.*}}.h' has been modified since the precompiled header '{{.*}}.pch' was built
 
 // Stale dependency in system header
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -x objective-c-header -emit-pch -o %t.pch %t.h
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch
+// RUN: %clang_cc1 -isystem %t/usr/include -x objective-c-header -emit-pch -o %t.pch %t.h
+// RUN: %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch
 // RUN: echo ' ' >> %t/usr/include/sys_header.h
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch 2> %t.log.3
+// RUN: not %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch 2> %t.log.3
 // RUN: FileCheck -check-prefix=CHECK-STALE-SYS-H %s < %t.log.3
 // CHECK-STALE-SYS-H: file '{{.*}}sys_header.h' has been modified since the precompiled header '{{.*}}.pch' was built
 

Modified: cfe/trunk/test/Preprocessor/headermap-rel2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/headermap-rel2.c?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/headermap-rel2.c (original)
+++ cfe/trunk/test/Preprocessor/headermap-rel2.c Fri Oct  3 17:18:49 2014
@@ -1,8 +1,8 @@
 // This uses a headermap with this entry:
 //   someheader.h -> Product/someheader.h
 
-// RUN: %clang_cc1 -triple x86_64-apple-darwin13 -v -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H
-// RUN: %clang_cc1 -triple x86_64-apple-darwin13 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H 2> %t.out
+// RUN: %clang_cc1 -v -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isystem %S/Inputs/headermap-rel2/system/usr/include -I %S/Inputs/headermap-rel2 -H
+// RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isystem %S/Inputs/headermap-rel2/system/usr/include -I %S/Inputs/headermap-rel2 -H 2> %t.out
 // RUN: FileCheck %s -input-file %t.out
 
 // CHECK: Product/someheader.h

Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=219030&r1=219029&r2=219030&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Fri Oct  3 17:18:49 2014
@@ -259,7 +259,8 @@ def makeMSABITriple(triple):
     # -win32 is not supported for non-x86 targets; use a default.
     return 'i686-pc-win32'
 
-config.substitutions.append( ('%clang_cc1', '%s -cc1 -internal-isystem %s'
+config.substitutions.append( ('%clang_cc1',
+                              '%s -cc1 -internal-isystem %s -nostdsysteminc'
                               % (config.clang,
                                  getClangBuiltinIncludeDir(config.clang))) )
 config.substitutions.append( ('%clang_cpp', ' ' + config.clang +





More information about the cfe-commits mailing list