Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667#!/bin/bashset -euo pipefailcd "$(dirname "$0")/.."lane=${1:?Choose unit, native-host, bench, or inventory.}shiftunset PARCEL_E2E PARCEL_E2E_PREFLIGHT_ONLY PARCEL_BENCH PARCEL_BENCH_SMOKE PARCEL_REALITYcase "$lane" in unit|inventory) unset PARCEL_NATIVE_HOST PARCEL_LOCALIZATION_LANGUAGE PARCEL_LOCALIZATION_SCREENSHOTS parallel=--parallel; check='check-unit' ;; native-host) [[ ${PARCEL_NATIVE_HOST:-0} == 1 ]] || { printf 'Native-host tests require PARCEL_NATIVE_HOST=1.\n' >&2; exit 2; } parallel=--no-parallel; check='check-native' ;; bench) unset PARCEL_NATIVE_HOST PARCEL_LOCALIZATION_LANGUAGE PARCEL_LOCALIZATION_SCREENSHOTS export PARCEL_BENCH_SMOKE=1 parallel=--no-parallel; check='check-bench' ;; *) printf 'Unknown test lane: %s\n' "$lane" >&2; exit 2 ;;esacskip_build=${PARCEL_TEST_SKIP_BUILD:-0}report=${PARCEL_TEST_XUNIT_OUTPUT:-build/junit.xml}if [[ $lane == native-host ]]; then report=${PARCEL_TEST_XUNIT_OUTPUT:-build/junit-native-host.xml}; fiif [[ $lane == bench ]]; then report=${PARCEL_TEST_XUNIT_OUTPUT:-build/junit-bench.xml}; fifilter=while (( $# )); do case "$1" in --skip-build) skip_build=1; shift ;; --parallel|--no-parallel) parallel=$1; shift ;; --filter|--xunit-output) [[ $# -ge 2 && -n $2 ]] || { printf 'Missing value for %s\n' "$1" >&2; exit 2; } if [[ $1 == --filter ]]; then filter=$2; else report=$2; fi shift 2 ;; *) printf 'Unsupported lane argument: %s\n' "$1" >&2; exit 2 ;; esacdoneif [[ $lane == inventory ]]; then [[ -z $filter ]] || { printf 'Inventory cannot narrow the lane partition.\n' >&2; exit 2; } skip_build=0elif [[ $lane != unit && $parallel != --no-parallel ]]; then printf 'Native-host and benchmark tests must run serially.\n' >&2 exit 2fiif [[ $lane != inventory ]]; then mkdir -p "$(dirname "$report")" rm -f "$report"fiwork=$(mktemp -d "${TMPDIR:-/tmp}/parcel-test-lane.XXXXXX")trap 'rm -rf "$work"' EXITif [[ $skip_build != 1 ]]; then Scripts/swift-build.sh --build-tests; fibin=$(swift build --show-bin-path)swift test list --skip-build > "$work/discovered"manifest="Tests/Lanes/$lane.txt"if [[ $lane == inventory ]]; then "$bin/ParcelTestSelection" inventory Tests/Lanes/unit.txt "$work/discovered" '' '' exitfiselection=$("$bin/ParcelTestSelection" select "$manifest" "$work/discovered" "$filter" "$report")status=0if [[ $lane == native-host && ( -n ${PARCEL_LOCALIZATION_LANGUAGE:-} || ${PARCEL_PSEUDO_LOCALIZATION:-0} == 1 ) ]]; then bash Scripts/test-native-runner.sh "$bin" "$parallel" --filter "$selection" --xunit-output "$work/results.xml" || status=$?else swift test --skip-build --disable-xctest "$parallel" --filter "$selection" --xunit-output "$work/results.xml" || status=$?fiif [[ -f $work/results.xml ]]; then cp "$work/results.xml" "$report"; fi(( status == 0 )) || exit "$status""$bin/ParcelTestSelection" "$check" "$manifest" "$work/discovered" "$filter" "$work/results.xml"