summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-05-12 14:49:03 (GMT)
committerBrad King <brad.king@kitware.com>2023-05-16 14:47:56 (GMT)
commitb480315e0c229454c335290b19cc689930d7849f (patch)
treefd6c95e7d53d4a9c095947ba7cd718e0ce1ae60f /Tests
parent993dde925f208d98c68edcd451b0d6979e0abdd4 (diff)
downloadCMake-b480315e0c229454c335290b19cc689930d7849f.zip
CMake-b480315e0c229454c335290b19cc689930d7849f.tar.gz
CMake-b480315e0c229454c335290b19cc689930d7849f.tar.bz2
TargetGenerator: Add SKIP_LINTING source property
The `SKIP_LINTING` source property was added to disable code check for desired source files. The `SKIP_LINTING`includes `cpplint`, `clang-tidy`, \ `cppcheck` and `include-what-you-use`. If `SKIP_LINTING` is set on a source file, the tools mentioned above will not be run on that source file.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake3
-rw-r--r--Tests/RunCMake/MultiLint/CMakeLists copy.txt3
-rw-r--r--Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake3
-rw-r--r--Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt1
-rw-r--r--Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake7
-rw-r--r--Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake7
-rw-r--r--Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt1
-rw-r--r--Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake7
-rw-r--r--Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake7
-rw-r--r--Tests/RunCMake/MultiLint/RunCMakeTest.cmake19
10 files changed, 58 insertions, 0 deletions
diff --git a/Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake
new file mode 100644
index 0000000..d0d9866
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(C_skip_linting_ON.cmake)
diff --git a/Tests/RunCMake/MultiLint/CMakeLists copy.txt b/Tests/RunCMake/MultiLint/CMakeLists copy.txt
new file mode 100644
index 0000000..93ee9df
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/CMakeLists copy.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.5)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake
new file mode 100644
index 0000000..6347e60
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake
@@ -0,0 +1,3 @@
+set(CTEST_USE_LAUNCHERS 1)
+include(CTestUseLaunchers)
+include(CXX_skip_linting_ON.cmake)
diff --git a/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt
new file mode 100644
index 0000000..3beecb0
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt
@@ -0,0 +1 @@
+(1|2)
diff --git a/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake
new file mode 100644
index 0000000..a0311a6
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake
@@ -0,0 +1,7 @@
+enable_language(CXX)
+set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<1:${PSEUDO_IWYU}>" -some -args)
+set(CMAKE_CXX_CLANG_TIDY "$<1:${PSEUDO_TIDY}>" -bad)
+set(CMAKE_CXX_CPPLINT "$<1:${PSEUDO_CPPLINT}>" --error)
+set(CMAKE_CXX_CPPCHECK "$<1:${PSEUDO_CPPCHECK}>" -error)
+add_executable(main main.cxx)
+set_source_files_properties(main.cxx PROPERTIES SKIP_LINTING OFF)
diff --git a/Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake
new file mode 100644
index 0000000..39cfe87
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake
@@ -0,0 +1,7 @@
+enable_language(CXX)
+set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<1:${PSEUDO_IWYU}>" -some -args)
+set(CMAKE_CXX_CLANG_TIDY "$<1:${PSEUDO_TIDY}>" -bad)
+set(CMAKE_CXX_CPPLINT "$<1:${PSEUDO_CPPLINT}>" --error)
+set(CMAKE_CXX_CPPCHECK "$<1:${PSEUDO_CPPCHECK}>" -error)
+add_executable(main main.cxx)
+set_source_files_properties(main.cxx PROPERTIES SKIP_LINTING ON)
diff --git a/Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt b/Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt
new file mode 100644
index 0000000..3beecb0
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt
@@ -0,0 +1 @@
+(1|2)
diff --git a/Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake b/Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake
new file mode 100644
index 0000000..2968a21
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args)
+set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad)
+set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --error)
+set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -error)
+add_executable(main main.c)
+set_source_files_properties(main.c PROPERTIES SKIP_LINTING OFF)
diff --git a/Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake
new file mode 100644
index 0000000..09fc761
--- /dev/null
+++ b/Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args)
+set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad)
+set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --error)
+set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -error)
+add_executable(main main.c)
+set_source_files_properties(main.c PROPERTIES SKIP_LINTING ON)
diff --git a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake
index afd98fd..9b7a6a9 100644
--- a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake
+++ b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake
@@ -25,3 +25,22 @@ if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
run_multilint(C-launch)
run_multilint(CXX-launch)
endif()
+
+function(run_skip_linting test_name)
+ set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${test_name}-build")
+ set(RunCMake_TEST_NO_CLEAN 1)
+
+ run_cmake(${test_name})
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(${test_name}-Build ${CMAKE_COMMAND} --build .)
+endfunction()
+
+run_skip_linting(C_skip_linting_ON)
+run_skip_linting(CXX_skip_linting_ON)
+run_skip_linting(C_skip_linting_OFF)
+run_skip_linting(CXX_skip_linting_OFF)
+
+if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
+ run_skip_linting(C-launch_skip_linting_ON)
+ run_skip_linting(CXX-launch_skip_linting_ON)
+endif()