| 1 | #!/usr/bin/env bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | yaml_root=/usr/share/rtc-testbench/tests |
| 5 | fallback_root=/usr/share/testbench/tests |
| 6 | |
| 7 | if [[ ! -d "${yaml_root}" ]]; then |
| 8 | if [[ -d "${fallback_root}" ]]; then |
| 9 | yaml_root="${fallback_root}" |
| 10 | else |
| 11 | echo "YAML test directory not found: ${yaml_root} or ${fallback_root}" >&2 |
| 12 | exit 1 |
| 13 | fi |
| 14 | fi |
| 15 | |
| 16 | found=0 |
| 17 | while IFS= read -r -d '' yaml; do |
| 18 | found=1 |
| 19 | python3 - <<'PY' "${yaml}" |
| 20 | import pathlib |
| 21 | import sys |
| 22 | import yaml |
| 23 | |
| 24 | path = pathlib.Path(sys.argv[1]) |
| 25 | yaml.safe_load(path.read_text()) |
| 26 | PY |
| 27 | done < <(find "${yaml_root}" -name '*.yaml' -print0) |
| 28 | |
| 29 | if [[ "${found}" -eq 0 ]]; then |
| 30 | echo "No YAML files found under ${yaml_root}." >&2 |
| 31 | exit 1 |
| 32 | fi |