diff options
Diffstat (limited to 'compiler_wrapper/disable_werror_flag_test.go')
-rw-r--r-- | compiler_wrapper/disable_werror_flag_test.go | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/compiler_wrapper/disable_werror_flag_test.go b/compiler_wrapper/disable_werror_flag_test.go index 0c43dbe0..592c35ba 100644 --- a/compiler_wrapper/disable_werror_flag_test.go +++ b/compiler_wrapper/disable_werror_flag_test.go @@ -318,6 +318,8 @@ func TestLogWarningsWhenDoubleBuildFails(t *testing.T) { func withForceDisableWErrorTestContext(t *testing.T, work func(ctx *testContext)) { withTestContext(t, func(ctx *testContext) { + ctx.NoteTestWritesToUmask() + ctx.env = []string{"FORCE_DISABLE_WERROR=1"} work(ctx) }) @@ -412,13 +414,21 @@ func TestAndroidDisableWerror(t *testing.T) { // Disable werror ON ctx.cfg.useLlvmNext = true - if !shouldForceDisableWerror(ctx, ctx.cfg) { + if !shouldForceDisableWerror(ctx, ctx.cfg, gccType) { + t.Errorf("disable Werror not enabled for Android with useLlvmNext") + } + + if !shouldForceDisableWerror(ctx, ctx.cfg, clangType) { t.Errorf("disable Werror not enabled for Android with useLlvmNext") } // Disable werror OFF ctx.cfg.useLlvmNext = false - if shouldForceDisableWerror(ctx, ctx.cfg) { + if shouldForceDisableWerror(ctx, ctx.cfg, gccType) { + t.Errorf("disable-Werror enabled for Android without useLlvmNext") + } + + if shouldForceDisableWerror(ctx, ctx.cfg, clangType) { t.Errorf("disable-Werror enabled for Android without useLlvmNext") } }) @@ -426,9 +436,25 @@ func TestAndroidDisableWerror(t *testing.T) { func TestChromeOSNoForceDisableWerror(t *testing.T) { withTestContext(t, func(ctx *testContext) { - if shouldForceDisableWerror(ctx, ctx.cfg) { + if shouldForceDisableWerror(ctx, ctx.cfg, gccType) { t.Errorf("disable Werror enabled for ChromeOS without FORCE_DISABLE_WERROR set") } + + if shouldForceDisableWerror(ctx, ctx.cfg, clangType) { + t.Errorf("disable Werror enabled for ChromeOS without FORCE_DISABLE_WERROR set") + } + }) +} + +func TestChromeOSForceDisableWerrorOnlyAppliesToClang(t *testing.T) { + withForceDisableWErrorTestContext(t, func(ctx *testContext) { + if !shouldForceDisableWerror(ctx, ctx.cfg, clangType) { + t.Errorf("Disable -Werror should be enabled for clang.") + } + + if shouldForceDisableWerror(ctx, ctx.cfg, gccType) { + t.Errorf("Disable -Werror should be disabled for gcc.") + } }) } |