diff options
Diffstat (limited to 'tools/buildbot-setup-device.sh')
| -rwxr-xr-x | tools/buildbot-setup-device.sh | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/tools/buildbot-setup-device.sh b/tools/buildbot-setup-device.sh index ad2c59cea5..90d680b7d2 100755 --- a/tools/buildbot-setup-device.sh +++ b/tools/buildbot-setup-device.sh @@ -25,7 +25,39 @@ else verbose=false fi -# Setup as root, as some actions performed here require it. +# Testing on a Linux VM requires special setup. +if [[ -n "$ART_TEST_ON_VM" ]]; then + [[ -d "$ART_TEST_VM_DIR" ]] || { msgfatal "no VM found in $ART_TEST_VM_DIR"; } + $ART_SSH_CMD "true" || { msgerror "no VM (tried \"$ART_SSH_CMD true\""; } + $ART_SSH_CMD " + mkdir $ART_TEST_CHROOT + + mkdir $ART_TEST_CHROOT/apex + mkdir $ART_TEST_CHROOT/bin + mkdir $ART_TEST_CHROOT/data + mkdir $ART_TEST_CHROOT/data/local + mkdir $ART_TEST_CHROOT/data/local/tmp + mkdir $ART_TEST_CHROOT/dev + mkdir $ART_TEST_CHROOT/etc + mkdir $ART_TEST_CHROOT/lib + mkdir $ART_TEST_CHROOT/linkerconfig + mkdir $ART_TEST_CHROOT/proc + mkdir $ART_TEST_CHROOT/sys + mkdir $ART_TEST_CHROOT/system + mkdir $ART_TEST_CHROOT/tmp + + sudo mount -t proc /proc art-test-chroot/proc + sudo mount -t sysfs /sys art-test-chroot/sys + sudo mount --bind /dev art-test-chroot/dev + sudo mount --bind /bin art-test-chroot/bin + sudo mount --bind /lib art-test-chroot/lib + $ART_CHROOT_CMD echo \"Hello from chroot! I am \$(uname -a).\" + " + exit 0 +fi + +# Regular Android device. Setup as root, as some actions performed here require it. +adb version adb root adb wait-for-device @@ -36,7 +68,11 @@ msginfo "Date on device" adb shell date host_seconds_since_epoch=$(date -u +%s) -device_seconds_since_epoch=$(adb shell date -u +%s) + +# Get the device time in seconds, but filter the output as some +# devices emit CRLF at the end of the command which then breaks the +# time comparisons in this script (Hammerhead, MRA59G 2457013). +device_seconds_since_epoch=$(adb shell date -u +%s | tr -c -d '[:digit:]') abs_time_difference_in_seconds=$(expr $host_seconds_since_epoch - $device_seconds_since_epoch) if [ $abs_time_difference_in_seconds -lt 0 ]; then @@ -173,6 +209,8 @@ if [[ -n "$ART_TEST_CHROOT" ]]; then || adb shell mount -o bind /dev "$ART_TEST_CHROOT/dev" adb shell mount | grep -q "^devpts on $ART_TEST_CHROOT/dev/pts type devpts " \ || adb shell mount -o bind /dev/pts "$ART_TEST_CHROOT/dev/pts" + adb shell mount | grep -q " on $ART_TEST_CHROOT/dev/cpuset type cgroup " \ + || adb shell mount -o bind /dev/cpuset "$ART_TEST_CHROOT/dev/cpuset" # Create /apex directory in chroot. adb shell mkdir -p "$ART_TEST_CHROOT/apex" |