diff --git a/Scripts/guest_test_runner.py b/Scripts/guest_test_runner.py index 0d615d170..5d8662b34 100644 --- a/Scripts/guest_test_runner.py +++ b/Scripts/guest_test_runner.py @@ -3,7 +3,7 @@ import os import sys # NB: This script is run with the "-S" flag, and therefore it can only use the Python standard library. -def DoesFEXSupportAVX(mode): +def DoesFEXSupportAVX(): # Check if FEX indicates support for AVX # Import this here lazily to save on startup time @@ -95,7 +95,7 @@ fexecutable = sys.argv[7] StartingFEXArgsOffset = 8 # If the test requires AVX and FEX doesn't support it, just pass the test and move on -if TestRequiresAVXSupport() and not DoesFEXSupportAVX(mode): +if mode == "guest" and TestRequiresAVXSupport() and not DoesFEXSupportAVX(): sys.exit(0) # Open test expected information files and load in to dictionaries. diff --git a/unittests/FEXMingwTests/CMakeLists.txt b/unittests/FEXMingwTests/CMakeLists.txt index 002b5eafe..c2a9f9da9 100644 --- a/unittests/FEXMingwTests/CMakeLists.txt +++ b/unittests/FEXMingwTests/CMakeLists.txt @@ -32,14 +32,41 @@ file(GLOB_RECURSE TESTS_32_ONLY CONFIGURE_DEPENDS tests/*.32.cpp) list(REMOVE_ITEM TESTS ${TESTS_64_ONLY}) list(REMOVE_ITEM TESTS ${TESTS_32_ONLY}) +find_program(WINE_PATH wine) + function(AddTests Tests BinDirectory Bitness) - # TODO: Implement some form of test harness for mingw tests. + foreach(TEST ${Tests}) + get_filename_component(TEST_NAME ${TEST} NAME_WE) + set(BIN_PATH "${CMAKE_CURRENT_BINARY_DIR}/${BinDirectory}/${TEST_NAME}.${Bitness}.exe") + set(TEST_CASE "${TEST_NAME}.${Bitness}") + + # Add jit test case + add_test(NAME "${TEST_CASE}.mingw.tst" + COMMAND ${PYTHON_TEST_RUNNER} "${CMAKE_SOURCE_DIR}/Scripts/guest_test_runner.py" + "${CMAKE_CURRENT_SOURCE_DIR}/Known_Failures" + "${CMAKE_CURRENT_SOURCE_DIR}/Expected_Output" + "${CMAKE_CURRENT_SOURCE_DIR}/Disabled_Tests" + "${CMAKE_CURRENT_SOURCE_DIR}/Flake_Tests" + "${TEST_CASE}" + "host" + "${WINE_PATH}" + "${BIN_PATH}") + endforeach() endfunction() -# Execute combined 32-bit and 64-bit tests. -AddTests("${TESTS}" "FEXMingwTests_64" 64) -AddTests("${TESTS}" "FEXMingwTests_32" 32) -# Execute tests that are only 64-bit. -AddTests("${TESTS_64_ONLY}" "FEXMingwTests_64" 64) -# Execute tests that are only 32-bit. -AddTests("${TESTS_32_ONLY}" "FEXMingwTests_32" 32) +# Only add the tests if a wine binary is found. +if (NOT WINE_PATH-NOTFOUND) + # Execute combined 32-bit and 64-bit tests. + AddTests("${TESTS}" "FEXMingwTests_64" 64) + AddTests("${TESTS}" "FEXMingwTests_32" 32) + # Execute tests that are only 64-bit. + AddTests("${TESTS_64_ONLY}" "FEXMingwTests_64" 64) + # Execute tests that are only 32-bit. + AddTests("${TESTS_32_ONLY}" "FEXMingwTests_32" 32) +endif() + +add_custom_target(fex_mingw_tests + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + USES_TERMINAL + COMMAND "ctest" "--output-on-failure" "--timeout" "30" ${TEST_JOB_FLAG} "-R" "\.*\.mingw\.tst$$" + DEPENDS FEXMingwTests FEXMingwTests_32)