summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/file-RPATH/Common.cmake64
-rw-r--r--Tests/RunCMake/file-RPATH/ELF.cmake9
-rwxr-xr-xTests/RunCMake/file-RPATH/ELF/elf32lsb.binbin0 -> 2824 bytes
-rwxr-xr-xTests/RunCMake/file-RPATH/ELF/elf32msb.binbin0 -> 17984 bytes
-rwxr-xr-xTests/RunCMake/file-RPATH/ELF/elf64lsb.binbin0 -> 4320 bytes
-rwxr-xr-xTests/RunCMake/file-RPATH/ELF/elf64msb.binbin0 -> 18704 bytes
-rw-r--r--Tests/RunCMake/file-RPATH/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/file-RPATH/XCOFF.cmake7
-rw-r--r--Tests/RunCMake/file-RPATH/XCOFF/xcoff32.binbin0 -> 1706 bytes
-rw-r--r--Tests/RunCMake/file-RPATH/XCOFF/xcoff64.binbin0 -> 2291 bytes
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake2
13 files changed, 100 insertions, 4 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index f58e2f3..549d8eb 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -358,6 +358,9 @@ add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_fixtures)
add_RunCMake_test(file)
add_RunCMake_test(file-CHMOD)
+if(HAVE_ELF_H OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DHAVE_ELF_H=${HAVE_ELF_H})
+endif()
add_RunCMake_test(find_file)
add_RunCMake_test(find_library -DCYGWIN=${CYGWIN})
add_RunCMake_test(find_package)
diff --git a/Tests/RunCMake/file-RPATH/Common.cmake b/Tests/RunCMake/file-RPATH/Common.cmake
new file mode 100644
index 0000000..cc1efb5
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/Common.cmake
@@ -0,0 +1,64 @@
+# Prepare binaries on which to operate.
+set(in "${CMAKE_CURRENT_LIST_DIR}/${format}")
+set(out "${CMAKE_CURRENT_BINARY_DIR}")
+foreach(f ${names})
+ file(COPY ${in}/${f} DESTINATION ${out} NO_SOURCE_PERMISSIONS)
+ list(APPEND files "${out}/${f}")
+endforeach()
+
+foreach(f ${files})
+ # Check for the initial RPATH.
+ file(RPATH_CHECK FILE "${f}" RPATH "/sample/rpath")
+ if(NOT EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK removed ${f}")
+ endif()
+
+ # Change the RPATH.
+ file(RPATH_CHANGE FILE "${f}"
+ OLD_RPATH "/sample/rpath"
+ NEW_RPATH "/path1:/path2")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/path1:/path2" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not changed in ${f}")
+ endif()
+
+ # Change the RPATH without compiler defined rpath removed
+ file(RPATH_CHANGE FILE "${f}"
+ OLD_RPATH "/path2"
+ NEW_RPATH "/path3")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/path1:/path3" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not updated in ${f}")
+ endif()
+
+ # Change the RPATH with compiler defined rpath removed
+ file(RPATH_CHANGE FILE "${f}"
+ OLD_RPATH "/path3"
+ NEW_RPATH "/rpath/sample"
+ INSTALL_REMOVE_ENVIRONMENT_RPATH)
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not updated in ${f}")
+ endif()
+ file(STRINGS "${f}" rpath REGEX "/path1" LIMIT_COUNT 1)
+ if(rpath)
+ message(FATAL_ERROR "RPATH not removed in ${f}")
+ endif()
+
+ # Remove the RPATH.
+ file(RPATH_REMOVE FILE "${f}")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ if(rpath)
+ message(FATAL_ERROR "RPATH not removed from ${f}")
+ endif()
+
+ # Check again...this should remove the file.
+ file(RPATH_CHECK FILE "${f}" RPATH "/sample/rpath")
+ if(EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK did not remove ${f}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/file-RPATH/ELF.cmake b/Tests/RunCMake/file-RPATH/ELF.cmake
new file mode 100644
index 0000000..558b2e2
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/ELF.cmake
@@ -0,0 +1,9 @@
+set(names
+ elf32lsb.bin
+ elf32msb.bin
+ elf64lsb.bin
+ elf64msb.bin
+ )
+set(format ELF)
+
+include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
diff --git a/Tests/RunCMake/file-RPATH/ELF/elf32lsb.bin b/Tests/RunCMake/file-RPATH/ELF/elf32lsb.bin
new file mode 100755
index 0000000..803ac43
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/ELF/elf32lsb.bin
Binary files differ
diff --git a/Tests/RunCMake/file-RPATH/ELF/elf32msb.bin b/Tests/RunCMake/file-RPATH/ELF/elf32msb.bin
new file mode 100755
index 0000000..d04aaf7
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/ELF/elf32msb.bin
Binary files differ
diff --git a/Tests/RunCMake/file-RPATH/ELF/elf64lsb.bin b/Tests/RunCMake/file-RPATH/ELF/elf64lsb.bin
new file mode 100755
index 0000000..a21e3ea
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/ELF/elf64lsb.bin
Binary files differ
diff --git a/Tests/RunCMake/file-RPATH/ELF/elf64msb.bin b/Tests/RunCMake/file-RPATH/ELF/elf64msb.bin
new file mode 100755
index 0000000..bbe2551
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/ELF/elf64msb.bin
Binary files differ
diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
new file mode 100644
index 0000000..eb7b497
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+if(HAVE_ELF_H)
+ run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake)
+endif()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ run_cmake_command(XCOFF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/XCOFF.cmake)
+endif()
diff --git a/Tests/RunCMake/file-RPATH/XCOFF.cmake b/Tests/RunCMake/file-RPATH/XCOFF.cmake
new file mode 100644
index 0000000..b570920
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/XCOFF.cmake
@@ -0,0 +1,7 @@
+set(names
+ xcoff32.bin
+ xcoff64.bin
+ )
+set(format XCOFF)
+
+include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
diff --git a/Tests/RunCMake/file-RPATH/XCOFF/xcoff32.bin b/Tests/RunCMake/file-RPATH/XCOFF/xcoff32.bin
new file mode 100644
index 0000000..2d8d961
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/XCOFF/xcoff32.bin
Binary files differ
diff --git a/Tests/RunCMake/file-RPATH/XCOFF/xcoff64.bin b/Tests/RunCMake/file-RPATH/XCOFF/xcoff64.bin
new file mode 100644
index 0000000..bb5f5a7
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/XCOFF/xcoff64.bin
Binary files differ
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index b067b3a..efd03df 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -48,14 +48,16 @@ in directory:
endif()
endfunction()
-# Wrapper for run_cmake() that skips platforms that are non-ELF or have no RPATH support
-function(run_cmake_ELFRPATH_only case)
- if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+# Wrapper for run_cmake() that skips platforms on which we do not support editing the RPATH.
+function(run_cmake_EDIT_RPATH_only case)
+ if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT MATCHES "^(ELF|XCOFF)$")
run_cmake(${case})
else()
# Sanity check against a platform known to be ELF-based
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "Expected platform Linux to advertize itself as ELF-based, but it did not.")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ message(FATAL_ERROR "Expected platform AIX to advertize itself as XCOFF-based, but it did not.")
else()
message(STATUS "${case} - SKIPPED (No ELF-based platform found)")
endif()
@@ -63,7 +65,7 @@ function(run_cmake_ELFRPATH_only case)
endfunction()
run_cmake(TARGETS-FILE_RPATH_CHANGE-old_rpath)
-run_cmake_ELFRPATH_only(TARGETS-FILE_RPATH_CHANGE-new_rpath)
+run_cmake_EDIT_RPATH_only(TARGETS-FILE_RPATH_CHANGE-new_rpath)
run_cmake(DIRECTORY-MESSAGE_NEVER)
run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER)
run_cmake(DIRECTORY-message)
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake
index 673fdde..6b2faa3 100644
--- a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake
@@ -22,6 +22,8 @@ macro(skip_without_rpath_change_rule)
# Sanity check against a platform known to generate a file(RPATH_CHANGE) rule
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform Linux.")
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform AIX.")
else()
message(STATUS "${test} - All checks skipped. No file(RPATH_CHANGE) rule found on this platform.")
return()