etc: adb_run_wrapper.sh - fix to clean test (not produce Text File Busy)

This commit is contained in:
Young-il Choi 2013-06-01 17:27:05 +09:00
parent 0521d54ca1
commit c28c495414

View file

@ -1,6 +1,10 @@
#
# usage : adb_run_wrapper [test dir - where test executables exist] [test executable]
#
# Sometimes android shell produce exitcode "1 : Text File Busy"
# Retry after $WAIT seconds, expecting resource cleaned-up
WAIT=10
PATH=$1
if [ -d "$PATH" ]
then
@ -10,14 +14,22 @@ then
if [ ! -z "$RUN" ]
then
shift
while [ -f $PATH/lock ]
L_RET=1
L_COUNT=0
while [ $L_RET -eq 1 ]
do
/system/bin/sleep 1
LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
L_RET=$?
if [ $L_COUNT -gt 0 ]
then
/system/bin/sleep $WAIT
/system/bin/sync
fi
L_COUNT=`expr $L_COUNT+1`
done
/system/bin/touch $PATH/lock
LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
echo $? > $PATH/$RUN.exitcode
/system/bin/rm $PATH/lock
/system/bin/sync
echo $L_RET > $PATH/$RUN.exitcode
fi
fi