Dynamic logcat piping for deferred components test (#93080)
This commit is contained in:
parent
9c1a87e627
commit
7e2c15d6f5
@ -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
|
|||||||
|
|
||||||
$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 "Found ${LOGLINE}"
|
||||||
|
pkill -P $$
|
||||||
echo "All tests passed."
|
echo "All tests passed."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
cat build/app/outputs/bundle/release/run_logcat.log
|
# 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user