diff options
author | Rob Savoye <rob@welcomehome.org> | 2013-02-11 11:13:13 -0700 |
---|---|---|
committer | Rob Savoye <rob@welcomehome.org> | 2013-02-11 11:13:13 -0700 |
commit | 33b71e46c0a27fee374a922eb0792b9c618c54a8 (patch) | |
tree | 5ec9678c50a88ce76d3e203204aa809a1bcf59f7 /baseboards | |
parent | 591c924fb7832b6cc16abf35b7d9045d0de2f66b (diff) | |
download | dejagnu-33b71e46c0a27fee374a922eb0792b9c618c54a8.zip dejagnu-33b71e46c0a27fee374a922eb0792b9c618c54a8.tar.gz dejagnu-33b71e46c0a27fee374a922eb0792b9c618c54a8.tar.bz2 |
new support for remote testing on Android.
Diffstat (limited to 'baseboards')
-rw-r--r-- | baseboards/androideabi.exp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/baseboards/androideabi.exp b/baseboards/androideabi.exp new file mode 100644 index 0000000..75e15c7 --- /dev/null +++ b/baseboards/androideabi.exp @@ -0,0 +1,97 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# DejaGnu is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +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] + } +} |