aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/thumb_flags_test.go
diff options
context:
space:
mode:
authorTobias Bosch <tbosch@google.com>2019-06-24 09:31:39 -0700
committerTobias Bosch <tbosch@google.com>2019-06-28 19:00:23 +0000
commit900dbc92800d8fc927905db29cb302461054cf97 (patch)
treec74ecbfb01ee4ee679090139596aef3546f19d9b /compiler_wrapper/thumb_flags_test.go
parent739e6abb2cd03b60e579df31ad55870a4a00260a (diff)
downloadtoolchain-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/thumb_flags_test.go')
-rw-r--r--compiler_wrapper/thumb_flags_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler_wrapper/thumb_flags_test.go b/compiler_wrapper/thumb_flags_test.go
index 463ce260..1a1187ac 100644
--- a/compiler_wrapper/thumb_flags_test.go
+++ b/compiler_wrapper/thumb_flags_test.go
@@ -6,13 +6,13 @@ import (
func TestAddThumbFlagForArm(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV7, mainCc)))
if err := verifyArgOrder(cmd, "-mthumb", mainCc); err != nil {
t.Error(err)
}
- cmd = ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd = ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV8, mainCc)))
if err := verifyArgOrder(cmd, "-mthumb", mainCc); err != nil {
t.Error(err)
@@ -22,7 +22,7 @@ func TestAddThumbFlagForArm(t *testing.T) {
func TestOmitThumbFlagForNonArm(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccX86_64, mainCc)))
if err := verifyArgCount(cmd, 0, "-mthumb"); err != nil {
t.Error(err)
@@ -32,13 +32,13 @@ func TestOmitThumbFlagForNonArm(t *testing.T) {
func TestOmitThumbFlagForEabiArm(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV7Eabi, mainCc)))
if err := verifyArgCount(cmd, 0, "-mthumb"); err != nil {
t.Error(err)
}
- cmd = ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd = ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV8Eabi, mainCc)))
if err := verifyArgCount(cmd, 0, "-mthumb"); err != nil {
t.Error(err)
@@ -50,13 +50,13 @@ func TestRemoveNoOmitFramePointerFlagForArm(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
initNoOmitFramePointerConfig(ctx.cfg)
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV7, mainCc)))
if err := verifyArgCount(cmd, 0, "-fno-omit-frame-pointer"); err != nil {
t.Error(err)
}
- cmd = ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd = ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV8, mainCc)))
if err := verifyArgCount(cmd, 0, "-fno-omit-frame-pointer"); err != nil {
t.Error(err)
@@ -68,7 +68,7 @@ func TestKeepNoOmitFramePointerFlagForNonArm(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
initNoOmitFramePointerConfig(ctx.cfg)
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccX86_64, mainCc)))
if err := verifyArgCount(cmd, 1, "-fno-omit-frame-pointer"); err != nil {
t.Error(err)
@@ -80,13 +80,13 @@ func TestKeepNoOmitFramePointerFlagForEabiArm(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
initNoOmitFramePointerConfig(ctx.cfg)
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV7Eabi, mainCc)))
if err := verifyArgCount(cmd, 1, "-fno-omit-frame-pointer"); err != nil {
t.Error(err)
}
- cmd = ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd = ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV8Eabi, mainCc)))
if err := verifyArgCount(cmd, 1, "-fno-omit-frame-pointer"); err != nil {
t.Error(err)
@@ -96,7 +96,7 @@ func TestKeepNoOmitFramePointerFlagForEabiArm(t *testing.T) {
func TestKeepNoOmitFramePointIfGivenByUser(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccArmV7, "-fno-omit-frame-pointer", mainCc)))
if err := verifyArgCount(cmd, 1, "-fno-omit-frame-pointer"); err != nil {
t.Error(err)