[clang-tidy] Mock system headers for portability-restrict-system-includes tests.
authorPaula Toth <paulatoth@google.com>
Wed, 11 Mar 2020 19:12:35 +0000 (12:12 -0700)
committerPaula Toth <paulatoth@google.com>
Wed, 11 Mar 2020 19:13:27 +0000 (12:13 -0700)
Summary: Didn't realize that headers such as stddef.h may not exist on all systems. This patch mocks the headers so that the check's tests work on all systems.  (:

Reviewers: RKSimon, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

Differential Revision: https://reviews.llvm.org/D76015

clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/a.h [deleted file]
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/float.h [moved from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.h with 100% similarity]
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stddef.h [moved from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdlib.h with 100% similarity]
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stdint.h [moved from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdarg.h with 100% similarity]
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp

diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/a.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/a.h
deleted file mode 100644 (file)
index e69de29..0000000
index e3a9376..a74b94b 100644 (file)
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s portability-restrict-system-includes %t \
-// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '*,-stddef.h'}]}"
+// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '*,-stddef.h'}]}" \
+// RUN:     -- -isystem %S/Inputs/portability-restrict-system-includes/system
 
 // Test block-list functionality: allow all but stddef.h.
 
index f73cbbf..1d1e8a4 100644 (file)
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s portability-restrict-system-includes %t \
-// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,stddef.h'}]}"
+// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,stddef.h'}]}" \
+// RUN:     -- -isystem %S/Inputs/portability-restrict-system-includes/system
 
 // Test allow-list functionality: disallow all but stddef.h.
 
index bee7ec7..e1cd588 100644 (file)
@@ -1,5 +1,6 @@
 // RUN: %check_clang_tidy %s portability-restrict-system-includes %t \
-// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,std*.h'}]}"
+// RUN:     -- -config="{CheckOptions: [{key: portability-restrict-system-includes.Includes, value: '-*,std*.h'}]}" \
+// RUN:     -- -isystem %S/Inputs/portability-restrict-system-includes/system
 
 // Test glob functionality: disallow all headers except those that match
 // pattern "std*.h".