From: Paula Toth Date: Wed, 11 Mar 2020 19:12:35 +0000 (-0700) Subject: [clang-tidy] Mock system headers for portability-restrict-system-includes tests. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1736f7a2a660944c24aac45e24cdf1ea6c6effa;p=platform%2Fupstream%2Fllvm.git [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 --- 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 index e69de29..0000000 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/float.h similarity index 100% rename from clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.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/cstdlib.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/cstdlib.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/cstdarg.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/cstdarg.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 e3a9376..a74b94b 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 f73cbbf..1d1e8a4 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 bee7ec7..e1cd588 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".