diff options
Diffstat (limited to 'compiler_wrapper/goldenutil_test.go')
-rw-r--r-- | compiler_wrapper/goldenutil_test.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler_wrapper/goldenutil_test.go b/compiler_wrapper/goldenutil_test.go index 23e003c5..2b391d73 100644 --- a/compiler_wrapper/goldenutil_test.go +++ b/compiler_wrapper/goldenutil_test.go @@ -14,7 +14,6 @@ import ( "os" "path/filepath" "regexp" - "runtime" "strings" ) @@ -128,6 +127,11 @@ func fillGoldenResults(ctx *testContext, files []goldenFile) []goldenFile { } cmdResult := record.Cmds[len(newCmds)] cmdResult.Cmd = cmd + if numEnvUpdates := len(cmdResult.Cmd.EnvUpdates); numEnvUpdates > 0 { + if strings.HasPrefix(cmdResult.Cmd.EnvUpdates[numEnvUpdates-1], "PYTHONPATH") { + cmdResult.Cmd.EnvUpdates[numEnvUpdates-1] = "PYTHONPATH=/somepath/test_binary" + } + } newCmds = append(newCmds, cmdResult) io.WriteString(stdout, cmdResult.Stdout) io.WriteString(stderr, cmdResult.Stderr) @@ -146,13 +150,7 @@ func fillGoldenResults(ctx *testContext, files []goldenFile) []goldenFile { // Create an empty wrapper at the given path. // Needed as we are resolving symlinks which stats the wrapper file. ctx.writeFile(record.WrapperCmd.Cmd.Path, "") - // Assign a fixed path to os.Args[0] to pass the test. - tmp := os.Args[0] - // callCompiler verifies os.Args[0] exists, so use a real file. - _, file, _, _ := runtime.Caller(1) - os.Args[0] = file record.WrapperCmd.ExitCode = callCompiler(ctx, ctx.cfg, record.WrapperCmd.Cmd) - os.Args[0] = tmp if hasInternalError(ctx.stderrString()) { ctx.t.Errorf("found an internal error for wrapperCmd %#v and env #%v. Got: %s", record.WrapperCmd.Cmd, record.Env, ctx.stderrString()) |