@@ -73,6 +73,7 @@ set ::file ""; # If set, runs only the tests in this comma separated list
7373set ::curfile " " ; # Hold the filename of the current suite
7474set ::accurate 0; # If true runs fuzz tests with more iterations
7575set ::force_failure 0
76+ set ::failures_json_file " " ; # If set, write failures JSON to this path
7677set ::timeout 1200; # 20 minutes without progresses will quit the test.
7778set ::last_progress [clock seconds]
7879set ::active_servers {} ; # Pids of active server instances.
@@ -638,13 +639,15 @@ proc write_test_failures {} {
638639 lappend failures " \{\" test_name\" :\" $test_name \" ,\" test_file\" :\" $test_file \" ,\" status\" :\" $status \" ,\" error\" :\" $error_msg \"\} "
639640 }
640641
641- file mkdir " test-failures"
642- if {[info exists ::module_api_mode] && $::module_api_mode } {
643- set suite_name " moduleapi"
644- } else {
645- set suite_name " valkey"
642+ if {$::failures_json_file eq " " } {
643+ return
646644 }
647- set fp [open " test-failures/${suite_name} .json" w]
645+
646+ set outdir [file dirname $::failures_json_file ]
647+ if {$outdir ne " ." } {
648+ file mkdir $outdir
649+ }
650+ set fp [open $::failures_json_file w]
648651 puts $fp " \[ [ join $failures " ," ] \] "
649652 close $fp
650653}
@@ -729,6 +732,8 @@ proc print_help_screen {} {
729732 " --clients <num> Number of test clients (default 16)."
730733 " --timeout <sec> Test timeout in seconds (default 20 min)."
731734 " --force-failure Force the execution of a test that always fails."
735+ " --failures-json <path>"
736+ " Write test failures to the specified JSON file."
732737 " --config <k> <v> Extra config file argument."
733738 " --skipfile <file> Name of a file containing test names or regexp patterns (if"
734739 " <test> starts with '/') that should be skipped (one per"
@@ -853,6 +858,9 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
853858 set ::accurate 1
854859 } elseif {$opt eq {--force-failure}} {
855860 set ::force_failure 1
861+ } elseif {$opt eq {--failures-json}} {
862+ set ::failures_json_file $arg
863+ incr j
856864 } elseif {$opt eq {--single}} {
857865 foreach unit [expand_unit_spec $arg ] {
858866 lappend ::single_tests $unit
0 commit comments