diff options
| author | 2024-11-04 17:11:31 +0000 | |
|---|---|---|
| committer | 2024-11-04 17:11:31 +0000 | |
| commit | 6fcc751b9c6522d8d2feb807c3429a661cc51ec5 (patch) | |
| tree | 6b7225d64e4318f68d56a328abeb23409604bb98 | |
| parent | 503ccd3fface1d98254a45614857502b21a624da (diff) | |
| parent | 9fd0c6a7bac5e2adde5488e69d2245a2dcacf900 (diff) | |
Merge "Add exclusion / inclusion filter options to..." into main am: 9fd0c6a7ba
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3326258
Change-Id: Ica586b79ed2cdc3d58f7298aad208787352b9733
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rwxr-xr-x | ravenwood/scripts/run-ravenwood-tests.sh | 85 |
1 files changed, 68 insertions, 17 deletions
diff --git a/ravenwood/scripts/run-ravenwood-tests.sh b/ravenwood/scripts/run-ravenwood-tests.sh index 5d623e0b6c36..672c685aa6d7 100755 --- a/ravenwood/scripts/run-ravenwood-tests.sh +++ b/ravenwood/scripts/run-ravenwood-tests.sh @@ -18,12 +18,38 @@ # Options: # # -s: "Smoke" test -- skip slow tests (SysUI, ICU) +# +# -x PCRE: Specify exclusion filter in PCRE +# Example: -x '^(Cts|hoststub)' # Exclude CTS and hoststubgen tests. +# +# -f PCRE: Specify inclusion filter in PCRE + + +# Regex to identify slow tests, in PCRE +SLOW_TEST_RE='^(SystemUiRavenTests|CtsIcuTestCasesRavenwood)$' smoke=0 -while getopts "s" opt; do +include_re="" +exclude_re="" +smoke_exclude_re="" +dry_run="" +while getopts "sx:f:d" opt; do case "$opt" in s) - smoke=1 + # Remove slow tests. + smoke_exclude_re="$SLOW_TEST_RE" + ;; + x) + # Take a PCRE from the arg, and use it as an exclusion filter. + exclude_re="$OPTARG" + ;; + f) + # Take a PCRE from the arg, and use it as an inclusion filter. + include_re="$OPTARG" + ;; + d) + # Dry run + dry_run="echo" ;; '?') exit 1 @@ -35,21 +61,46 @@ shift $(($OPTIND - 1)) all_tests=(hoststubgentest tiny-framework-dump-test hoststubgen-invoke-test ravenwood-stats-checker) all_tests+=( $(${0%/*}/list-ravenwood-tests.sh) ) -# Regex to identify slow tests, in PCRE -slow_tests_re='^(SystemUiRavenTests|CtsIcuTestCasesRavenwood)$' - -if (( $smoke )) ; then - # Remove the slow tests. - all_tests=( $( - for t in "${all_tests[@]}"; do - echo $t | grep -vP "$slow_tests_re" - done - ) ) -fi +filter() { + local re="$1" + local grep_arg="$2" + if [[ "$re" == "" ]] ; then + cat # No filtering + else + grep $grep_arg -P "$re" + fi +} -run() { - echo "Running: $*" - "${@}" +filter_in() { + filter "$1" } -run ${ATEST:-atest} "${all_tests[@]}" +filter_out() { + filter "$1" -v +} + + +# Remove the slow tests. +targets=( $( + for t in "${all_tests[@]}"; do + echo $t | filter_in "$include_re" | filter_out "$smoke_exclude_re" | filter_out "$exclude_re" + done +) ) + +# Show the target tests + +echo "Target tests:" +for t in "${targets[@]}"; do + echo " $t" +done + +# Calculate the removed tests. + +diff="$(diff <(echo "${all_tests[@]}" | tr ' ' '\n') <(echo "${targets[@]}" | tr ' ' '\n') )" + +if [[ "$diff" != "" ]]; then + echo "Excluded tests:" + echo "$diff" +fi + +$dry_run ${ATEST:-atest} "${targets[@]}" |