1#!/usr/local/bin/bash
2# Check the test results and set variables for use in later steps.
3
4set -o pipefail -eu
5
6if [[ "$PWD" =~ /ansible_collections/ ]]; then
7    output_path="tests/output"
8else
9    output_path="test/results"
10fi
11
12echo "##vso[task.setVariable variable=outputPath]${output_path}"
13
14if compgen -G "${output_path}"'/junit/*.xml' > /dev/null; then
15    echo "##vso[task.setVariable variable=haveTestResults]true"
16fi
17
18if compgen -G "${output_path}"'/bot/ansible-test-*' > /dev/null; then
19    echo "##vso[task.setVariable variable=haveBotResults]true"
20fi
21
22if compgen -G "${output_path}"'/coverage/*' > /dev/null; then
23    echo "##vso[task.setVariable variable=haveCoverageData]true"
24fi
25