Skip to content

Commit

Permalink
Merge pull request #388 from rajdakin/master
Browse files Browse the repository at this point in the history
Fixed rpaths for tests 15 and 16
  • Loading branch information
ptitSeb authored May 23, 2021
2 parents 979ce28 + d9f953e commit 68f01f4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -647,15 +647,16 @@ add_test(NAME conditionalThreads COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAK
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref14.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )

add_test(NAME linkingIndirectNoversion COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test15 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref15.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )

add_test(NAME linkingIndirectVersion COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
-D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test16 -D TEST_OUTPUT=tmpfile.txt
-D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref16.txt
-P ${CMAKE_SOURCE_DIR}/runTest.cmake )
# WIP
#add_test(NAME linkingIndirectNoversion COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test15 -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref15.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )
#
#add_test(NAME linkingIndirectVersion COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86}
# -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test16 -D TEST_OUTPUT=tmpfile.txt
# -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref16.txt
# -P ${CMAKE_SOURCE_DIR}/runTest.cmake )

file(GLOB extension_tests "${CMAKE_SOURCE_DIR}/tests/extensions/*.c")
foreach(file ${extension_tests})
Expand Down
8 changes: 7 additions & 1 deletion runTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@ execute_process(

# if the return value is !=0 bail out
if( TEST_RESULT )
get_filename_component(TESTNAME "${TEST_ARGS}" NAME)
file(RENAME "${TEST_OUTPUT}" "${CMAKE_BINARY_DIR}/${TESTNAME}.out")
file(WRITE "${CMAKE_BINARY_DIR}/${TESTNAME}.err" ${TEST_ERROR})
message( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}" )
endif( TEST_RESULT )

# now compare the output with the reference
execute_process(
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT} ${TEST_REFERENCE}
COMMAND "${CMAKE_COMMAND}" -E compare_files "${TEST_OUTPUT}" "${TEST_REFERENCE}"
RESULT_VARIABLE TEST_RESULT
)

# again, if return value is !=0 scream and shout
if( TEST_RESULT )
get_filename_component(TESTNAME "${TEST_ARGS}" NAME)
file(RENAME "${TEST_OUTPUT}" "${CMAKE_BINARY_DIR}/${TESTNAME}.out")
file(WRITE "${CMAKE_BINARY_DIR}/${TESTNAME}.err" ${TEST_ERROR})
message( FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not match ${TEST_REFERENCE}")
endif( TEST_RESULT )

Expand Down
Binary file modified tests/test15
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/test15.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Compile with (on x86_64 archs):
* gcc -m32 -DV1 -shared -o test15_v1.so test15.c
* gcc -m32 -DV2 -shared -o test15_v2.so test15.c -Wl,--version-script=test15_version.map
* gcc -m32 -shared -o test15_dv1.so test15.c -L. -Wl,-rpath=. -l:test15_v1.so
* gcc -m32 -DMAIN -o test15 test15.c -L. -Wl,-rpath=. -l:test15_dv1.so -l:test15_v2.so
* gcc -m32 -shared -o test15_dv1.so test15.c -L. -Wl,-z,origin,-rpath='$ORIGIN' -l:test15_v1.so
* gcc -m32 -DMAIN -o test15 test15.c -L. -Wl,-z,origin,-rpath='$ORIGIN' -l:test15_dv1.so -l:test15_v2.so
*/

#if defined(MAIN)
Expand Down
Binary file modified tests/test15_dv1.so
Binary file not shown.
Binary file modified tests/test16
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/test16.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Compile with (on x86_64 archs):
* gcc -m32 -DV1 -shared -o test16_v1.so test16.c -Wl,--version-script=test16_version.map
* gcc -m32 -DV2 -shared -o test16_v2.so test16.c
* gcc -m32 -shared -o test16_dv1.so test16.c -L. -Wl,-rpath=. -l:test16_v1.so
* gcc -m32 -DMAIN -o test16 test16.c -L. -Wl,-rpath=. -l:test16_dv1.so -l:test16_v2.so
* gcc -m32 -shared -o test16_dv1.so test16.c -L. -Wl,-z,origin,-rpath='$ORIGIN' -l:test16_v1.so
* gcc -m32 -DMAIN -o test16 test16.c -L. -Wl,-z,origin,-rpath='$ORIGIN' -l:test16_dv1.so -l:test16_v2.so
*/

#if defined(MAIN)
Expand Down
Binary file modified tests/test16_dv1.so
Binary file not shown.

0 comments on commit 68f01f4

Please sign in to comment.