File tree Expand file tree Collapse file tree 2 files changed +29
-32
lines changed
Expand file tree Collapse file tree 2 files changed +29
-32
lines changed Original file line number Diff line number Diff line change @@ -34,22 +34,26 @@ res_file="./$TESTNAME.res"
3434log_info " Rebooting device to ensure adb functionality..."
3535sync
3636sleep 2
37- reboot -f
37+ reboot
3838sleep 30
3939
40+ # Restart adb server
41+ log_info " Restarting adb server..."
42+ adb kill-server
43+ sleep 2
44+ adb start-server
45+ sleep 2
46+
4047# Wait for adb to detect the device (non-blocking, 30s timeout)
4148log_info " Waiting for device to be detected by adb (timeout: 30s)..."
42- WAIT_COUNT=0
43- DEVICE_DETECTED=0
44- while [ $WAIT_COUNT -lt 30 ]; do
45- if adb get-state > /dev/null 2>&1 ; then
46- DEVICE_DETECTED=1
47- log_info " Device detected by adb after ${WAIT_COUNT} s"
48- break
49- fi
50- sleep 1
51- WAIT_COUNT=$(( WAIT_COUNT + 1 ))
52- done
49+
50+ if timeout 30s adb wait-for-device > /dev/null 2>&1 ; then
51+ log_info " Device detected by adb"
52+ else
53+ log_warn " $TESTNAME SKIP: Device not detected by adb within timeout"
54+ echo " SKIP" > " $res_file "
55+ exit 0
56+ fi
5357
5458if [ $DEVICE_DETECTED -eq 0 ]; then
5559 log_warn " $TESTNAME SKIP: Device not detected by adb within timeout"
Original file line number Diff line number Diff line change @@ -40,28 +40,21 @@ sleep 2
4040reboot -f
4141sleep 30
4242
43+ # Restart adb server
44+ log_info " Restarting adb server..."
45+ adb kill-server
46+ sleep 2
47+ adb start-server
48+ sleep 2
49+
4350# Wait for adb to detect the device (non-blocking, 30s timeout)
4451log_info " Waiting for device to be detected by adb (timeout: 30s)..."
45- WAIT_COUNT=0
46- DEVICE_DETECTED=0
47- while [ $WAIT_COUNT -lt 30 ]; do
48- if adb get-state > /dev/null 2>&1 ; then
49- DEVICE_DETECTED=1
50- log_info " Device detected by adb after ${WAIT_COUNT} s"
51- break
52- fi
53- sleep 1
54- WAIT_COUNT=$(( WAIT_COUNT + 1 ))
55- done
56-
57- if [ $DEVICE_DETECTED -eq 0 ]; then
58- if [ " $1 " = " all" ]; then
59- log_warn " ALL_TESTS SKIP: Device not detected by adb within timeout"
60- echo " SKIP" > " ALL_TESTS.res"
61- else
62- log_warn " $1 SKIP: Device not detected by adb within timeout"
63- echo " SKIP" > " $1 .res"
64- fi
52+
53+ if timeout 30s adb wait-for-device > /dev/null 2>&1 ; then
54+ log_info " Device detected by adb"
55+ else
56+ log_warn " $TESTNAME SKIP: Device not detected by adb within timeout"
57+ echo " SKIP" > " $res_file "
6558 exit 0
6659fi
6760
You can’t perform that action at this time.
0 commit comments