Skip to content

Commit 47426c2

Browse files
committed
fix: resolve P2 issues in unified test runner
- P2-1: Fix expand_test_cases to use BS sizes for full+bs combination - P2-2: Add --warmup and --iters CLI arguments - P2-3: Validate flagfft_median_ms > 0 and ref_median_ms > 0 in parse_perf_result - P2-4: Add compute_speedup_stats with geometric mean speedup - P2-5: Add help text for --combination argument - P2-6: Fix progress bar over 100% by tracking completed cases - P2-7: Add worker join after main loop - P2-8: Add failure message to JsonTestListener JSON output - P2-9: Add write_json_escaped helper for safe JSON string output - P2-10: Remove unused sizes_2d_smooth and sizes_2d_bluestein keys - P2-11: Fix stale tests/cli/ reference in docs/architecture.md - P2-12: Delete unused tools/consts.py - P2-13: Add unified test runner design doc to worktree
1 parent 1103bc8 commit 47426c2

6 files changed

Lines changed: 693 additions & 53 deletions

File tree

conf/test_matrix.yaml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ sizes_bs:
2525
- 997
2626
- 1009
2727

28-
# ── 2D 尺寸定义 ────────────────────────────────────────────────
29-
30-
# 平滑 2D 尺寸 (CT 路径)
31-
sizes_2d_smooth:
32-
- [16, 16]
33-
- [64, 64]
34-
- [128, 256]
35-
- [256, 128]
36-
- [256, 256]
37-
- [512, 512]
38-
39-
# Bluestein 2D 尺寸
40-
sizes_2d_bluestein:
41-
- [23, 23]
42-
- [997, 16]
43-
- [16, 997]
44-
4528
# ── 批大小 ─────────────────────────────────────────────────────
4629

4730
batches:

ctest/flagfft_test.h

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,30 @@ inline bool should_skip_direction(int direction_flag) {
716716
return g_test_params.direction != direction_flag;
717717
}
718718

719+
inline void write_json_escaped(std::ostream& out, const std::string& s) {
720+
for (char c : s) {
721+
switch (c) {
722+
case '"':
723+
out << "\\\"";
724+
break;
725+
case '\\':
726+
out << "\\\\";
727+
break;
728+
case '\n':
729+
out << "\\n";
730+
break;
731+
case '\r':
732+
out << "\\r";
733+
break;
734+
case '\t':
735+
out << "\\t";
736+
break;
737+
default:
738+
out << c;
739+
}
740+
}
741+
}
742+
719743
class JsonTestListener : public ::testing::EmptyTestEventListener {
720744
public:
721745
explicit JsonTestListener(const char* filename) : filename_(filename ? filename : "gtest_result.json") {
@@ -745,9 +769,25 @@ class JsonTestListener : public ::testing::EmptyTestEventListener {
745769
if (!first_failure) out << ",\n";
746770
first_failure = false;
747771
out << " {\n";
748-
out << " \"suite\": \"" << test->test_suite_name() << "\",\n";
749-
out << " \"name\": \"" << test->name() << "\",\n";
750-
out << " \"params\": \"" << test->value_param() << "\"\n";
772+
out << " \"suite\": \"";
773+
write_json_escaped(out, test->test_suite_name());
774+
out << "\",\n";
775+
out << " \"name\": \"";
776+
write_json_escaped(out, test->name());
777+
out << "\",\n";
778+
out << " \"params\": \"";
779+
write_json_escaped(out, test->value_param());
780+
out << "\",\n";
781+
out << " \"message\": \"";
782+
bool first_msg = true;
783+
for (int k = 0; k < test->result()->total_part_count(); ++k) {
784+
if (test->result()->GetTestPartResult(k).failed()) {
785+
if (!first_msg) out << "; ";
786+
first_msg = false;
787+
write_json_escaped(out, test->result()->GetTestPartResult(k).message());
788+
}
789+
}
790+
out << "\"\n";
751791
out << " }";
752792
}
753793
}

docs/architecture.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ database when `FLAGFFT_TUNE_DB=PATH` is set.
102102

103103
## Tests
104104

105-
`tests/cli/` shells out to `flagfft-cli --json` for plan/error contracts,
106-
cuFFT comparisons, benchmark schema, unsupported boundaries, and tuning
107-
database reuse. `tests/python/` continues to cover code generation.
105+
`ctest/` contains Google Test based accuracy tests for all operators.
106+
`tools/run_tests.py` is the unified test runner that orchestrates both
107+
accuracy and performance testing across multiple GPUs. `tests/python/`
108+
continues to cover code generation.

0 commit comments

Comments
 (0)