fix wrappers
All checks were successful
go-test / go test (push) Successful in 12s
Release / Build & publish (push) Successful in 31s

This commit is contained in:
2026-06-10 10:30:25 +03:00
parent 1fec40fc9e
commit b44cccf8d1
2 changed files with 108 additions and 4 deletions

View File

@@ -589,14 +589,22 @@ func (r *Runner) runTest(t *dsl.Test) *TestResult {
return tr
}
// absoluteArgs rewrites only those arguments that name a file staged in the
// test's working directory to an absolute path. This helps wrappers (gdb,
// valgrind) that may resolve paths from a different directory, without
// corrupting non-path arguments — a numeric arg like "1" must stay "1", not
// become "<tmpdir>/1". The process runs with Dir=dir anyway, so relative paths
// already resolve there; this is purely a safety net for genuine file args.
func absoluteArgs(dir string, args []string) []string {
out := make([]string, len(args))
for i, a := range args {
if !filepath.IsAbs(a) {
out[i] = filepath.Join(dir, a)
} else {
out[i] = a
if a != "" && !filepath.IsAbs(a) {
if _, err := os.Stat(filepath.Join(dir, a)); err == nil {
out[i] = filepath.Join(dir, a)
continue
}
}
out[i] = a
}
return out
}