Created
February 28, 2010 02:47
-
-
Save clairvy/317135 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PREFIX = a | |
| PSUFFIX = p | |
| TSUFFIX = t | |
| CSUFFIX = .checked | |
| PROJECTS = $(patsubst %,$(PREFIX)%$(PSUFFIX),$(shell android list target | awk '/^id/{print $$2}')) | |
| PROJECT_DIRS = $(patsubst %,%.d,$(PROJECTS)) | |
| TEST_PROJECTS = $(patsubst %$(PSUFFIX),%$(TSUFFIX),$(PROJECTS)) | |
| TEST_PROJECT_DIRS = $(patsubst %,%.d,$(TEST_PROJECTS)) | |
| CHECKS = $(patsubst %$(PSUFFIX),%$(CSUFFIX),$(PROJECTS)) | |
| check : $(CHECKS) | |
| head $^ | |
| $(PREFIX)%$(CSUFFIX) : $(PREFIX)%$(TSUFFIX) | |
| ( cd $^.d && ant run-tests ) 2>&1 | tee $^.log | egrep 'BUILD FAILED' > $@; true | |
| $(PREFIX)%$(TSUFFIX) : $(PREFIX)%$(PSUFFIX) | |
| [email protected]; \ | |
| pd=`echo $$td|sed -e 's/$(TSUFFIX)./$(PSUFFIX)./'`; \ | |
| rm -rf $$td; \ | |
| mkdir $$td && \ | |
| ( cd $$td && android create test-project --path . --main ../$$pd ) > [email protected] 2> [email protected] && \ | |
| touch $@ | |
| $(PREFIX)%$(PSUFFIX) : | |
| [email protected]; \ | |
| t=`echo $@|sed -e 's/^$(PREFIX)//;s/$(PSUFFIX)$$//'`; \ | |
| rm -rf $$pd; \ | |
| mkdir $$pd && \ | |
| android create project --target $$t --path $$pd --activity AaaActivity --package cla.irvy > [email protected] 2> [email protected] && \ | |
| touch $@ | |
| check-emulator : | |
| adb devices | egrep 'emulator-' | egrep 'device' 2>&1 > /dev/null | |
| clean : | |
| $(RM) $(RMF) $(PROJECTS) $(TEST_PROJECTS) $(CHECKS) | |
| $(RM) $(RMF) -r $(PROJECT_DIRS) $(TEST_PROJECT_DIRS) | |
| $(RM) $(RMF) *.log *.err |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| prefix=a | |
| p_suffix=p | |
| t_suffix=t | |
| # functions | |
| ee() { | |
| echo "$@" | |
| eval "$@" | |
| } | |
| # checks | |
| adb devices | egrep 'emulator-' | egrep 'device' 2>&1 > /dev/null | |
| ret=$? | |
| if [ $ret != 0 ]; then | |
| echo "you must execute emulator" | |
| fi | |
| for target in `android list target | awk '/^id/{print $2}'`; do | |
| echo $target | |
| project_dir="$prefix$target$p_suffix" | |
| test_project_dir="$prefix$target$t_suffix" | |
| if [ ! -d $project_dir ]; then | |
| mkdir $project_dir; | |
| cmd="android create project --target $target --path $project_dir --activity AaaActivity --package cla.irvy" | |
| ee $cmd | |
| fi | |
| if [ ! -d $test_project_dir ]; then | |
| mkdir $test_project_dir; | |
| cmd="( cd $test_project_dir && android create test-project --path . --main ../$project_dir )" | |
| ee $cmd | |
| fi | |
| cmd="( cd $test_project_dir && ant run-tests )" | |
| ee $cmd | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Test::More qw(no_plan); | |
| { | |
| my @emulators = grep {m/device$/} grep {m/emulator-/} `adb devices 2>&1`; | |
| unless (@emulators > 0) { | |
| die("you must execute emulator"); | |
| } | |
| my @targets = map {(split)[1]} grep {/^id/} (`android list target`); | |
| my $prefix = 'a'; | |
| my $project_suffix = 'p'; | |
| my $test_project_suffix = 't'; | |
| foreach my $t (@targets) { | |
| my $project_dir = $prefix . $t . $project_suffix; | |
| my $test_project_dir = $prefix . $t . $test_project_suffix; | |
| unless (-d $project_dir) { | |
| mkdir($project_dir); | |
| system("android create project --target $t --path $project_dir --activity AaaActivity --package cla.irvy 2>&1 > $project_dir.log"); | |
| } | |
| unless (-d $test_project_dir) { | |
| mkdir($test_project_dir); | |
| system("( cd $test_project_dir && android create test-project --path . --main ../$project_dir ) 2>&1 > $test_project_dir.log"); | |
| } | |
| my $log_fname = "$test_project_dir.test.log"; | |
| system("( cd $test_project_dir && ant run-tests 2>&1 ) > $log_fname"); | |
| my $result = `grep BUILD $log_fname`; | |
| chomp($result); | |
| my $expect = 'BUILD SUCCESSFUL'; | |
| is($result, $expect, "test target id=$t"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment