summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-25 13:41:18 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-01-25 13:41:18 (GMT)
commit4f37987e3fd72b957d45e741e6ee70ccf42b167d (patch)
treec8310c3aea7cea7e819e012679b845db55faa5ac /Tests/RunCMake
parent9006ec1d9b7d738f690c32d673443b8851887f16 (diff)
parent0618ddf6b1da3a886f12b6ad2b19da49b2f87e28 (diff)
downloadCMake-4f37987e3fd72b957d45e741e6ee70ccf42b167d.zip
CMake-4f37987e3fd72b957d45e741e6ee70ccf42b167d.tar.gz
CMake-4f37987e3fd72b957d45e741e6ee70ccf42b167d.tar.bz2
Merge topic 'lang_lint'
0618ddf6 Add properties to run the cpplint style checker with the compiler
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt2
-rw-r--r--Tests/RunCMake/Cpplint/C-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/C-error-Build-result.txt1
-rw-r--r--Tests/RunCMake/Cpplint/C-error-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt1
-rw-r--r--Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/C-error-launch.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/C-error.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/C-launch.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/C.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Cpplint/CXX-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/CXX-error-Build-result.txt1
-rw-r--r--Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt1
-rw-r--r--Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/CXX-error-launch.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/CXX-error.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt1
-rw-r--r--Tests/RunCMake/Cpplint/CXX-launch.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/CXX.cmake3
-rw-r--r--Tests/RunCMake/Cpplint/RunCMakeTest.cmake26
-rw-r--r--Tests/RunCMake/Cpplint/main.c4
-rw-r--r--Tests/RunCMake/Cpplint/main.cxx4
-rw-r--r--Tests/RunCMake/pseudo_cpplint.c21
27 files changed, 97 insertions, 1 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index a43e47b..7e16d0e 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -340,8 +340,10 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
endif()
add_executable(pseudo_tidy pseudo_tidy.c)
add_executable(pseudo_iwyu pseudo_iwyu.c)
+ add_executable(pseudo_cpplint pseudo_cpplint.c)
add_RunCMake_test(ClangTidy -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>)
add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>)
+ add_RunCMake_test(Cpplint -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint>)
add_RunCMake_test(CompilerLauncher)
endif()
diff --git a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt b/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt
index 0d0d899..35f50b7 100644
--- a/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt
+++ b/Tests/RunCMake/CommandLine/E___run_iwyu-no-iwyu-stderr.txt
@@ -1 +1 @@
-^__run_iwyu missing --tidy= or --iwyu=$
+^__run_iwyu missing --cpplint=, --iwyu=, --lwyu=, and/or --tidy=$
diff --git a/Tests/RunCMake/Cpplint/C-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-Build-stdout.txt
new file mode 100644
index 0000000..6a22b79
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-Build-stdout.txt
@@ -0,0 +1 @@
+Total errors found: 0
diff --git a/Tests/RunCMake/Cpplint/C-error-Build-result.txt b/Tests/RunCMake/Cpplint/C-error-Build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-error-Build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/Cpplint/C-error-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-error-Build-stdout.txt
new file mode 100644
index 0000000..3e7a1e9
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-error-Build-stdout.txt
@@ -0,0 +1 @@
+Tests[/\]RunCMake[/\]Cpplint[/\]main\.c:0: message \[category/category\] \[0\]
diff --git a/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt b/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-error-launch-Build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt
new file mode 100644
index 0000000..3e7a1e9
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-error-launch-Build-stdout.txt
@@ -0,0 +1 @@
+Tests[/\]RunCMake[/\]Cpplint[/\]main\.c:0: message \[category/category\] \[0\]
diff --git a/Tests/RunCMake/Cpplint/C-error-launch.cmake b/Tests/RunCMake/Cpplint/C-error-launch.cmake
new file mode 100644
index 0000000..c76e2e2
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-error-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(C-error.cmake)
diff --git a/Tests/RunCMake/Cpplint/C-error.cmake b/Tests/RunCMake/Cpplint/C-error.cmake
new file mode 100644
index 0000000..29cf7ba
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-error.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --error)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt
new file mode 100644
index 0000000..6a22b79
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-launch-Build-stdout.txt
@@ -0,0 +1 @@
+Total errors found: 0
diff --git a/Tests/RunCMake/Cpplint/C-launch.cmake b/Tests/RunCMake/Cpplint/C-launch.cmake
new file mode 100644
index 0000000..e66ca20
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(C.cmake)
diff --git a/Tests/RunCMake/Cpplint/C.cmake b/Tests/RunCMake/Cpplint/C.cmake
new file mode 100644
index 0000000..68e6ff4
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/C.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/Cpplint/CMakeLists.txt b/Tests/RunCMake/Cpplint/CMakeLists.txt
new file mode 100644
index 0000000..a640c56
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.7)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Cpplint/CXX-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-Build-stdout.txt
new file mode 100644
index 0000000..6a22b79
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-Build-stdout.txt
@@ -0,0 +1 @@
+Total errors found: 0
diff --git a/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt b/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-error-Build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt
new file mode 100644
index 0000000..028cd37
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-error-Build-stdout.txt
@@ -0,0 +1 @@
+Tests[/\]RunCMake[/\]Cpplint[/\]main\.cxx:0: message \[category\/category\] \[0\]
diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt
new file mode 100644
index 0000000..028cd37
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-error-launch-Build-stdout.txt
@@ -0,0 +1 @@
+Tests[/\]RunCMake[/\]Cpplint[/\]main\.cxx:0: message \[category\/category\] \[0\]
diff --git a/Tests/RunCMake/Cpplint/CXX-error-launch.cmake b/Tests/RunCMake/Cpplint/CXX-error-launch.cmake
new file mode 100644
index 0000000..72dcbe9
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-error-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(CXX-error.cmake)
diff --git a/Tests/RunCMake/Cpplint/CXX-error.cmake b/Tests/RunCMake/Cpplint/CXX-error.cmake
new file mode 100644
index 0000000..ad66ff5
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-error.cmake
@@ -0,0 +1,3 @@
+enable_language(CXX)
+set(CMAKE_CXX_CPPLINT "${PSEUDO_CPPLINT}" --error)
+add_executable(main main.cxx)
diff --git a/Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt b/Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt
new file mode 100644
index 0000000..6a22b79
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-launch-Build-stdout.txt
@@ -0,0 +1 @@
+Total errors found: 0
diff --git a/Tests/RunCMake/Cpplint/CXX-launch.cmake b/Tests/RunCMake/Cpplint/CXX-launch.cmake
new file mode 100644
index 0000000..3002c9d
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX-launch.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(CXX.cmake)
diff --git a/Tests/RunCMake/Cpplint/CXX.cmake b/Tests/RunCMake/Cpplint/CXX.cmake
new file mode 100644
index 0000000..35f05ee
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/CXX.cmake
@@ -0,0 +1,3 @@
+enable_language(CXX)
+set(CMAKE_CXX_CPPLINT "${PSEUDO_CPPLINT}" --verbose=0 --linelength=80)
+add_executable(main main.cxx)
diff --git a/Tests/RunCMake/Cpplint/RunCMakeTest.cmake b/Tests/RunCMake/Cpplint/RunCMakeTest.cmake
new file mode 100644
index 0000000..5a8471e
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/RunCMakeTest.cmake
@@ -0,0 +1,26 @@
+include(RunCMake)
+
+set(RunCMake_TEST_OPTIONS "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}")
+
+function(run_cpplint lang)
+ # Use a single build tree for tests without cleaning.
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${lang}-build")
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(${lang})
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+run_cpplint(C)
+run_cpplint(CXX)
+run_cpplint(C-error)
+run_cpplint(CXX-error)
+
+if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
+ run_cpplint(C-launch)
+ run_cpplint(CXX-launch)
+ run_cpplint(C-error-launch)
+ run_cpplint(CXX-error-launch)
+endif()
diff --git a/Tests/RunCMake/Cpplint/main.c b/Tests/RunCMake/Cpplint/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/Cpplint/main.cxx b/Tests/RunCMake/Cpplint/main.cxx
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/Cpplint/main.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/pseudo_cpplint.c b/Tests/RunCMake/pseudo_cpplint.c
new file mode 100644
index 0000000..8b9ebf4
--- /dev/null
+++ b/Tests/RunCMake/pseudo_cpplint.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char* argv[])
+{
+ int error = 0;
+ int i;
+ for (i = 1; i < argc; ++i) {
+ if (strcmp(argv[i], "--error") == 0) {
+ error = 1;
+ }
+ if (argv[i][0] != '-') {
+ if (error) {
+ fprintf(stderr, "%s:0: message [category/category] [0]\n", argv[i]);
+ }
+ fprintf(stdout, "Done processing %s\nTotal errors found: %i\n", argv[i],
+ error);
+ }
+ }
+ return error;
+}