commit c690e7b81fb4ca88ebe7970f8f6fa6d30f8438da from: Sven M. Hallberg date: Mon Jun 23 09:58:04 2025 UTC back out a55302af (cd into a test's dir when executing it) commit - 13d3265df55c9af2372c89b042d40272a7d1e14f commit + c690e7b81fb4ca88ebe7970f8f6fa6d30f8438da blob - 7f009af72b7716606c771639158763d05fd4000d blob + 5683696daa291398786336627041302aeb81e24c --- exercise +++ exercise @@ -16,19 +16,16 @@ set opts(-q) 0 ;# quiet mode # executing tests -proc execute_test {countervar base path} { +proc execute_test {countervar path} { global opts upvar $countervar counters # Should the test result be integrated as a nested test suite? set suite [string match $opts(-ps) [file tail $path]] - # Change into the test's directory. + # Call files in current dir with "./". set exe $path - if {[set i [string last / $path]] != -1} { - cd [file join $base [string range $path 0 $i]] - set exe [string range $path [incr i] end] - } + if {[string first / $exe] < 0} {set exe "./$exe"} if {$suite} { # Pass stderr through when calling test suites. @@ -45,7 +42,7 @@ proc execute_test {countervar base path} { set scounters {} if {[catch { # Execute the test, attaching pipes to stdin and stdout. - set pipe [open "|./$exe 2>$errfile" r+] + set pipe [open "|$exe 2>$errfile" r+] # Consume the test's stdout. Ignore it for normal tests. # Continually update the progress report for test suites. @@ -361,13 +358,12 @@ proc main {argc argv} { set paths [expr {$argc == 0 ? "." : $argv}] set files [find_files $paths] - set dir [pwd] dict set counters total [llength $files] ;# tentative total test count ;# might adjust when suites run foreach file $files { print_progress $counters - execute_test counters $dir $file + execute_test counters $file } if {!$opts(-q)} {puts [summary $counters]}