diff options
author | Jian Cai <jiancai@google.com> | 2020-01-23 15:03:04 -0800 |
---|---|---|
committer | Jian Cai <jiancai@google.com> | 2020-02-13 04:09:36 +0000 |
commit | c4615d189f6b0dc4c116fc0a78ac295f7427170e (patch) | |
tree | 33b7f1278427e157821c7e6a091dedad2410b3f9 /compiler_wrapper/goldenutil_test.go | |
parent | 8477fefd6c54adec7a45f7a1c9c2119f7aca2d2e (diff) | |
download | toolchain-utils-c4615d189f6b0dc4c116fc0a78ac295f7427170e.tar.gz |
compiler_wrapper: update the presubmit tests.
Update paths used in test cases.
BUG=chromium:1042452
TEST=verified locally.
Change-Id: I0ddca454280f91508b632785ec9b417328e2ab3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2018235
Tested-by: Jian Cai <jiancai@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
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()) |