Skip to content

Commit c28c495

Browse files
committed
etc: adb_run_wrapper.sh - fix to clean test (not produce Text File Busy)
1 parent 0521d54 commit c28c495

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/etc/adb_run_wrapper.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#
22
# usage : adb_run_wrapper [test dir - where test executables exist] [test executable]
33
#
4+
5+
# Sometimes android shell produce exitcode "1 : Text File Busy"
6+
# Retry after $WAIT seconds, expecting resource cleaned-up
7+
WAIT=10
48
PATH=$1
59
if [ -d "$PATH" ]
610
then
@@ -10,14 +14,22 @@ then
1014
if [ ! -z "$RUN" ]
1115
then
1216
shift
13-
while [ -f $PATH/lock ]
17+
18+
L_RET=1
19+
L_COUNT=0
20+
while [ $L_RET -eq 1 ]
1421
do
15-
/system/bin/sleep 1
22+
LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
23+
L_RET=$?
24+
if [ $L_COUNT -gt 0 ]
25+
then
26+
/system/bin/sleep $WAIT
27+
/system/bin/sync
28+
fi
29+
L_COUNT=`expr $L_COUNT+1`
1630
done
17-
/system/bin/touch $PATH/lock
18-
LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
19-
echo $? > $PATH/$RUN.exitcode
20-
/system/bin/rm $PATH/lock
21-
/system/bin/sync
31+
32+
echo $L_RET > $PATH/$RUN.exitcode
33+
2234
fi
2335
fi

0 commit comments

Comments
 (0)