summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/ClangTidy
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-11-17 11:36:04 -0500
committerBrad King <brad.king@kitware.com>2016-11-18 09:43:22 -0500
commit80ebc55a7ce934ee357c30713bcb96b209e97963 (patch)
treed57f5b3f499669d4d0290a09e7f4a535e7933a9c /Tests/RunCMake/ClangTidy
parentce1abfa4149ae0b3920626bef2dd15e8ee8b1940 (diff)
downloadcmake-80ebc55a7ce934ee357c30713bcb96b209e97963.tar.gz
cmake: Report if the <LANG>_CLANG_TIDY tool exits with non-zero
When using `<LANG>_CLANG_TIDY` our internal launcher for the tool must capture its return code and stderr and report them on failure. Otherwise incorrect command lines silently fail. Closes: #16435
Diffstat (limited to 'Tests/RunCMake/ClangTidy')
-rw-r--r--Tests/RunCMake/ClangTidy/C-bad-Build-result.txt1
-rw-r--r--Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt2
-rw-r--r--Tests/RunCMake/ClangTidy/C-bad.cmake3
-rw-r--r--Tests/RunCMake/ClangTidy/RunCMakeTest.cmake1
4 files changed, 7 insertions, 0 deletions
diff --git a/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt b/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt
new file mode 100644
index 0000000000..d197c913c2
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt b/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt
new file mode 100644
index 0000000000..2370ce1c13
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt
@@ -0,0 +1,2 @@
+stdout from bad command line arg '-bad'
+stderr from bad command line arg '-bad'
diff --git a/Tests/RunCMake/ClangTidy/C-bad.cmake b/Tests/RunCMake/ClangTidy/C-bad.cmake
new file mode 100644
index 0000000000..aa54c08209
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/C-bad.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
index 27cd922e0e..2f41e503ca 100644
--- a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
@@ -20,3 +20,4 @@ if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
run_tidy(C-launch)
run_tidy(CXX-launch)
endif()
+run_tidy(C-bad)