diff options
author | George Burgess IV <gbiv@google.com> | 2020-06-18 20:37:28 -0700 |
---|---|---|
committer | George Burgess <gbiv@chromium.org> | 2020-06-19 03:47:29 +0000 |
commit | 2efe72e635474b402b4cd456f51c0bc5989931aa (patch) | |
tree | decf82fe3fcefc010e789dc721933f71e403b978 /compiler_wrapper | |
parent | 576a953cb1d88d4bb2743199147b2c1899d5091c (diff) | |
download | toolchain-utils-2efe72e635474b402b4cd456f51c0bc5989931aa.tar.gz |
wrapper: print android-llvm@ when using the Android wrapper.
Otherwise, the wrapper might say:
```
Internal error. Please report to chromeos-toolchain@google.com.
```
to Android developers in some cases.
BUG=b:159291805
TEST=`go test`
Change-Id: I9a96068f02a2c6ce5e251c8754e267dfb1a30db1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2252553
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper')
-rw-r--r-- | compiler_wrapper/compiler_wrapper.go | 8 | ||||
-rw-r--r-- | compiler_wrapper/compiler_wrapper_test.go | 13 | ||||
-rw-r--r-- | compiler_wrapper/config.go | 4 |
3 files changed, 23 insertions, 2 deletions
diff --git a/compiler_wrapper/compiler_wrapper.go b/compiler_wrapper/compiler_wrapper.go index a7b87dc0..4c3db14a 100644 --- a/compiler_wrapper/compiler_wrapper.go +++ b/compiler_wrapper/compiler_wrapper.go @@ -239,9 +239,13 @@ func printCompilerError(writer io.Writer, compilerErr error) { if _, ok := compilerErr.(userError); ok { fmt.Fprintf(writer, "%s\n", compilerErr) } else { + emailAccount := "chromeos-toolchain" + if isAndroidConfig() { + emailAccount = "android-llvm" + } fmt.Fprintf(writer, - "Internal error. Please report to chromeos-toolchain@google.com.\n%s\n", - compilerErr) + "Internal error. Please report to %s@google.com.\n%s\n", + emailAccount, compilerErr) } } diff --git a/compiler_wrapper/compiler_wrapper_test.go b/compiler_wrapper/compiler_wrapper_test.go index a132ec5c..52b92f56 100644 --- a/compiler_wrapper/compiler_wrapper_test.go +++ b/compiler_wrapper/compiler_wrapper_test.go @@ -149,6 +149,19 @@ func TestPrintOtherCompilerError(t *testing.T) { } } +func TestPrintOtherCompilerErrorForAndroidLLVM(t *testing.T) { + buffer := bytes.Buffer{} + + oldConfigName := ConfigName + defer func() { ConfigName = oldConfigName }() + + ConfigName = "android" + printCompilerError(&buffer, errors.New("abcd")) + if buffer.String() != "Internal error. Please report to android-llvm@google.com.\nabcd\n" { + t.Errorf("Unexpected string. Got: %s", buffer.String()) + } +} + func TestCalculateAndroidWrapperPath(t *testing.T) { t.Parallel() diff --git a/compiler_wrapper/config.go b/compiler_wrapper/config.go index e82e6b3d..a122b5a2 100644 --- a/compiler_wrapper/config.go +++ b/compiler_wrapper/config.go @@ -70,6 +70,10 @@ func getRealConfig() (*config, error) { return config, nil } +func isAndroidConfig() bool { + return ConfigName == "android" +} + func getConfig(configName string, useCCache bool, useLlvmNext bool, version string) (*config, error) { cfg := config{} switch configName { |