fix wrappers
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user