config/adb.exp: Add adb_file so we can remotely delete test case to save on limited...
authorRob Savoye <rob@welcomehome.org>
Sat, 16 Feb 2013 20:05:35 +0000 (13:05 -0700)
committerRob Savoye <rob@welcomehome.org>
Sat, 16 Feb 2013 20:05:35 +0000 (13:05 -0700)
ChangeLog
config/adb.exp

index 609dc6c..01f30c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-02-16  Rob Savoye  <rob@build.welcomehome.org>
+
+       * config/adb.exp: Add adb_file so we can remotely delete test
+       cases to save on limited disk space. Don't remove the file after
+       executing it, leave that for the test driver instead.
+
 2013-02-15  Rob Savoye  <rob@welcomehome.org>
 
        * config/adb.exp: Remove the test case after executing
index b2f8a86..a679e6a 100644 (file)
 # along with DejaGnu; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# If true, all testcases onthe host target are deleted after being executed
-# to save disk space.
-set remove_test true
-
 #
 # Get serial number in case of multiple devices
 #
@@ -117,6 +113,20 @@ proc adb_download {desthost srcfile destfile} {
     }
 }
 
+proc adb_file {dest op args} {
+    set file [lindex $args 0]
+    verbose "Executing command: $op $args" 2
+    switch $op {
+       exists {
+           set status [catch "exec adb [adb_serial] shell ls |& cat" out]
+       }
+       delete {
+           set status [catch "exec adb [adb_serial] shell rm $file |& cat" rmout]
+       }
+    }
+    return [eval remote_raw_file \"$dest\" \"$op\" $args]
+}
+
 proc adb_upload {desthost srcfile destfile} {
     set status [catch "exec adb [adb_serial] pull $srcfile $destfile" output]
     if { $status == 0 } {
@@ -157,11 +167,6 @@ proc adb_exec { boardname cmd args } {
 
     set status [catch "exec cat $inp | adb [adb_serial] shell \( $cmd $pargs \) \\; echo XYZ\\\$\\\{\?\\\}ZYX |& cat" output]
 
-    if { $remove_test == true} {
-       verbose "Removing test executable: $cmd" 2
-       set status [catch "exec adb [adb_serial] shell rm $cmd |& cat" rmout]
-    }
-
     # `status' doesn't mean much here other than adb worked ok.
     # What we want is whether $cmd ran ok.
     if { $status != 0 } {