aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2020-06-22 21:51:35 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-22 21:51:35 +0000
commit524e03e0406aec361fde2aa8eb86772041705bbf (patch)
tree1fcabf14e973dd30eb27c6ee0bee5daaf99ab6c6
parentaf480e6a40c7e1e272d70166a295990f3984de3d (diff)
parent06d9af65e4021f165ae71952d5d274d34af3842a (diff)
downloadtoolchain-utils-llvm-r399163b.tar.gz
Merging 2 commit(s) from Chromium's toolchain-utils am: b8e15db276 am: 06d9af65e4llvm-r399163b
Original change: https://android-review.googlesource.com/c/platform/external/toolchain-utils/+/1343843 Change-Id: Ifd71eceaf1ad8c005c6e1b17cabdd17f5e5c415f
-rw-r--r--compiler_wrapper/compiler_wrapper.go8
-rw-r--r--compiler_wrapper/compiler_wrapper_test.go13
-rw-r--r--compiler_wrapper/config.go4
-rwxr-xr-xcompiler_wrapper/update_compiler_wrapper.sh14
4 files changed, 30 insertions, 9 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 {
diff --git a/compiler_wrapper/update_compiler_wrapper.sh b/compiler_wrapper/update_compiler_wrapper.sh
index 69484308..479b112c 100755
--- a/compiler_wrapper/update_compiler_wrapper.sh
+++ b/compiler_wrapper/update_compiler_wrapper.sh
@@ -21,20 +21,20 @@ sudo cp ../binary_search_tool/bisect_driver.py /usr/bin
echo "/usr/bin/clang_host_wrapper/bisect_driver.py"
# Update the target wrappers
for GCC in cross-x86_64-cros-linux-gnu/gcc cross-armv7a-cros-linux-gnueabihf/gcc cross-aarch64-cros-linux-gnu/gcc; do
- if ! FILES="$(equery f $GCC)"; then
- if equery l "${GCC}" 2>&1 | grep -q "No installed packages"; then
- echo "no $GCC package found; skipping" >&2
+ if ! FILES="$(equery f ${GCC})"; then
+ if [[ $(equery l "${GCC}" 2>&1 | wc -c) -eq 0 ]]; then
+ echo "no ${GCC} package found; skipping" >&2
continue
fi
- # Something went wrong, and the equery above probably diagnosed it.
+ # Something went wrong, and the equery above probably complained about it.
exit 1
fi
./build.py --config=cros.hardened --use_ccache=false --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.noccache
sudo mv ./sysroot_wrapper.hardened.noccache "$(grep sysroot_wrapper.hardened.noccache <<< "${FILES}")"
- echo "$(grep sysroot_wrapper.hardened.noccache <<< "${FILES}")"
+ grep sysroot_wrapper.hardened.noccache <<< "${FILES}"
./build.py --config=cros.hardened --use_ccache=true --use_llvm_next=false --output_file=./sysroot_wrapper.hardened.ccache
sudo mv ./sysroot_wrapper.hardened.ccache "$(grep sysroot_wrapper.hardened.ccache <<< "${FILES}")"
- echo "$(grep sysroot_wrapper.hardened.ccache <<< "${FILES}")"
+ grep sysroot_wrapper.hardened.ccache <<< "${FILES}"
sudo cp ../binary_search_tool/bisect_driver.py "$(grep bisect_driver.py <<< "${FILES}")"
- echo "$(grep bisect_driver.py <<< "${FILES}")"
+ grep bisect_driver.py <<< "${FILES}"
done