[clang-tools-extra] f1736f7 - [clang-tidy] Mock system headers for portability-restrict-system-includes tests.
Paula Toth via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 12:13:40 PDT 2020
Author: Paula Toth
Date: 2020-03-11T12:13:27-07:00
New Revision: f1736f7a2a660944c24aac45e24cdf1ea6c6effa
URL: https://github.com/llvm/llvm-project/commit/f1736f7a2a660944c24aac45e24cdf1ea6c6effa
DIFF: https://github.com/llvm/llvm-project/commit/f1736f7a2a660944c24aac45e24cdf1ea6c6effa.diff
LOG: [clang-tidy] Mock system headers for portability-restrict-system-includes tests.
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
Added:
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/float.h
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stddef.h
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stdint.h
Modified:
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
Removed:
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/a.h
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdarg.h
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdlib.h
clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.h
################################################################################
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/system/float.h
similarity index 100%
rename from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/a.h
rename to clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/float.h
diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.h
deleted file mode 100644
index e69de29bb2d1..000000000000
diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdarg.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stddef.h
similarity index 100%
rename from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdarg.h
rename to clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stddef.h
diff --git a/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdlib.h b/clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stdint.h
similarity index 100%
rename from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/cstdlib.h
rename to clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/stdint.h
diff --git a/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp b/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
index e3a9376a8638..a74b94b604ac 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp
@@ -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.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp b/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
index f73cbbfc816d..1d1e8a4e6706 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.cpp
@@ -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.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp b/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp
index bee7ec73438c..e1cd5888e02a 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp
@@ -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".
More information about the cfe-commits
mailing list