From 32ca64706725aee0fbb747a60d1083f9b4a05028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Fri, 18 Oct 2013 12:43:27 +0300 Subject: Enabling CI usage for runtests_androiddeployqt.pl - Fixed issues when having multiple devices connected at the same time. - Fixed hard coded paths - Removed not existing function call, which caused test run to exit too early. - Added possibility to add and connect to device, configured as env variable. Task-number: QTQAINFRA-641 Change-Id: I8c1e003ce4ffbc9fdd9572dc55eef8fe92330cba Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/android/runtests_androiddeployqt.pl | 29 ++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl index 7940653176..d3c9a7bc11 100755 --- a/tests/auto/android/runtests_androiddeployqt.pl +++ b/tests/auto/android/runtests_androiddeployqt.pl @@ -60,8 +60,11 @@ my $man = 0; my $help = 0; my $make_clean = 0; my $time_out=400; +my $android_toolchain_version = "4.8"; +my $host_arch = "linux-x86"; my $android_sdk_dir = "$ENV{'ANDROID_SDK_ROOT'}"; my $android_ndk_dir = "$ENV{'ANDROID_NDK_ROOT'}"; +my $android_to_connect = "$ENV{'ANDROID_DEVICE'}"; my $ant_tool = `which ant`; chomp $ant_tool; my $strip_tool=""; @@ -74,6 +77,8 @@ GetOptions('h|help' => \$help , 'j|jobs=i' => \$jobs , 'sdk=s' => \$android_sdk_dir , 'ndk=s' => \$android_ndk_dir + , 'toolchain=s' => \$android_toolchain_version + , 'host=s' => \$host_arch , 'ant=s' => \$ant_tool , 'strip=s' => \$strip_tool , 'readelf=s' => \$readelf_tool @@ -83,14 +88,29 @@ pod2usage(1) if $help; pod2usage(-verbose => 2) if $man; my $adb_tool="$android_sdk_dir/platform-tools/adb"; + +# For CI. Nodes are connecting to test devices over IP, which is stored to env variable +if ($android_to_connect ne ""){ + print " Found device to be connected from env: $android_to_connect \n"; + system("$adb_tool disconnect $android_to_connect"); + system("$adb_tool connect $android_to_connect"); + sleep(2);# let it connect + system("$adb_tool -s $android_to_connect reboot &");# adb bug, it blocks forever + sleep(15); # wait for the device to come up again + system("$adb_tool disconnect $android_to_connect");# cleans up the left adb reboot process + system("$adb_tool connect $android_to_connect"); + $device_serial =$android_to_connect; +} + + system("$adb_tool devices") == 0 or die "No device found, please plug/start at least one device/emulator\n"; # make sure we have at least on device attached -$device_serial = "-s $device_serial" if ($device_serial); $deployqt_device_serial = "--device $device_serial" if ($device_serial); +$device_serial = "-s $device_serial" if ($device_serial); $testsubset="/$testsubset" if ($testsubset); -$strip_tool="$android_ndk_dir/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86/bin/arm-linux-androideabi-strip" unless($strip_tool); -$readelf_tool="$android_ndk_dir/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86/bin/arm-linux-androideabi-readelf" unless($readelf_tool); +$strip_tool="$android_ndk_dir/toolchains/arm-linux-androideabi-$android_toolchain_version/prebuilt/$host_arch/bin/arm-linux-androideabi-strip" unless($strip_tool); +$readelf_tool="$android_ndk_dir/toolchains/arm-linux-androideabi-$android_toolchain_version/prebuilt/$host_arch/bin/arm-linux-androideabi-readelf" unless($readelf_tool); $readelf_tool="$readelf_tool -d -w "; sub dir @@ -174,7 +194,8 @@ sub startTest #wait to stop unless(waitForProcess($packageName,0,$time_out,5)) { - killProcess($packageName); + #killProcess($packageName); + print "Someone should kill $packageName\n"; return 1; } system("$adb_tool $device_serial pull /data/data/$packageName/output.xml $output_dir/$output_file"); -- cgit v1.2.3