Skip to content

Commit

Permalink
Separate test files and upload failure artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
beau-lunarg committed Dec 2, 2024
1 parent 86da352 commit 5bc416d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 74 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
name: "Windows MSVC Debug",
os: windows-latest,
artifact: "gfxreconstruct-dev-windows-msvc-debug",
test_artifact: "gfxreconstruct-test-failure-dev-windows-msvc-debug",
type: "debug",
build_dir: "dbuild",
cc: "cl", cxx: "cl"
Expand Down Expand Up @@ -55,18 +56,19 @@ jobs:
curl.exe -o vulkan-sdk.zip https://sdk.lunarg.com/sdk/download/1.3.296.0/windows/VulkanRT-1.3.296.0-Components.zip
Expand-Archive vulkan-sdk.zip -DestinationPath $pwd\vulkan-sdk
$env:Path += ";$pwd\vulkan-sdk\VulkanRT-1.3.296.0-Components\x64"
cd ${{matrix.config.build_dir}}\windows\x64\output\bin
New-Item -Path "HKLM:\SOFTWARE\Khronos"
New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan"
New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan\ImplicitLayers"
New-ItemProperty -Path "HKLM:\SOFTWARE\Khronos\Vulkan\ImplicitLayers" -Name "${{matrix.config.build_dir}}\windows\x64\output\bin\VkLayer_gfxreconstruct.json" -PropertyType "DWord" -Value 0
New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan\Drivers"
New-ItemProperty -Path "HKLM:\SOFTWARE\Khronos\Vulkan\Drivers" -Name "${{matrix.config.build_dir}}\windows\x64\output\test\VkICD_mock_icd.json" -PropertyType "DWord" -Value 0
cd ${{matrix.config.build_dir}}\windows\x64\output\test
./run-tests.ps1
- name: Prepare artifacts
run: |
copy LICENSE.txt ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy LICENSE_ThirdParty.txt ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy USAGE_desktop_D3D12.md ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy USAGE_desktop_Vulkan.md ${{ matrix.config.build_dir }}\windows\x64\output\bin\
copy layer\vk_layer_settings.txt ${{ matrix.config.build_dir }}\windows\x64\output\bin\
move ${{ matrix.config.build_dir }}\windows\x64\output\bin gfxreconstruct-dev
- name: Upload artifacts
- name: Upload test failure artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.artifact }}
path: .\gfxreconstruct-dev
name: ${{ matrix.config.test_artifact }}
path: ${{matrix.config.build_dir}}\windows\x64\output\test
10 changes: 6 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ target_link_libraries(gfxrecon-testapp-runner
nlohmann_json::nlohmann_json
GTest::gtest GTest::gtest_main)
gtest_discover_tests(gfxrecon-testapp-runner)
install(TARGETS gfxrecon-testapp-runner RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS OWNER_EXECUTE)
install(DIRECTORY known_good DESTINATION ${CMAKE_INSTALL_BINDIR})
install(PROGRAMS run-tests.sh DESTINATION ${CMAKE_INSTALL_BINDIR})
install(PROGRAMS run-tests.ps1 DESTINATION ${CMAKE_INSTALL_BINDIR})

SET(GFXRECON_INSTALL_TESTDIR ${CMAKE_INSTALL_PREFIX}/test)
install(TARGETS gfxrecon-testapp-runner RUNTIME DESTINATION ${GFXRECON_INSTALL_TESTDIR} PERMISSIONS OWNER_EXECUTE)
install(DIRECTORY known_good DESTINATION ${GFXRECON_INSTALL_TESTDIR})
install(PROGRAMS run-tests.sh DESTINATION ${GFXRECON_INSTALL_TESTDIR})
install(PROGRAMS run-tests.ps1 DESTINATION ${GFXRECON_INSTALL_TESTDIR})
78 changes: 37 additions & 41 deletions test/icd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if (ANDROID OR MINGW)
return()
endif()
endif ()

# These variables enable downstream users to customize the CMake targets
# based on the target API variant (e.g. Vulkan SC)
Expand All @@ -27,61 +27,61 @@ set(GENERATED generated)

option(BUILD_MOCK_ANDROID_SUPPORT "Build with Android Platform headers" OFF)

if(WIN32)
if (WIN32)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DVK_USE_PLATFORM_WIN32_KHX -DWIN32_LEAN_AND_MEAN)
elseif(APPLE)
elseif (APPLE)
add_definitions(-DVK_USE_PLATFORM_MACOS_MVK)
elseif(BUILD_MOCK_ANDROID_SUPPORT)
elseif (BUILD_MOCK_ANDROID_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|GNU")
if(BUILD_WSI_XCB_SUPPORT)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|GNU")
if (BUILD_WSI_XCB_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XCB_KHX)
endif()
endif ()

if(BUILD_WSI_XLIB_SUPPORT)
if (BUILD_WSI_XLIB_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_KHX -DVK_USE_PLATFORM_XLIB_XRANDR_EXT)
endif()
endif ()

if(BUILD_WSI_WAYLAND_SUPPORT)
if (BUILD_WSI_WAYLAND_SUPPORT)
add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR -DVK_USE_PLATFORM_WAYLAND_KHX)
endif()
else()
endif ()
else ()
message(FATAL_ERROR "Unsupported Platform!")
endif()
endif ()

add_library(VkICD_mock_icd MODULE)
target_sources(VkICD_mock_icd PRIVATE mock_icd.cpp)
target_link_libraries(VkICD_mock_icd PRIVATE Vulkan::Headers)

target_include_directories(VkICD_mock_icd PRIVATE
${GENERATED}
.
${GENERATED}
.
)

if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
target_compile_options(VkICD_mock_icd PRIVATE
-Wpointer-arith
-Wno-unused-function
-Wno-sign-compare
-Wpointer-arith
-Wno-unused-function
-Wno-sign-compare
)
endif()
endif ()

if(MSVC)
if (MSVC)
target_compile_options(VkICD_mock_icd PRIVATE /bigobj)
target_compile_definitions(VkICD_mock_icd PRIVATE _CRT_SECURE_NO_WARNINGS)
target_link_options(VkICD_mock_icd PRIVATE /DEF:${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.def)
else()
if(APPLE)
else ()
if (APPLE)
set_target_properties(VkICD_mock_icd PROPERTIES SUFFIX ".dylib")
endif()
endif ()
message(DEBUG "Mock ICD Functions are exported via EXPORT")
endif()
endif ()

set_target_properties(VkICD_mock_icd PROPERTIES OUTPUT_NAME ${MOCK_ICD_NAME})

if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO)
target_compile_definitions(VkICD_mock_icd PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}")
endif()
endif ()

# There are 2 primary deliverables for the mock driver.
# - The actual library (lib)VkICD_mock_icd.(dll|so|dylib)
Expand All @@ -91,44 +91,40 @@ endif()
set(INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${MOCK_ICD_NAME}.json.in")
set(INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/mock_icd.json")
set(OUTPUT_FILE_FINAL_NAME "${MOCK_ICD_NAME}.json")
set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/test_apps)
if (WIN32)
set(LAYER_INSTALL_DIR ${CMAKE_INSTALL_BINDIR}/test_apps) # WIN32 expect the dll in the `bin` dir, this matches our WIN32 SDK process
endif()

if (WIN32)
set(JSON_LIBRARY_PATH ".\\\\${MOCK_ICD_NAME}.dll")
elseif(APPLE)
elseif (APPLE)
set(JSON_LIBRARY_PATH "./lib${MOCK_ICD_NAME}.dylib")
else()
else ()
set(JSON_LIBRARY_PATH "./lib${MOCK_ICD_NAME}.so")
endif()
endif ()

configure_file(${INPUT_FILE} ${INTERMEDIATE_FILE} @ONLY)

# To support both multi/single configuration generators just copy the json to the correct directory
add_custom_command(TARGET VkICD_mock_icd POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INTERMEDIATE_FILE} $<TARGET_FILE_DIR:VkICD_mock_icd>/${OUTPUT_FILE_FINAL_NAME}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INTERMEDIATE_FILE} $<TARGET_FILE_DIR:VkICD_mock_icd>/${OUTPUT_FILE_FINAL_NAME}
)

# For UNIX-based systems, `library_path` should not contain a relative path (indicated by "./") before installing to system directories
# This json isn't used for regular local development, it's used for installation
if (UNIX)
set(UNIX_INTERMEDIATE_FILE "${CMAKE_CURRENT_BINARY_DIR}/json/unix_install_mock_icd.json")

if(APPLE)
if (APPLE)
set(JSON_LIBRARY_PATH "lib${MOCK_ICD_NAME}.dylib")
else()
else ()
set(JSON_LIBRARY_PATH "lib${MOCK_ICD_NAME}.so")
endif()
endif ()

configure_file(${INPUT_FILE} ${UNIX_INTERMEDIATE_FILE} @ONLY)

install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME})
endif()
endif ()

if (WIN32)
install(FILES ${INTERMEDIATE_FILE} DESTINATION ${LAYER_INSTALL_DIR} RENAME ${OUTPUT_FILE_FINAL_NAME})
endif()
install(FILES ${INTERMEDIATE_FILE} DESTINATION ${GFXRECON_INSTALL_TESTDIR} RENAME ${OUTPUT_FILE_FINAL_NAME})
endif ()

install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR})
install(TARGETS VkICD_mock_icd DESTINATION ${GFXRECON_INSTALL_TESTDIR})
16 changes: 0 additions & 16 deletions test/run-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
$is_admin = ([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator);

if ($is_admin) {
New-Item -Path "HKLM:\SOFTWARE\Khronos"
New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan"
New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan\ImplicitLayers"
New-ItemProperty -Path "HKLM:\SOFTWARE\Khronos\Vulkan\ImplicitLayers" -Name "$pwd\VkLayer_gfxreconstruct.json" -PropertyType "DWord" -Value 0
New-Item -Path "HKLM:\SOFTWARE\Khronos\Vulkan\Drivers"
New-ItemProperty -Path "HKLM:\SOFTWARE\Khronos\Vulkan\Drivers" -Name "$pwd\test_apps\VkICD_mock_icd.json" -PropertyType "DWord" -Value 0
} else {
$env:VK_LAYER_PATH="$pwd"
$env:VK_DRIVER_FILES="$pwd\test_apps\VkICD_mock_icd.json"
$env:VK_INSTANCE_LAYERS="VK_LAYER_LUNARG_gfxreconstruct"
}
$env:GFXRECON_CAPTURE_FILE_TIMESTAMP="false"
$env:GFXRECON_CAPTURE_FILE="actual.gfxr"
$env:GFXRECON_LOG_LEVEL="info"
Expand Down
2 changes: 1 addition & 1 deletion test/test_apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ find_package(SDL3)

add_custom_target(gfxrecon-testapps)

SET(GFXRECON_INSTALL_TESTAPPDIR ${CMAKE_INSTALL_BINDIR}/test_apps)
SET(GFXRECON_INSTALL_TESTAPPDIR ${GFXRECON_INSTALL_TESTDIR}/test_apps)

add_subdirectory(triangle)
add_subdirectory(multisample-depth)
Expand Down

0 comments on commit 5bc416d

Please sign in to comment.