aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/compiler_wrapper_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/compiler_wrapper_test.go')
-rw-r--r--compiler_wrapper/compiler_wrapper_test.go33
1 files changed, 13 insertions, 20 deletions
diff --git a/compiler_wrapper/compiler_wrapper_test.go b/compiler_wrapper/compiler_wrapper_test.go
index 2cace6e9..79edab6e 100644
--- a/compiler_wrapper/compiler_wrapper_test.go
+++ b/compiler_wrapper/compiler_wrapper_test.go
@@ -253,45 +253,38 @@ func TestCalculateAndroidWrapperPath(t *testing.T) {
}
}
-// If "crash-diagnostics-dir" flag is already provided, only use that flag and don't add a dupe
-func TestCrashDiagPreFlag(t *testing.T) {
+// If "crash-diagnostics-dir" flag is not provided, add one in
+func TestCrashDiagDefault(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
- ctx.cfg.clangFlags = []string{"-fcrash-diagnostics-dir=/build/something/foo"}
ctx.env = []string{
"CROS_ARTIFACTS_TMP_DIR=/tmp/foo",
}
cmd := ctx.must(callCompiler(ctx, ctx.cfg,
ctx.newCommand(clangX86_64, mainCc)))
- if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/build/something/foo"); err != nil {
+
+ // Verify that we added the default flag
+ if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/tmp/foo/toolchain/clang_crash_diagnostics"); err != nil {
t.Error(err)
}
})
}
-// If "crash-diagnostics-dir" flag is already provided, only use that flag and don't add a dupe
-func TestCrashDiagPostFlag(t *testing.T) {
+// If "crash-diagnostics-dir" flag is already provided by the user, only use that flag and don't add a dupe
+func TestCrashDiagUserFlag(t *testing.T) {
withTestContext(t, func(ctx *testContext) {
- ctx.cfg.clangPostFlags = []string{"-fcrash-diagnostics-dir=/build/something/foo"}
ctx.env = []string{
"CROS_ARTIFACTS_TMP_DIR=/tmp/foo",
}
cmd := ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(clangX86_64, mainCc)))
- if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/build/something/foo"); err != nil {
+ ctx.newCommand(clangX86_64, mainCc, "-fcrash-diagnostics-dir=/build/something/foozz")))
+
+ // Verify that user flag is not removed
+ if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/build/something/foozz"); err != nil {
t.Error(err)
}
- })
-}
-// If "crash-diagnostics-dir" flag is not provided, add one in
-func TestCrashDiagDefault(t *testing.T) {
- withTestContext(t, func(ctx *testContext) {
- ctx.env = []string{
- "CROS_ARTIFACTS_TMP_DIR=/tmp/foo",
- }
- cmd := ctx.must(callCompiler(ctx, ctx.cfg,
- ctx.newCommand(clangX86_64, mainCc)))
- if err := verifyArgCount(cmd, 1, "-fcrash-diagnostics-dir=/tmp/foo/toolchain/clang_crash_diagnostics"); err != nil {
+ // Verify that we did not add the default flag
+ if err := verifyArgCount(cmd, 0, "-fcrash-diagnostics-dir=/tmp/foo/toolchain/clang_crash_diagnostics"); err != nil {
t.Error(err)
}
})