PaulkaToast created this revision. PaulkaToast added reviewers: RKSimon, aaron.ballman. PaulkaToast added a project: clang-tools-extra. Herald added subscribers: cfe-commits, xazax.hun. Herald added a project: clang.
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. (: Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D76015 Files: 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/float.h clang-tools-extra/test/clang-tidy/checkers/Inputs/portability-restrict-system-includes/system/j.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 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 Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp +++ 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". Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.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-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. Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp +++ 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.
Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-glob.cpp +++ 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". Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-disallow.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-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. Index: clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/portability-restrict-system-includes-allow.cpp +++ 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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits