diff options
author | Tobias Bosch <tbosch@google.com> | 2019-06-24 09:31:39 -0700 |
---|---|---|
committer | Tobias Bosch <tbosch@google.com> | 2019-06-28 19:00:23 +0000 |
commit | 900dbc92800d8fc927905db29cb302461054cf97 (patch) | |
tree | c74ecbfb01ee4ee679090139596aef3546f19d9b /compiler_wrapper/sysroot_flag_test.go | |
parent | 739e6abb2cd03b60e579df31ad55870a4a00260a (diff) | |
download | toolchain-utils-900dbc92800d8fc927905db29cb302461054cf97.tar.gz |
Introduce infrastructure for calling and testing nested
commands, error messages and exit codes.
Also:
- implements the -Xclang-path= flag as use case of calling
a nested command.
- adds tests for forwarding errors, comparing against the
old wrapper, and exit codes.
- captures the source locations of errors in error messages.
- compares exit codes of new wrapper and old wrapper.
BUG=chromium:773875
TEST=unit test
Change-Id: I919e58091d093d68939809f676f799a68ec7a34e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1676833
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Tobias Bosch <tbosch@google.com>
Diffstat (limited to 'compiler_wrapper/sysroot_flag_test.go')
-rw-r--r-- | compiler_wrapper/sysroot_flag_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler_wrapper/sysroot_flag_test.go b/compiler_wrapper/sysroot_flag_test.go index 93d995d9..295a1ab9 100644 --- a/compiler_wrapper/sysroot_flag_test.go +++ b/compiler_wrapper/sysroot_flag_test.go @@ -8,7 +8,7 @@ import ( func TestOmitSysrootGivenUserDefinedSysroot(t *testing.T) { withTestContext(t, func(ctx *testContext) { runWithCompiler := func(compiler string) { - cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg, + cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(compiler, "--sysroot=/somepath", mainCc))) if err := verifyArgOrder(cmd, "--sysroot=/somepath", mainCc); err != nil { t.Error(err) @@ -26,7 +26,7 @@ func TestOmitSysrootGivenUserDefinedSysroot(t *testing.T) { func TestSetSysrootFlagFromEnv(t *testing.T) { withTestContext(t, func(ctx *testContext) { ctx.env = []string{"SYSROOT=/envpath"} - cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg, + cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, mainCc))) if err := verifyArgOrder(cmd, "--sysroot=/envpath", mainCc); err != nil { t.Error(err) @@ -37,7 +37,7 @@ func TestSetSysrootFlagFromEnv(t *testing.T) { func TestSetSysrootRelativeToWrapperPath(t *testing.T) { withTestContext(t, func(ctx *testContext) { ctx.cfg.rootRelPath = "somepath" - cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg, + cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(gccX86_64, mainCc))) if err := verifyArgOrder(cmd, "--sysroot="+ctx.tempDir+"/somepath/usr/x86_64-cros-linux-gnu", mainCc); err != nil { @@ -52,7 +52,7 @@ func TestSetSysrootRelativeToSymlinkedWrapperPath(t *testing.T) { linkedWrapperPath := path.Join(ctx.tempDir, "a/linked/path/x86_64-cros-linux-gnu-gcc") ctx.symlink(path.Join(ctx.tempDir, gccX86_64), linkedWrapperPath) - cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg, + cmd := ctx.must(callCompiler(ctx, ctx.cfg, ctx.newCommand(linkedWrapperPath, mainCc))) if err := verifyArgOrder(cmd, "--sysroot="+ctx.tempDir+"/somepath/usr/x86_64-cros-linux-gnu", mainCc); err != nil { |