Merge pull request #10684 from fma-rc/fix/agc-recorder-tests-failed-check-exit

fix(tests): stop a failed recorder test without unwinding through objects its open batch still records
This commit is contained in:
Dean authored and GitHub committed 2026-10-27 10:31:15 +13:00
commit d40e1394e4
2 files changed
+52 -5

No files matched your search

+5 -1
View File
@@ -1851,10 +1851,14 @@ if(BUILD_TESTING)
set_tests_properties(agc_recorder_cmask PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 30)
add_test(NAME agc_recorder_cube COMMAND agc_driver_recorder_tests --cube-only)
set_tests_properties(agc_recorder_cube PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 30)
add_test(NAME agc_recorder_failed_check COMMAND agc_driver_recorder_tests --failed-check-only)
set_tests_properties(agc_recorder_failed_check PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 30
PASS_REGULAR_EXPRESSION "a failed check stopped the test with a texture upload in its open batch"
FAIL_REGULAR_EXPRESSION "recorder teardown")
if(WIN32)
set_tests_properties(agc_driver_host_import_lifetime agc_driver_host_import_mutation_race agc_driver_unit_shadow agc_driver_unit_shadow_budget PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
set_tests_properties(agc_recorder_completion_labels agc_recorder_cmask agc_recorder_cube PROPERTIES ENVIRONMENT_MODIFICATION
set_tests_properties(agc_recorder_completion_labels agc_recorder_cmask agc_recorder_cube agc_recorder_failed_check PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
set_property(TEST agc_driver_host_import_lifetime APPEND PROPERTY ENVIRONMENT_MODIFICATION
@@ -25,9 +25,11 @@
#include "prx/libSceAgcDriver/Execution/include/DisplayFormat.hpp"
#include "prx/libSceAgcDriver/Execution/include/GuestMemory.hpp"
#include "prx/libSceAgcDriver/Execution/include/ShaderMemory.hpp"
#include "prx/libc/include/Api.hpp"
#include "prx/libc/include/GuestAllocations.hpp"
#include "prx/libc/include/GuestArena.hpp"
#include "prx/libc/include/GuestWriteWatch.hpp"
#include "prx/libc/include/Shutdown.hpp"
#include "prx/libc/include/general/VabiMacros.hpp"
#include "ResidentPresent.hpp"
#include "ImageTableAbi.hpp"
@@ -66,6 +68,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <filesystem>
#include <fstream>
#include <iomanip>
@@ -9627,6 +9630,29 @@ void minLodTests(const Device& device, Recorder& recorder) {
expectRed(sample(0x100, 0.0f, 1), unorm(1), "minimum LOD clamp: MIN_LOD at the view's base level reads its base level");
}
void failedCheckReportTests(const Device& device, Recorder& recorder) {
const auto& context = device.GetContext();
Require(Recorder::Active() == &recorder, "the failed check test needs the active recorder");
TextureDetiler detiler(context);
GuestTextureResource resource{};
resource.baseAddress = 0x100000;
resource.width = 64;
resource.height = 64;
resource.mipCount = 1;
resource.tileMode = TextureTileMode::kLinear;
resource.dimension = TextureDimension::k2D;
resource.format = 56;
resource.dstSelX = 4;
resource.dstSelY = 5;
resource.dstSelZ = 6;
resource.dstSelW = 7;
const std::vector<std::byte> snapshot(static_cast<std::size_t>(DescribeSurface(resource).guestBytes), std::byte{0x40});
const VkComponentMapping identity{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY};
Texture texture(context, detiler, resource, identity, snapshot);
Require(recorder.Recording(), "a texture upload was not recorded into the open batch");
Require(false, "a failed check stopped the test with a texture upload in its open batch");
}
void singleCubeTests(const Device& device, Recorder& recorder) {
auto context = device.GetContext();
TextureDetiler detiler(context);
@@ -11434,7 +11460,23 @@ void Run(Context context) {
#endif
int main(int argc, char** argv) {
try {
_ZSt13set_terminatePFvvE_nid_postfix([] {
std::fflush(nullptr);
std::cout.flush();
if (const auto failure = std::current_exception()) {
try {
std::rethrow_exception(failure);
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
} catch (...) {
std::cerr << "terminated by an exception that is not a std::exception\n";
}
} else {
std::cerr << "terminated without an active exception\n";
}
LibcTerminate_nid_no_patch(1);
});
{
if (argc == 2 && std::string_view(argv[1]) == "--collect-mapping-history-only") {
if (!collectMappingHistoryTests()) return 77;
std::cout << "collect mapping history tests passed\n";
@@ -11621,6 +11663,10 @@ int main(int argc, char** argv) {
std::cout << "CB resolves into tiled targets tests passed\n";
return 0;
}
if (argc == 2 && std::string_view(argv[1]) == "--failed-check-only") {
failedCheckReportTests(device, recorder);
return 0;
}
if (argc == 2 && std::string_view(argv[1]) == "--cube-only") {
singleCubeTests(device, recorder);
cubeExtraSliceTests(device, recorder);
@@ -11958,8 +12004,5 @@ int main(int argc, char** argv) {
recorder.Activate();
std::cout << "Recorder read tracking and label tests passed\n";
return 0;
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}