onnxruntime/tools/ci_build/github/azure-pipelines/templates/android-dump-logs-from-steps.yml
Jian Chen 6c1a3f85a6
Do not allow clearing Android logs if the emulator is not running (#21578)
### Description
Do not allow clearing Android logs if the emulator is not running



### Motivation and Context
Previously the Clearing Android logs step stuck until the pipeline
timeout. If one of the previous steps failed.
2024-08-22 10:18:01 -07:00

33 lines
807 B
YAML

# dumps the Android logs from the given step(s)
parameters:
- name: steps
type: stepList
steps:
- task: CmdLine@2
input:
script: |
if [ -f $(Build.BinariesDirectory)/emulator.pid ]; then
echo "Emulator is running."
echo "##vso[task.setvariable variable=isEmulatorRunning]True"
else
echo "Emulator is not running."
fi
name: Determine if emulator is running
- task: CmdLine@2
inputs:
script: |
python3 tools/python/run_adb.py logcat --clear
displayName: "Clear Android logs"
condition: eq(variables['isEmulatorRunning'], 'True')
- ${{ parameters.steps }}
- task: CmdLine@2
inputs:
script: |
python3 tools/python/run_adb.py logcat -d
displayName: "Dump Android logs"
condition: eq(variables['isEmulatorRunning'], 'True')