Skip to content

Commit

Permalink
Print device logs last
Browse files Browse the repository at this point in the history
Change-Id: I7c94da43cade2cd3f992e57fb715574c2d2afb19
  • Loading branch information
oxve committed Sep 25, 2024
1 parent 922c3b2 commit ebd4cdc
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/actions/on_device_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,26 @@ runs:
sleep 10
# The log files are named by the device lab test driver.
COBALT_ERROR_LOG="webDriverTestLog.ERROR"
COBALT_INFO_LOG="webDriverTestLog.INFO"
COBALT_ERROR_LOG_FILENAME="webDriverTestLog.ERROR"
COBALT_INFO_LOG_FILENAME="webDriverTestLog.INFO"
# This command will fail until the results have been uploaded.
gsutil cp "${GCS_RESULTS_PATH}/${COBALT_ERROR_LOG}" .
gsutil cp "${GCS_RESULTS_PATH}/${COBALT_INFO_LOG}" .
gsutil cp "${GCS_RESULTS_PATH}/${COBALT_ERROR_LOG_FILENAME}" .
gsutil cp "${GCS_RESULTS_PATH}/${COBALT_INFO_LOG_FILENAME}" .
gsutil cp "${GCS_RESULTS_PATH}/${COBALT_XMLS_FILENAME}" .
# Break if all files were downloaded.
if [[ -f "${COBALT_XMLS_FILENAME}" && -f "${COBALT_ERROR_LOG}" && -f "${COBALT_INFO_LOG}" ]]; then
if [[ -f "${COBALT_XMLS_FILENAME}" && -f "${COBALT_ERROR_LOG_FILENAME}" && -f "${COBALT_INFO_LOG_FILENAME}" ]]; then
break
fi
i=$(( ${i} + 1 ))
done
# Print device logs. Might fail if the log file failed to download.
cat ${COBALT_ERROR_LOG}
# Rename log files for archiving to not expose legacy weirdness.
mkdir -p "${COBALT_LOGS_DIR}/${{ matrix.platform }}/"
mv "${COBALT_ERROR_LOG}" "${COBALT_LOGS_DIR}/${{ matrix.platform }}/stderr_${{ matrix.shard }}.log"
mv "${COBALT_INFO_LOG}" "${COBALT_LOGS_DIR}/${{ matrix.platform }}/stdout_${{ matrix.shard }}.log"
cp "${COBALT_ERROR_LOG_FILENAME}" "${COBALT_LOGS_DIR}/${{ matrix.platform }}/stderr_${{ matrix.shard }}.log"
cp "${COBALT_INFO_LOG_FILENAME}" "${COBALT_LOGS_DIR}/${{ matrix.platform }}/stdout_${{ matrix.shard }}.log"
# Prepare unit test results for DataDog upload.
RESULT_PATH=${UNIT_TEST_RESULT_PATH}/${{ matrix.platform }}/${{ matrix.shard }}/
Expand All @@ -162,3 +159,11 @@ runs:
with:
name: unit-test-results
path: ${{ env.UNIT_TEST_RESULT_PATH }}/
- name: Print device logs
if: always()
run: |
if [[ -z "${COBALT_ERROR_LOG}" ]]; then
cat "${GITHUB_WORKSPACE}/test_results/${COBALT_ERROR_LOG}"
else
echo "No device logs found"
fi

0 comments on commit ebd4cdc

Please sign in to comment.