]> git.lizzy.rs Git - rust.git/commitdiff
etc: adb_run_wrapper.sh - fix to clean test (not produce Text File Busy)
authorYoung-il Choi <duddlf.choi@samsung.com>
Sat, 1 Jun 2013 08:27:05 +0000 (17:27 +0900)
committerYoung-il Choi <duddlf.choi@samsung.com>
Sat, 1 Jun 2013 08:28:58 +0000 (17:28 +0900)
src/etc/adb_run_wrapper.sh

index 516c6a9fca32ac61386b9869bc81d3abacc3db0e..68ac6b4242c3e9f4610279195d147b128eca7e58 100755 (executable)
@@ -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