| load_generic_config "adb" |
| |
| # We need this for find_gcc and *_include_flags/*_link_flags. |
| load_base_board_description "adb" |
| |
| set_board_info compiler "[find_gcc]" |
| |
| # We need -mandroid. |
| set_board_info cflags "-mandroid" |
| |
| # Currently the dynamic linker does not support weak-references in |
| # shared libraries. So we need to workaround using -static |
| set_board_info ldflags "-mandroid -static" |
| |
| # |
| # load PROG to DEST and run it with ARGS using adb |
| # |
| proc adb_load { dest prog args } { |
| # /sqlite_stmt_journals uses tmpfs. So it is the default place to run |
| # tests to avoid excessive wear of flash. |
| set android_tmp_dir "/sqlite_stmt_journals" |
| |
| if { [llength $args] > 0 } { |
| set pargs [lindex $args 0] |
| } else { |
| set pargs "" |
| } |
| |
| if { [llength $args] > 1 } { |
| set inp "[lindex $args 1]" |
| } else { |
| set inp "" |
| } |
| |
| if ![file exists $prog] then { |
| # We call both here because this should never happen. |
| perror "$prog does not exist in standard_load." |
| verbose -log "$prog does not exist." 3 |
| return "untested" |
| } |
| |
| if [is_remote $dest] { |
| set remotefile "$android_tmp_dir/[file tail $prog].[pid]" |
| set remotefile [remote_download $dest $prog $remotefile] |
| if { $remotefile == "" } { |
| verbose -log "Download of $prog to [board_info $dest name] failed." 3 |
| return "unresolved" |
| } |
| if [board_info $dest exists remote_link] { |
| if [[board_info $dest remote_link] $remotefile] { |
| verbose -log "Couldn't do remote link" |
| # Can't use remote_file delete since /system/bin/rm does not |
| # support -f on Android. |
| remote_exec $dest rm $remotefile |
| return "unresolved" |
| } |
| } |
| set status [remote_exec $dest $remotefile $pargs $inp] |
| remote_exec $dest rm $remotefile |
| } else { |
| set status [remote_exec $dest $prog $pargs $inp] |
| } |
| if { [lindex $status 0] < 0 } { |
| verbose -log "Couldn't execute $prog, [lindex $status 1]" 3 |
| return "unresolved" |
| } |
| set output [lindex $status 1] |
| set status [lindex $status 0] |
| |
| verbose -log "Executed $prog, status $status" 2 |
| if ![string match "" $output] { |
| verbose -log -- "$output" 2 |
| } |
| if { $status == 0 } { |
| return [list "pass" $output] |
| } else { |
| return [list "fail" $output] |
| } |
| } |