Skip to content

Commit

Permalink
Tests: Add gcc-target-tests for 32 and 64 bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanos Kornilios Mitsis Poiitidis committed Jan 25, 2021
1 parent 239c8f4 commit d0aa661
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,16 @@ jobs:
shell: bash
# Execute the gvisor tests
run: cmake --build . --config $BUILD_TYPE --target gvisor_tests

- name: gcc target tests 32
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the gvisor tests
run: cmake --build . --config $BUILD_TYPE --target gcc_target_tests_32

- name: gcc target tests 64
working-directory: ${{runner.workspace}}/build
shell: bash
# Execute the gvisor tests
run: cmake --build . --config $BUILD_TYPE --target gcc_target_tests_64

4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
shallow = true
path = External/fex-gvisor-tests-bins
url = https://github.com/FEX-Emu/fex-gvisor-tests-bins.git
[submodule "External/fex-gcc-target-tests-bins"]
shallow = true
path = External/fex-gcc-target-tests-bins
url = https://github.com/FEX-Emu/fex-gcc-target-tests-bins.git
1 change: 1 addition & 0 deletions External/fex-gcc-target-tests-bins
8 changes: 6 additions & 2 deletions Scripts/guest_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@
Process.wait()
ResultCode = Process.returncode

if (not test_name in expected_output or expected_output[test_name] != ResultCode):
if expected_output.get(test_name):
# expect zero by default
if (not test_name in expected_output):
expected_output[test_name] = 0

if (expected_output[test_name] != ResultCode):
if (test_name in expected_output):
print("test failed, expected is", expected_output[test_name], "but got", ResultCode)
else:
print("Test doesn't have expected output,", test_name)
Expand Down
2 changes: 2 additions & 0 deletions unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ add_subdirectory(32Bit_ASM/)
add_subdirectory(IR/)
add_subdirectory(POSIX/)
add_subdirectory(gvisor-tests/)
add_subdirectory(gcc-target-tests-32/)
add_subdirectory(gcc-target-tests-64/)
33 changes: 33 additions & 0 deletions unittests/gcc-target-tests-32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

# Careful. Globbing can't see changes to the contents of files
# Need to do a fresh clean to see changes
file(GLOB_RECURSE TESTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/External/fex-gcc-target-tests-bins/32/*)

foreach(TEST ${TESTS})

string(REPLACE "/fex-gcc-target-tests-bins/32/" ";" TEST_NAME_LIST ${TEST})
list(GET TEST_NAME_LIST 1 TEST_NAME)
string(REPLACE "/" "-" TEST_NAME ${TEST_NAME})

# Interpreter is too slow to run these tests, only generate for jit

add_test(NAME "${TEST_NAME}.jit.gcc-target-32"
COMMAND "python3" "${CMAKE_SOURCE_DIR}/Scripts/guest_test_runner.py"
"${CMAKE_SOURCE_DIR}/unittests/gcc-target-tests-32/Known_Failures"
"${CMAKE_SOURCE_DIR}/unittests/gcc-target-tests-32/Expected_Output"
"${CMAKE_SOURCE_DIR}/unittests/gcc-target-tests-32/Disabled_Tests"
"${TEST_NAME}"
"${CMAKE_BINARY_DIR}/Bin/FEXLoader"
"-c" "irjit" "-n" "500" "-R" $ENV{ROOTFS} "--"
"${TEST}")

endforeach()

execute_process(COMMAND "nproc" OUTPUT_VARIABLE CORES)
string(STRIP ${CORES} CORES)

add_custom_target(
gcc_target_tests_32
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
USES_TERMINAL
COMMAND "ctest" "--timeout" "20" "-j${CORES}" "-R" "\.*.gcc-target-32$$")
Empty file.
1 change: 1 addition & 0 deletions unittests/gcc-target-tests-32/Expected_Output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# default to zero
9 changes: 9 additions & 0 deletions unittests/gcc-target-tests-32/Known_Failures
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pr72867.c.gcc-target-test-32
pr88240.c.gcc-target-test-32
sse2-mmx-cvtps2pi.c.gcc-target-test-32
sse2-mmx-cvttps2pi.c.gcc-target-test-32
sse2-mmx-pextrw.c.gcc-target-test-32
sse2-mmx-psraw.c.gcc-target-test-32
sse2-mmx-psrawi.c.gcc-target-test-32
sse2-psraw-1.c.gcc-target-test-32
sse2-shiftqihi-constant-2.c.gcc-target-test-32
33 changes: 33 additions & 0 deletions unittests/gcc-target-tests-64/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

# Careful. Globbing can't see changes to the contents of files
# Need to do a fresh clean to see changes
file(GLOB_RECURSE TESTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/External/fex-gcc-target-tests-bins/64/*)

foreach(TEST ${TESTS})

string(REPLACE "/fex-gcc-target-tests-bins/64/" ";" TEST_NAME_LIST ${TEST})
list(GET TEST_NAME_LIST 1 TEST_NAME)
string(REPLACE "/" "-" TEST_NAME ${TEST_NAME})

# Interpreter is too slow to run these tests, only generate for jit

add_test(NAME "${TEST_NAME}.jit.gcc-target-64"
COMMAND "python3" "${CMAKE_SOURCE_DIR}/Scripts/guest_test_runner.py"
"${CMAKE_SOURCE_DIR}/unittests/gcc-target-tests-64/Known_Failures"
"${CMAKE_SOURCE_DIR}/unittests/gcc-target-tests-64/Expected_Output"
"${CMAKE_SOURCE_DIR}/unittests/gcc-target-tests-64/Disabled_Tests"
"${TEST_NAME}"
"${CMAKE_BINARY_DIR}/Bin/FEXLoader"
"-c" "irjit" "-n" "500" "-R" $ENV{ROOTFS} "--"
"${TEST}")

endforeach()

execute_process(COMMAND "nproc" OUTPUT_VARIABLE CORES)
string(STRIP ${CORES} CORES)

add_custom_target(
gcc_target_tests_64
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
USES_TERMINAL
COMMAND "ctest" "--timeout" "20" "-j${CORES}" "-R" "\.*.gcc-target-64$$")
Empty file.
1 change: 1 addition & 0 deletions unittests/gcc-target-tests-64/Expected_Output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# default to zero
9 changes: 9 additions & 0 deletions unittests/gcc-target-tests-64/Known_Failures
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
asm-5.c.gcc-target-test-64
pr88240.c.gcc-target-test-64
sse2-mmx-cvtps2pi.c.gcc-target-test-64
sse2-mmx-cvttps2pi.c.gcc-target-test-64
sse2-mmx-pextrw.c.gcc-target-test-64
sse2-mmx-psraw.c.gcc-target-test-64
sse2-mmx-psrawi.c.gcc-target-test-64
sse2-psraw-1.c.gcc-target-test-64
sse2-shiftqihi-constant-2.c.gcc-target-test-64

0 comments on commit d0aa661

Please sign in to comment.