diff options
author | 2020-06-26 15:54:16 +0100 | |
---|---|---|
committer | 2020-06-29 14:44:48 +0000 | |
commit | 8c7e219c4b92e8005448be0f9126df80c35ffd0a (patch) | |
tree | 1d0393bbfb74a1e2712ea1cee7f62904a602feac | |
parent | 22831a3e955fcd1afe7cdb5b16d174ba4cc1ab64 (diff) |
Add shebang to the art script.
Because there are still some that don't use bash as login shell.
Also fix /bin symlink in the chroot setup, like in the real root.
Test: Golem-style art invocation with silvermont target
Test: Vogar tests (run-libcore-tests.sh), which use the art script, in
chroot on device
Test: m out/host/linux-x86/bin/art && \
out/host/linux-x86/bin/art -showversion
with shebang "#!/bin/sh" and "#!/usr/bin/posh" (Policy-compliant
Ordinary SHell)
Change-Id: I7445b07f121eaa947e187ab822c7c098d5957f92
-rwxr-xr-x | tools/art | 7 | ||||
-rwxr-xr-x | tools/buildbot-setup-device.sh | 3 | ||||
-rwxr-xr-x | tools/buildbot-teardown-device.sh | 3 |
3 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,4 @@ +#! /bin/sh # Copyright (C) 2011 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +15,11 @@ # This script is used on host and device. It uses a common subset # shell dialect that should work on the host (e.g. bash), and -# Android (e.g. mksh). +# Android (e.g. mksh). Try to switch to bash if the shebang above +# has launched a pessimal shell on host. +if [ -z "$KSH_VERSION" -a -z "$BASH_VERSION" -a -n "$(which bash)" ]; then + exec bash -c ". $0" -- "$@" +fi ###################################### # Functions diff --git a/tools/buildbot-setup-device.sh b/tools/buildbot-setup-device.sh index 54c928a678..b139c4755c 100755 --- a/tools/buildbot-setup-device.sh +++ b/tools/buildbot-setup-device.sh @@ -173,4 +173,7 @@ if [[ -n "$ART_TEST_CHROOT" ]]; then # Create /linkerconfig directory in chroot. adb shell mkdir -p "$ART_TEST_CHROOT/linkerconfig" + + # Create /bin symlink for shebang compatibility. + adb shell ln -s system/bin "$ART_TEST_CHROOT/bin" fi diff --git a/tools/buildbot-teardown-device.sh b/tools/buildbot-teardown-device.sh index e067a701c3..3a75bbdb58 100755 --- a/tools/buildbot-teardown-device.sh +++ b/tools/buildbot-teardown-device.sh @@ -92,6 +92,9 @@ if [[ -n "$ART_TEST_CHROOT" ]]; then fi } + # Remove /bin symlink from chroot. + adb shell rm -f "$ART_TEST_CHROOT/bin" + # Remove /apex from chroot. adb shell rm -rf "$ART_TEST_CHROOT/apex" |