diff --git a/CMakeLists.txt b/CMakeLists.txt index 09b01eb862..9f72641e03 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -577,76 +577,86 @@ if(NOT TARGET uninstall) COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) endif() -add_test(test01 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME bootSyscall COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test01 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref01.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test02 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME bootSyscallC COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test02 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref02.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test03 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME printf COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test03 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref03.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test04 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME args COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test04 -D TEST_ARGS2=yeah -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref04.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test05 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME maths1 COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test05 -D TEST_ARGS2=7 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref05.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test06 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME threadsStart COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test06 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref06.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test07 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME trig COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test07 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref07.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test08 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME pi COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test08 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref08.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test09 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME fork COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test09 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref09.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test10 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME cppThreads COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test10 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref10.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test11 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME tlsData COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test11 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref11.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test12 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME fpu COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test12 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref12.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test13 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME contexts COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test13 -D TEST_OUTPUT=tmpfile.txt -D TEST_REFERENCE=${CMAKE_SOURCE_DIR}/tests/ref13.txt -P ${CMAKE_SOURCE_DIR}/runTest.cmake ) -add_test(test14 ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} +add_test(NAME conditionalThreads COMMAND ${CMAKE_COMMAND} -D TEST_PROGRAM=${CMAKE_BINARY_DIR}/${BOX86} -D TEST_ARGS=${CMAKE_SOURCE_DIR}/tests/test14 -D TEST_OUTPUT=tmpfile.txt -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 ) + file(GLOB extension_tests "${CMAKE_SOURCE_DIR}/tests/extensions/*.c") foreach(file ${extension_tests}) get_filename_component(testname "${file}" NAME_WE) diff --git a/tests/ref15.txt b/tests/ref15.txt new file mode 100644 index 0000000000..52326af632 --- /dev/null +++ b/tests/ref15.txt @@ -0,0 +1 @@ +2, 2/2 diff --git a/tests/ref16.txt b/tests/ref16.txt new file mode 100644 index 0000000000..52326af632 --- /dev/null +++ b/tests/ref16.txt @@ -0,0 +1 @@ +2, 2/2 diff --git a/tests/test15 b/tests/test15 new file mode 100755 index 0000000000..b54028ac1c Binary files /dev/null and b/tests/test15 differ diff --git a/tests/test15.c b/tests/test15.c new file mode 100644 index 0000000000..0788c0401d --- /dev/null +++ b/tests/test15.c @@ -0,0 +1,32 @@ +/* + * 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 + */ + +#if defined(MAIN) +int returnVersion(); +int acquireVersion1(); +int acquireVersion2(); +#include + +int main(int argc, char **argv) { printf("%d, %d/%d\n", returnVersion(), acquireVersion1(), acquireVersion2()); return 0; } + +#elif defined(V2) +int __attribute__((noinline)) getVersion() { asm(""); return 2; } +int returnVersion() { return getVersion(); } + +#elif defined(V1) +int __attribute__((noinline)) getVersion() { asm(""); return 1; } +int acquireVersion() { return getVersion(); } + +#else +int getVersion(); +int acquireVersion(); + +int acquireVersion1() { return getVersion(); } +int acquireVersion2() { return acquireVersion(); } + +#endif diff --git a/tests/test15_dv1.so b/tests/test15_dv1.so new file mode 100755 index 0000000000..4f252d4af2 Binary files /dev/null and b/tests/test15_dv1.so differ diff --git a/tests/test15_v1.so b/tests/test15_v1.so new file mode 100755 index 0000000000..74a2d6cfd4 Binary files /dev/null and b/tests/test15_v1.so differ diff --git a/tests/test15_v2.so b/tests/test15_v2.so new file mode 100755 index 0000000000..b42d6d8725 Binary files /dev/null and b/tests/test15_v2.so differ diff --git a/tests/test15_version.map b/tests/test15_version.map new file mode 100644 index 0000000000..8232d455dd --- /dev/null +++ b/tests/test15_version.map @@ -0,0 +1,8 @@ +LIBV2 { + global: + getVersion; + returnVersion; + + local: + *; +}; diff --git a/tests/test16 b/tests/test16 new file mode 100755 index 0000000000..154b000339 Binary files /dev/null and b/tests/test16 differ diff --git a/tests/test16.c b/tests/test16.c new file mode 100644 index 0000000000..59b255c30c --- /dev/null +++ b/tests/test16.c @@ -0,0 +1,32 @@ +/* + * 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 + */ + +#if defined(MAIN) +int returnVersion(); +int acquireVersion1(); +int acquireVersion2(); +#include + +int main(int argc, char **argv) { printf("%d, %d/%d\n", returnVersion(), acquireVersion1(), acquireVersion2()); return 0; } + +#elif defined(V1) +int __attribute__((noinline)) getVersion() { asm(""); return 1; } +int acquireVersion() { return getVersion(); } + +#elif defined(V2) +int __attribute__((noinline)) getVersion() { asm(""); return 2; } +int returnVersion() { return getVersion(); } + +#else +int getVersion(); +int returnVersion(); + +int acquireVersion1() { return getVersion(); } +int acquireVersion2() { return returnVersion(); } + +#endif diff --git a/tests/test16_dv1.so b/tests/test16_dv1.so new file mode 100755 index 0000000000..c89bc2e767 Binary files /dev/null and b/tests/test16_dv1.so differ diff --git a/tests/test16_v1.so b/tests/test16_v1.so new file mode 100755 index 0000000000..2903f1cee4 Binary files /dev/null and b/tests/test16_v1.so differ diff --git a/tests/test16_v2.so b/tests/test16_v2.so new file mode 100755 index 0000000000..4bc1def790 Binary files /dev/null and b/tests/test16_v2.so differ diff --git a/tests/test16_version.map b/tests/test16_version.map new file mode 100644 index 0000000000..1ed5900320 --- /dev/null +++ b/tests/test16_version.map @@ -0,0 +1,8 @@ +LIBV1 { + global: + getVersion; + acquireVersion; + + local: + *; +};