Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: tools/android-sync.sh

Issue 10696048: Add Makefile targets for running tests on Android. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/android-sync.sh
diff --git a/tools/bash-completion.sh b/tools/android-sync.sh
similarity index 51%
copy from tools/bash-completion.sh
copy to tools/android-sync.sh
index 9f65c677317536ae284b29f362e6aa5fce4b88fd..520fa704047130b254067cec090892044653b3a9 100755
--- a/tools/bash-completion.sh
+++ b/tools/android-sync.sh
@@ -26,30 +26,61 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Inspired by and based on:
-# http://src.chromium.org/viewvc/chrome/trunk/src/tools/bash-completion
+# This script pushes android binaries and test data to the device.
+# The first argument can be either "android.release" or "android.debug".
+# The second argument is a relative path to the output directory with binaries.
+# The third argument is the absolute path to the V8 directory on the host.
+# The fourth argument is the absolute path to the V8 directory on the device.
-# Flag completion rule for bash.
-# To load in your shell, "source path/to/this/file".
+ARCH_MODE=$1
+OUTDIR=$2
+HOST_V8=$3
+ANDROID_V8=$4
Jakob Kummerow 2012/07/02 14:25:58 How about a check that all arguments are present,
ulan 2012/07/02 16:18:23 Done.
-v8_source=$(readlink -f $(dirname $BASH_SOURCE)/..)
+function sync_file {
+ local FILE=$1
+ local ANDROID_HASH=`adb shell "md5 $ANDROID_V8/$FILE"`
Jakob Kummerow 2012/07/02 14:25:58 Please use $(...) instead of `...`
ulan 2012/07/02 16:18:23 Done.
+ local HOST_HASH=`md5sum $HOST_V8/$FILE`
Jakob Kummerow 2012/07/02 14:25:58 again $(...) And if you don't want this to fail h
ulan 2012/07/02 16:18:23 Done.
+ if [ "${ANDROID_HASH%% *}" != "${HOST_HASH%% *}" ]
+ then
Jakob Kummerow 2012/07/02 14:25:58 nit: you can put the "then" on the "if"'s line (li
ulan 2012/07/02 16:18:23 Done.
+ adb push $HOST_V8/$FILE $ANDROID_V8/$FILE &> /dev/null
+ fi
+}
-_v8_flag() {
- local cur defines targets
- cur="${COMP_WORDS[COMP_CWORD]}"
- defines=$(cat src/flag-definitions.h \
- | grep "^DEFINE" \
- | grep -v "DEFINE_implication" \
- | sed -e 's/_/-/g')
- targets=$(echo "$defines" \
- | sed -ne 's/^DEFINE-[^(]*(\([^,]*\).*/--\1/p'; \
- echo "$defines" \
- | sed -ne 's/^DEFINE-bool(\([^,]*\).*/--no\1/p'; \
- cat src/d8.cc \
- | grep "strcmp(argv\[i\]" \
- | sed -ne 's/^[^"]*"--\([^"]*\)".*/--\1/p')
- COMPREPLY=($(compgen -W "$targets" -- "$cur"))
- return 0
+function sync_dir {
+ local DIR=$1
+ echo -n "sync to $ANDROID_V8/$DIR"
+ for FILE in `find $HOST_V8/$DIR -type f`
Jakob Kummerow 2012/07/02 14:25:58 again $(...)
ulan 2012/07/02 16:18:23 Done.
+ do
Jakob Kummerow 2012/07/02 14:25:58 nit: again, for consistency with '{', I suggest re
ulan 2012/07/02 16:18:23 Done.
+ local RELATIVE_FILE=${FILE:${#HOST_V8}}
+ sync_file $RELATIVE_FILE
+ echo -n "."
Jakob Kummerow 2012/07/02 14:25:58 How about moving this line into sync_file and remo
ulan 2012/07/02 16:18:23 Done.
+ done
+ echo ""
}
-complete -F _v8_flag -f d8
+echo -n "sync to $ANDROID_V8/$OUTDIR/$ARCH_MODE"
+sync_file $OUTDIR/$ARCH_MODE/cctest
+echo -n "."
+sync_file $OUTDIR/$ARCH_MODE/d8
+echo -n "."
+sync_file $OUTDIR/$ARCH_MODE/preparser
+echo -n "."
+sync_file $OUTDIR/$ARCH_MODE/process
Jakob Kummerow 2012/07/02 14:25:58 I don't think the "process" binary is required for
ulan 2012/07/02 16:18:23 Done.
+echo -n "."
+sync_file $OUTDIR/$ARCH_MODE/shell
Jakob Kummerow 2012/07/02 14:25:58 "shell" is not required.
ulan 2012/07/02 16:18:23 Done.
+echo "."
+echo -n "sync to $ANDROID_V8/tools"
+sync_file tools/consarray.js
+echo -n "."
+sync_file tools/codemap.js
+echo -n "."
+sync_file tools/csvparser.js
+echo -n "."
+sync_file tools/profile.js
+echo -n "."
+sync_file tools/splaytree.js
+echo "."
+sync_dir test/mjsunit
+sync_dir test/preparser
+sync_dir test/stress
Jakob Kummerow 2012/07/02 14:25:58 I don't think test/stress is part of a regular V8
ulan 2012/07/02 16:18:23 Done.
« tools/android-run.py ('K') | « tools/android-run.py ('k') | tools/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698