From 2efe72e635474b402b4cd456f51c0bc5989931aa Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Thu, 18 Jun 2020 20:37:28 -0700 Subject: 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 Tested-by: George Burgess --- compiler_wrapper/compiler_wrapper.go | 8 ++++++-- compiler_wrapper/compiler_wrapper_test.go | 13 +++++++++++++ compiler_wrapper/config.go | 4 ++++ 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'compiler_wrapper') 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 { -- cgit v1.2.3