diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2020-02-20 15:08:30 -0800 |
---|---|---|
committer | George Burgess <gbiv@chromium.org> | 2020-02-28 17:33:01 +0000 |
commit | ee7e22c6435048f1b37db4d944e3b6f4c65a77e5 (patch) | |
tree | 248a02e46350a6df82cf83403e08475d6de82adf /compiler_wrapper/disable_werror_flag_test.go | |
parent | 2495a9bb06590534a0b873e36285f06f10c107ba (diff) | |
download | toolchain-utils-ee7e22c6435048f1b37db4d944e3b6f4c65a77e5.tar.gz |
Change behavior of doubleBuildWithWNoError for Android
"Double build with -Wno-error" is always on in the Android useLlvmNext
wrapper and always off in the production wrapper. The warnings JSON is
written to $OUT_DIR/warnings_reports.
NFC for the ChromeOS configs.
Originally reviewed in https://android-review.googlesource.com/c/1242126.
BUG=b:149836702
TEST=go test
Change-Id: I5f1a43524772d991b5c64422189643cde61c3826
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2079547
Tested-by: Pirama Arumuga Nainar <pirama@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/disable_werror_flag_test.go')
-rw-r--r-- | compiler_wrapper/disable_werror_flag_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/compiler_wrapper/disable_werror_flag_test.go b/compiler_wrapper/disable_werror_flag_test.go index fb25d193..eb907e6b 100644 --- a/compiler_wrapper/disable_werror_flag_test.go +++ b/compiler_wrapper/disable_werror_flag_test.go @@ -11,6 +11,7 @@ import ( "io" "io/ioutil" "os" + "path" "path/filepath" "strings" "testing" @@ -372,3 +373,46 @@ func TestDoubleBuildWerrorChmodsThingsAppropriately(t *testing.T) { } }) } + +func TestAndroidGetNewWarningsDir(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + outDir := "/foo/bar" + expectedDir := path.Join(outDir, "warnings_reports") + + ctx.env = []string{"OUT_DIR=" + outDir} + ctx.cfg.isAndroidWrapper = true + + // Disable werror ON + ctx.cfg.useLlvmNext = true + dir, ok := getNewWarningsDir(ctx, ctx.cfg) + if !ok || dir != expectedDir { + t.Errorf("disable Werror not enabled for Android with useLlvmNext (dirName=%q ok=%t), expectedDir=%q", dir, ok, expectedDir) + } + + // Disable werror OFF + ctx.cfg.useLlvmNext = false + dir, ok = getNewWarningsDir(ctx, ctx.cfg) + if ok || dir != "" { + t.Errorf("disable Werror incorrectly enabled for Android without useLlvmNext (dirName=%q ok=%t)", dir, ok) + } + }) +} + +func TestChromeOSGetNewWarningsDirOn(t *testing.T) { + withForceDisableWErrorTestContext(t, func(ctx *testContext) { + dir, ok := getNewWarningsDir(ctx, ctx.cfg) + if !ok || dir != ctx.cfg.newWarningsDir { + t.Errorf("disable Werror not enabled for ChromeOS with FORCE_DISABLE_WERROR set (dirName=%q ok=%t) expectedDir=%q", dir, ok, ctx.cfg.newWarningsDir) + } + + }) +} + +func TestChromeOSGetNewWarningsDirOff(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + dir, ok := getNewWarningsDir(ctx, ctx.cfg) + if ok || dir != "" { + t.Errorf("disable Werror incorrectly enabled for ChromeOS without FORCE_DISABLE_WERROR set (dirName=%q ok=%t)", dir, ok) + } + }) +} |