Unverified Commit 7e2c15d6 authored by Gary Qian's avatar Gary Qian Committed by GitHub

Dynamic logcat piping for deferred components test (#93080)

parent 9c1a87e6
...@@ -19,6 +19,7 @@ adb_path=$2 ...@@ -19,6 +19,7 @@ adb_path=$2
# Store the time to prevent capturing logs from previous runs. # Store the time to prevent capturing logs from previous runs.
script_start_time=$($adb_path shell 'date +"%m-%d %H:%M:%S.0"') script_start_time=$($adb_path shell 'date +"%m-%d %H:%M:%S.0"')
script_start_time_seconds=$(date +%s)
$adb_path uninstall "io.flutter.integration.deferred_components_test" $adb_path uninstall "io.flutter.integration.deferred_components_test"
...@@ -32,15 +33,23 @@ java -jar $bundletool_jar_path install-apks --apks=build/app/outputs/bundle/rele ...@@ -32,15 +33,23 @@ java -jar $bundletool_jar_path install-apks --apks=build/app/outputs/bundle/rele
$adb_path shell " $adb_path shell "
am start -n io.flutter.integration.deferred_components_test/.MainActivity am start -n io.flutter.integration.deferred_components_test/.MainActivity
sleep 30
exit exit
" "
$adb_path logcat -d -t "$script_start_time" > build/app/outputs/bundle/release/run_logcat.log while read LOGLINE
echo "" do
if cat build/app/outputs/bundle/release/run_logcat.log | grep -q "Running deferred code"; then if [[ "${LOGLINE}" == *"Running deferred code"* ]]; then
echo "All tests passed." echo "Found ${LOGLINE}"
exit 0 pkill -P $$
fi echo "All tests passed."
cat build/app/outputs/bundle/release/run_logcat.log exit 0
fi
# Timeout if expected log not found
current_time=$(date +%s)
if [[ $((current_time - script_start_time_seconds)) -ge 150 ]]; then
echo "Failure: Deferred component did not load."
exit 1
fi
done < <(adb logcat -T "$script_start_time")
echo "Failure: Deferred component did not load." echo "Failure: Deferred component did not load."
exit 1 exit 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment