diff options
author | Tobias Bosch <tbosch@google.com> | 2019-09-12 15:19:57 -0700 |
---|---|---|
committer | Tobias Bosch <tbosch@google.com> | 2019-09-13 18:57:43 +0000 |
commit | 3b8531f0c0739003a208b7beb002d1058656a962 (patch) | |
tree | 1f53081777ba01d9ecd1b31bd2ee76285a69d91c /compiler_wrapper/sysroot_flag_test.go | |
parent | c183559d9c40285129d08a1146cfde0982b6c356 (diff) | |
download | toolchain-utils-3b8531f0c0739003a208b7beb002d1058656a962.tar.gz |
Allow to remove env variables.
Previously, we only supported setting env variables
to empty, but not to remove it. This lead to the case
that we never removed the CCACHE_DISABLE env variable,
which kept the ccache disabled, and caused a performance
regression compared to the old wrapper as the new wrapper
didn't use the ccache in this case.
This cl also adds tests for the real exec and run commands
to prevent regressions in these cases.
BUG=chromium:773875
TEST=new unit tests
TEST=performance analysis for
TEST=emerge-veyron_jerry --nodeps chromeos-kernel-4_19
Change-Id: I5ca88ba8d7b05c3e12e292465fcd4ff9925b0344
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1802159
Tested-by: Tobias Bosch <tbosch@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/sysroot_flag_test.go')
-rw-r--r-- | compiler_wrapper/sysroot_flag_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler_wrapper/sysroot_flag_test.go b/compiler_wrapper/sysroot_flag_test.go index 1c757276..308d5e96 100644 --- a/compiler_wrapper/sysroot_flag_test.go +++ b/compiler_wrapper/sysroot_flag_test.go @@ -32,12 +32,29 @@ func TestSetSysrootFlagFromEnv(t *testing.T) { ctx.env = []string{"SYSROOT=/envpath"} cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, mainCc))) + if err := verifyEnvUpdate(cmd, "SYSROOT="); err != nil { + t.Error(err) + } if err := verifyArgOrder(cmd, "--sysroot=/envpath", mainCc); err != nil { t.Error(err) } }) } +func TestClearEmptySysrootFlagInEnv(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + ctx.env = []string{"SYSROOT="} + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(gccX86_64, mainCc))) + if err := verifyEnvUpdate(cmd, "SYSROOT="); err != nil { + t.Error(err) + } + if err := verifyArgOrder(cmd, "--sysroot=.*/x86_64-cros-linux-gnu", mainCc); err != nil { + t.Error(err) + } + }) +} + func TestSetSysrootRelativeToWrapperPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { ctx.cfg.rootRelPath = "somepath" |