xref: /aosp_15_r20/system/apex/libs/libapexsupport/tests/libapexsupport-tests.sh (revision 33f3758387333dbd2962d7edbd98681940d895da)
1#!/usr/bin/env bash
2
3set -e
4
5wait_boot_complete() {
6  while [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do
7    sleep 3
8  done
9}
10
11# make /vendor wriable
12adb root; adb wait-for-device
13wait_boot_complete
14adb remount -R
15adb wait-for-device
16adb root; adb wait-for-device
17wait_boot_complete
18adb remount
19
20# push the apex
21adb push com.android.libapexsupport.tests.apex /vendor/apex
22adb reboot
23adb wait-for-device
24
25# run the test binary
26adb shell /apex/com.android.libapexsupport.tests/bin/libapexsupport-tests
27
28# clean up
29adb root; adb wait-for-device
30wait_boot_complete
31adb remount
32adb shell rm /vendor/apex/com.android.libapexsupport.tests.apex
33adb reboot