aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/stackprotector_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/stackprotector_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/stackprotector_flags_test.go')
-rw-r--r--compiler_wrapper/stackprotector_flags_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler_wrapper/stackprotector_flags_test.go b/compiler_wrapper/stackprotector_flags_test.go
index 1a50a9b0..ab838732 100644
--- a/compiler_wrapper/stackprotector_flags_test.go
+++ b/compiler_wrapper/stackprotector_flags_test.go
@@ -7,7 +7,7 @@ import (
func TestAddStrongStackProtectorFlag(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
initStackProtectorStrongConfig(ctx.cfg)
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccX86_64, mainCc)))
if err := verifyArgOrder(cmd, "-fstack-protector-strong", mainCc); err != nil {
t.Error(err)
@@ -18,7 +18,7 @@ func TestAddStrongStackProtectorFlag(t *testing.T) {
func TestAddNoStackProtectorFlagWhenKernelDefined(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
initStackProtectorStrongConfig(ctx.cfg)
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccX86_64, "-D__KERNEL__", mainCc)))
if err := verifyArgOrder(cmd, "-fno-stack-protector", mainCc); err != nil {
t.Error(err)
@@ -29,7 +29,7 @@ func TestAddNoStackProtectorFlagWhenKernelDefined(t *testing.T) {
func TestOmitNoStackProtectorFlagWhenAlreadyInCommonFlags(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
ctx.cfg.commonFlags = []string{"-fno-stack-protector"}
- 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-stack-protector"); err != nil {
t.Error(err)
@@ -40,7 +40,7 @@ func TestOmitNoStackProtectorFlagWhenAlreadyInCommonFlags(t *testing.T) {
func TestAddStrongStackProtectorFlagForEabiEvenIfNoStackProtectorGiven(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
initStackProtectorStrongConfig(ctx.cfg)
- cmd := ctx.must(calcCompilerCommandAndCompareToOld(ctx, ctx.cfg,
+ cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(gccX86_64Eabi, "-fno-stack-protector", mainCc)))
if err := verifyArgCount(cmd, 1, "-fstack-protector-strong"); err != nil {
t.Error(err)