From a37491ede4d66e0592e14798884e366a609ea098 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Thu, 1 Oct 2026 02:27:40 +0200 Subject: [PATCH] tests (#264 follow-up): iq_parity skips (exit 3) when no fixture was generated, as its generator does; a partly missing set still fails; the open handle of a half-present fixture is closed --- CMakeLists.txt | 2 +- src/kernels/iq_parity.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a889ff..239b16d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -486,7 +486,7 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP) # exit 3: numpy or the vendored gguf-py is missing (a trimmed third_party) - a skip, not a failure set_tests_properties(iq_parity_fixtures PROPERTIES FIXTURES_SETUP iq_fixture_data SKIP_RETURN_CODE 3) add_test(NAME iq_parity COMMAND iq_parity ${CMAKE_CURRENT_BINARY_DIR}/iq_fixture) - set_tests_properties(iq_parity PROPERTIES FIXTURES_REQUIRED iq_fixture_data) + set_tests_properties(iq_parity PROPERTIES FIXTURES_REQUIRED iq_fixture_data SKIP_RETURN_CODE 3) else() message(STATUS "STRATA tests: no python3 with numpy was found (the configured interpreter and .venv " "were probed) - the iq_parity fixtures and its test are not registered; the fixtures " diff --git a/src/kernels/iq_parity.cpp b/src/kernels/iq_parity.cpp index 288d1e69..4bc74f64 100644 --- a/src/kernels/iq_parity.cpp +++ b/src/kernels/iq_parity.cpp @@ -27,7 +27,7 @@ int main(int argc, char** argv) { const std::string dir = argc > 1 ? argv[1] : "logs/iq_fixture"; const char* names[] = {"IQ2_XXS", "IQ2_XS", "IQ2_S", "IQ3_XXS", "IQ3_S", "IQ1_M", "IQ4_NL", "IQ4_XS", "Q2_0", "Q3_K"}; - int failures = 0; + int failures = 0, missing = 0; cudaStream_t s; cudaStreamCreate(&s); for (const char* nm : names) { @@ -37,7 +37,10 @@ int main(int argc, char** argv) { std::printf("%-8s missing fixture: %s/%s.bin or %s/%s.f32 - generate the fixtures first with " "python tools/iq_fixture.py --out %s (deterministic; see the tool's --help)\n", nm, dir.c_str(), nm, dir.c_str(), nm, dir.c_str()); + if (f) std::fclose(f); + if (g) std::fclose(g); ++failures; + ++missing; continue; } int hdr[3]; @@ -113,5 +116,10 @@ int main(int argc, char** argv) { cudaFree(dw); cudaFree(dq); cudaFree(dx); cudaFree(xq); cudaFree(dy); } std::printf("iq_parity: %d failures\n", failures); + // no fixture at all: the generator was skipped (no numpy / vendored gguf-py) - a skip (3), not a failure + if (missing == (int) (sizeof names / sizeof names[0])) { + std::printf("iq_parity: no fixtures in %s - skipped\n", dir.c_str()); + return 3; + } return failures ? 1 : 0; }