File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
examples/demo-apps/android/LlamaDemo Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -82,19 +82,21 @@ phases:
82
82
83
83
post_test :
84
84
commands :
85
- - echo "Wait for the results"
85
+ - echo "Gather LLM benchmark results"
86
86
- |
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
91
96
92
97
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
98
100
99
101
artifacts :
100
102
# By default, Device Farm will collect your artifacts from the $DEVICEFARM_LOG_DIR directory.
You can’t perform that action at this time.
0 commit comments