summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/TransformDepfile
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-02 18:25:30 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-13 14:18:02 (GMT)
commitb2c14bc7749c21b8a994ce1d9f4e736f712481b9 (patch)
treef57dd0db191b09e773e0de91072d72a053ec639c /Tests/RunCMake/TransformDepfile
parent946adadd404a160b708e96e668be9b84c949de69 (diff)
downloadCMake-b2c14bc7749c21b8a994ce1d9f4e736f712481b9.zip
CMake-b2c14bc7749c21b8a994ce1d9f4e736f712481b9.tar.gz
CMake-b2c14bc7749c21b8a994ce1d9f4e736f712481b9.tar.bz2
cmake -E: Add cmake_transform_depfile internal command
Diffstat (limited to 'Tests/RunCMake/TransformDepfile')
-rw-r--r--Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-unix.d6
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-unix.d.txt8
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt6
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-windows.d6
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-windows.d.txt8
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt6
-rw-r--r--Tests/RunCMake/TransformDepfile/empty.d0
-rw-r--r--Tests/RunCMake/TransformDepfile/empty.d.txt0
-rw-r--r--Tests/RunCMake/TransformDepfile/empty.tlog.txt0
-rw-r--r--Tests/RunCMake/TransformDepfile/gccdepfile.cmake16
-rw-r--r--Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt1
-rw-r--r--Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt1
-rw-r--r--Tests/RunCMake/TransformDepfile/invalid.d1
-rw-r--r--Tests/RunCMake/TransformDepfile/noexist.d.txt0
-rw-r--r--Tests/RunCMake/TransformDepfile/noexist.tlog.txt0
-rw-r--r--Tests/RunCMake/TransformDepfile/vstlog.cmake16
17 files changed, 96 insertions, 0 deletions
diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
new file mode 100644
index 0000000..cb75eb0
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
@@ -0,0 +1,21 @@
+include(RunCMake)
+
+function(run_transform_depfile name)
+ set(RunCMake-check-file gccdepfile.cmake)
+ run_cmake_command(${name}-gcc
+ ${CMAKE_COMMAND} -E cmake_transform_depfile gccdepfile ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.d
+ )
+ set(RunCMake-check-file vstlog.cmake)
+ run_cmake_command(${name}-tlog
+ ${CMAKE_COMMAND} -E cmake_transform_depfile vstlog ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.tlog
+ )
+endfunction()
+
+if(WIN32)
+ run_transform_depfile(deps-windows)
+else()
+ run_transform_depfile(deps-unix)
+endif()
+run_transform_depfile(noexist)
+run_transform_depfile(empty)
+run_transform_depfile(invalid)
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d b/Tests/RunCMake/TransformDepfile/deps-unix.d
new file mode 100644
index 0000000..5da5be8
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.d
@@ -0,0 +1,6 @@
+out1 /home/build/out2: in1 /home/build/in2
+
+out3 \
+ /home/build/out4: \
+ in3 \
+ /home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
new file mode 100644
index 0000000..58770f2
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
@@ -0,0 +1,8 @@
+../out1 \
+ /home/build/out2: \
+ ../in1 \
+ /home/build/in2
+../out3 \
+ /home/build/out4: \
+ ../in3 \
+ /home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
new file mode 100644
index 0000000..2a26edf
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
@@ -0,0 +1,6 @@
+^../out1|/home/build/out2
+../in1
+/home/build/in2
+^../out3|/home/build/out4
+../in3
+/home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d b/Tests/RunCMake/TransformDepfile/deps-windows.d
new file mode 100644
index 0000000..c926670
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.d
@@ -0,0 +1,6 @@
+out1 C:/build/out2: in1 C:/build/in2
+
+out3 \
+ C:/build/out4: \
+ in3 \
+ C:/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
new file mode 100644
index 0000000..47b3ebf
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
@@ -0,0 +1,8 @@
+../out1 \
+ C:/build/out2: \
+ ../in1 \
+ C:/build/in2
+../out3 \
+ C:/build/out4: \
+ ../in3 \
+ C:/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
new file mode 100644
index 0000000..1e6024d
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
@@ -0,0 +1,6 @@
+^..\out1|C:\build\out2
+..\in1
+C:\build\in2
+^..\out3|C:\build\out4
+..\in3
+C:\build\in4
diff --git a/Tests/RunCMake/TransformDepfile/empty.d b/Tests/RunCMake/TransformDepfile/empty.d
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/empty.d
diff --git a/Tests/RunCMake/TransformDepfile/empty.d.txt b/Tests/RunCMake/TransformDepfile/empty.d.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/empty.d.txt
diff --git a/Tests/RunCMake/TransformDepfile/empty.tlog.txt b/Tests/RunCMake/TransformDepfile/empty.tlog.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/empty.tlog.txt
diff --git a/Tests/RunCMake/TransformDepfile/gccdepfile.cmake b/Tests/RunCMake/TransformDepfile/gccdepfile.cmake
new file mode 100644
index 0000000..be1e210
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/gccdepfile.cmake
@@ -0,0 +1,16 @@
+if(EXISTS "${RunCMake_SOURCE_DIR}/${name}.d.txt")
+ file(READ "${RunCMake_SOURCE_DIR}/${name}.d.txt" expected_contents)
+
+ if(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.d")
+ file(READ "${RunCMake_TEST_BINARY_DIR}/out.d" actual_contents)
+ if(NOT actual_contents STREQUAL expected_contents)
+ string(REPLACE "\n" "\n " p_expected_contents "${expected_contents}")
+ string(REPLACE "\n" "\n " p_actual_contents "${actual_contents}")
+ string(APPEND RunCMake_TEST_FAILED "Expected contents of ${RunCMake_TEST_BINARY_DIR}/out.d:\n ${p_expected_contents}\nActual contents:\n ${p_actual_contents}")
+ endif()
+ else()
+ string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.d should exist\n")
+ endif()
+elseif(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.d")
+ string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.d should not exist\n")
+endif()
diff --git a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/TransformDepfile/invalid.d b/Tests/RunCMake/TransformDepfile/invalid.d
new file mode 100644
index 0000000..9977a28
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/invalid.d
@@ -0,0 +1 @@
+invalid
diff --git a/Tests/RunCMake/TransformDepfile/noexist.d.txt b/Tests/RunCMake/TransformDepfile/noexist.d.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/noexist.d.txt
diff --git a/Tests/RunCMake/TransformDepfile/noexist.tlog.txt b/Tests/RunCMake/TransformDepfile/noexist.tlog.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/noexist.tlog.txt
diff --git a/Tests/RunCMake/TransformDepfile/vstlog.cmake b/Tests/RunCMake/TransformDepfile/vstlog.cmake
new file mode 100644
index 0000000..afa78d0
--- /dev/null
+++ b/Tests/RunCMake/TransformDepfile/vstlog.cmake
@@ -0,0 +1,16 @@
+if(EXISTS "${RunCMake_SOURCE_DIR}/${name}.tlog.txt")
+ file(READ "${RunCMake_SOURCE_DIR}/${name}.tlog.txt" expected_contents)
+
+ if(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.tlog")
+ file(READ "${RunCMake_TEST_BINARY_DIR}/out.tlog" actual_contents)
+ if(NOT actual_contents STREQUAL expected_contents)
+ string(REPLACE "\n" "\n " p_expected_contents "${expected_contents}")
+ string(REPLACE "\n" "\n " p_actual_contents "${actual_contents}")
+ string(APPEND RunCMake_TEST_FAILED "Expected contents of ${RunCMake_TEST_BINARY_DIR}/out.tlog:\n ${p_expected_contents}\nActual contents:\n ${p_actual_contents}")
+ endif()
+ else()
+ string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.tlog should exist\n")
+ endif()
+elseif(EXISTS "${RunCMake_TEST_BINARY_DIR}/out.tlog")
+ string(APPEND RunCMake_TEST_FAILED "${RunCMake_TEST_BINARY_DIR}/out.tlog should not exist\n")
+endif()