Skip to content

Commit b743721

Browse files
committed
Test
1 parent 20e47ab commit b743721

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/llm-android.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ jobs:
128128
LOGCAT_PID=$!
129129
if [ "$MODEL_PRESET" = "custom" ]; then GRADLE_ARGS="-PmodelPreset=$MODEL_PRESET -PcustomPteUrl=$CUSTOM_PTE_URL -PcustomTokenizerUrl=$CUSTOM_TOKENIZER_URL"; else GRADLE_ARGS="-PmodelPreset=$MODEL_PRESET"; fi
130130
./gradlew connectedCheck $GRADLE_ARGS; TEST_EXIT_CODE=$?
131+
echo "=== Checking for response file ==="
132+
adb shell ls -la /sdcard/Android/data/com.example.executorchllamademo/files/ || echo "Directory not found"
133+
adb shell cat /sdcard/Android/data/com.example.executorchllamademo/files/response.txt || echo "File not found or empty"
131134
adb pull /sdcard/Android/data/com.example.executorchllamademo/files/response.txt /tmp/response.txt || true
132135
kill $LOGCAT_PID || true
133136
exit $TEST_EXIT_CODE

llm/android/LlamaDemo/app/src/androidTest/java/com/example/executorchllamademo/UIWorkflowTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ private boolean waitForModelLoaded(ActivityScenario<MainActivity> scenario, long
249249
/**
250250
* Writes the model response to a file that can be pulled from the device.
251251
* Writes to app's external files directory which is accessible via adb.
252+
* Appends to the file to support multiple test cases.
252253
*/
253254
private void writeResponseToFile(String response) {
254255
try {
@@ -257,7 +258,8 @@ private void writeResponseToFile(String response) {
257258
File externalDir = context.getExternalFilesDir(null);
258259
if (externalDir != null) {
259260
File outputFile = new File(externalDir, "response.txt");
260-
try (FileWriter writer = new FileWriter(outputFile)) {
261+
// Append mode (true) to support multiple test cases
262+
try (FileWriter writer = new FileWriter(outputFile, true)) {
261263
writer.write(response);
262264
}
263265
android.util.Log.i("UIWorkflowTest", "Response written to: " + outputFile.getAbsolutePath());

0 commit comments

Comments
 (0)