Skip to content

Commit 1b60eb1

Browse files
committed
Echo the results back
1 parent 94c1231 commit 1b60eb1

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

examples/demo-apps/android/LlamaDemo/android-llm-device-farm-test-spec.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ phases:
8282
8383
post_test:
8484
commands:
85-
- echo "Wait for the results"
85+
- echo "Gather LLM benchmark results"
8686
- |
87-
# TODO (huydhn): Polling like this looks brittle, figure out if there is a better way to wait
88-
# for the benchmark results
89-
adb -s $DEVICEFARM_DEVICE_UDID shell run-as com.example.executorchllamademo \
90-
while ! test -f files/benchmark_results.json; do echo "Waiting for benchmark results..."; sleep 30; done
87+
BENCHMARK_RESULTS=""
88+
ATTEMPT=0
89+
MAX_ATTEMPT=10
90+
while [ -z "${BENCHMARK_RESULTS}" ] && [ $ATTEMPT -lt $MAX_ATTEMPT ]; do
91+
echo "Waiting for benchmark results..."
92+
BENCHMARK_RESULTS=$(adb -s $DEVICEFARM_DEVICE_UDID shell run-as com.example.executorchllamademo cat files/benchmark_results.json)
93+
sleep 30
94+
((ATTEMPT++))
95+
done
9196
9297
adb -s $DEVICEFARM_DEVICE_UDID shell run-as com.example.executorchllamademo ls -la files/
93-
94-
- echo "Gather LLM benchmark results"
95-
- |
96-
adb -s $DEVICEFARM_DEVICE_UDID shell run-as com.example.executorchllamademo cp files/benchmark_results.json /sdcard
97-
adb -s $DEVICEFARM_DEVICE_UDID pull /sdcard/benchmark_results.json $DEVICEFARM_LOG_DIR/
98+
# Trying to pull the file using adb ends up with permission error, but his works too, so why not
99+
echo "${BENCHMARK_RESULTS}" > $DEVICEFARM_LOG_DIR/benchmark_results.json
98100
99101
artifacts:
100102
# By default, Device Farm will collect your artifacts from the $DEVICEFARM_LOG_DIR directory.

0 commit comments

Comments
 (0)