From b3d1cff1a1623635f800272d83352f98ba9540cd Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Thu, 27 Aug 2020 17:38:02 -0700 Subject: [PATCH] [fuchsia] Add fuchsia_ctl func to test script (flutter/engine#20827) --- .../src/flutter/testing/fuchsia/run_tests.sh | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/engine/src/flutter/testing/fuchsia/run_tests.sh b/engine/src/flutter/testing/fuchsia/run_tests.sh index 4e71fa2ea2..d520bad5a2 100755 --- a/engine/src/flutter/testing/fuchsia/run_tests.sh +++ b/engine/src/flutter/testing/fuchsia/run_tests.sh @@ -17,7 +17,7 @@ # This script also expects a private key available at: # "/etc/botanist/keys/id_rsa_infra". -set -Ee +set -Eex test_timeout_seconds=300 @@ -39,24 +39,31 @@ else echo "Connecting to device $device_name" fi +# Wrapper function to pass common args to fuchsia_ctl. +fuchsia_ctl() { + ./fuchsia_ctl -d $device_name "$@" +} + reboot() { - ./fuchsia_ctl -d $device_name ssh \ - -c "log_listener --dump_logs yes --file /tmp/log.txt" \ + fuchsia_ctl ssh \ --timeout-seconds $ssh_timeout_seconds \ - --identity-file $pkey + --identity-file $pkey \ + -c "log_listener --dump_logs yes --file /tmp/log.txt" # As we are not using recipes we don't have a way to know the location # to upload the log to isolated. We are saving the log to a file to avoid dart # hanging when running the process and then just using printing the content to # the console. - ./fuchsia_ctl -d $device_name ssh \ - -c "cat /tmp/log.txt" \ + fuchsia_ctl ssh \ --timeout-seconds $ssh_timeout_seconds \ - --identity-file $pkey + --identity-file $pkey \ + -c "cat /tmp/log.txt" + echo "$(date) START:REBOOT ----------------------------------------" # note: this will set an exit code of 255, which we can ignore. - ./fuchsia_ctl -d $device_name ssh -c "dm reboot-recovery" \ - --identity-file $pkey || true + fuchsia_ctl ssh \ + --identity-file $pkey \ + -c "dm reboot-recovery" || true echo "$(date) END:REBOOT ------------------------------------------" } @@ -64,13 +71,14 @@ trap reboot EXIT echo "$(date) START:PAVING ------------------------------------------" ssh-keygen -y -f $pkey > key.pub -./fuchsia_ctl -d $device_name pave -i $1 \ +fuchsia_ctl pave \ + -i $1 \ --public-key "key.pub" echo "$(date) END:PAVING --------------------------------------------" echo "$(date) START:WAIT_DEVICE_READY -------------------------------" for i in {1..10}; do - ./fuchsia_ctl -d $device_name ssh \ + fuchsia_ctl ssh \ --identity-file $pkey \ -c "echo up" && break || sleep 15; done @@ -82,7 +90,7 @@ tar -xvzf $2 -C packages 1> /dev/null echo "$(date) END:EXTRACT_PACKAGES ---------------------------------" echo "$(date) START:testing_tests -----------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f testing_tests-0.far \ -t testing_tests \ --identity-file $pkey \ @@ -93,7 +101,7 @@ echo "$(date) DONE:testing_tests ------------------------------------" # TODO(https://github.com/flutter/flutter/issues/61212): Re-enable ParagraphTest # once it passes on Fuchsia. echo "$(date) START:txt_tests ---------------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f txt_tests-0.far \ -t txt_tests \ -a "--gtest_filter=-ParagraphTest.*" \ @@ -107,7 +115,7 @@ echo "$(date) DONE:txt_tests ----------------------------------------" # TODO(https://github.com/flutter/flutter/issues/58211): Re-enable MessageLoop # test once it passes on Fuchsia. echo "$(date) START:fml_tests ---------------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f fml_tests-0.far \ -t fml_tests \ -a "--gtest_filter=-MessageLoop.TimeSensistiveTest_*:FileTest.CanTruncateAndWrite:FileTest.CreateDirectoryStructure" \ @@ -118,7 +126,7 @@ echo "$(date) DONE:fml_tests ----------------------------------------" echo "$(date) START:flow_tests --------------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f flow_tests-0.far \ -t flow_tests \ --identity-file $pkey \ @@ -128,7 +136,7 @@ echo "$(date) DONE:flow_tests ---------------------------------------" echo "$(date) START:runtime_tests -----------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f runtime_tests-0.far \ -t runtime_tests \ --identity-file $pkey \ @@ -137,7 +145,7 @@ echo "$(date) START:runtime_tests -----------------------------------" echo "$(date) DONE:runtime_tests ------------------------------------" echo "$(date) START:ui_tests ----------------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f ui_tests-0.far \ -t ui_tests \ --identity-file $pkey \ @@ -146,7 +154,7 @@ echo "$(date) START:ui_tests ----------------------------------------" echo "$(date) DONE:ui_tests -----------------------------------------" echo "$(date) START:shell_tests -------------------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f shell_tests-0.far \ -t shell_tests \ --identity-file $pkey \ @@ -156,7 +164,7 @@ echo "$(date) DONE:shell_tests --------------------------------------" # TODO(gw280): Enable tests using JIT runner echo "$(date) START:flutter_runner_tests ----------------------------" -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f flutter_aot_runner-0.far \ -f flutter_runner_tests-0.far \ -t flutter_runner_tests \ @@ -165,7 +173,7 @@ echo "$(date) START:flutter_runner_tests ----------------------------" --packages-directory packages # TODO(https://github.com/flutter/flutter/issues/61768): De-flake and re-enable -# ./fuchsia_ctl -d $device_name test \ +# fuchsia_ctl test \ # -f flutter_aot_runner-0.far \ # -f flutter_runner_scenic_tests-0.far \ # -t flutter_runner_scenic_tests \ @@ -173,7 +181,7 @@ echo "$(date) START:flutter_runner_tests ----------------------------" # --timeout-seconds $test_timeout_seconds \ # --packages-directory packages -./fuchsia_ctl -d $device_name test \ +fuchsia_ctl test \ -f flutter_aot_runner-0.far \ -f flutter_runner_tzdata_tests-0.far \ -t flutter_runner_tzdata_tests \