Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 464c2d69 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add -R to run all disabled tests to run-ravenwood-tests.sh" into main

parents 19908f58 d6960532
Loading
Loading
Loading
Loading
+44 −26
Original line number Original line Diff line number Diff line
@@ -13,22 +13,18 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.


# Run all the ravenwood tests + hoststubgen unit tests.
#
#
# Major options:
# Run all or selected the ravenwood tests + hoststubgen unit tests.
#
#
#   -s: "Smoke" test -- skip slow tests (SysUI, ICU) and large tests.
# Use -h to see the help.
#
#
#   -x PCRE: Specify exclusion filter in PCRE
#            Example: -x '^(Cts|hoststub)' # Exclude CTS and hoststubgen tests.
#
#   -f PCRE: Specify inclusion filter in PCRE


set -e
set -e
shopt -s nullglob # if a glob matches no file, expands to an empty string.
shopt -s nullglob # if a glob matches no file, expands to an empty string.


# Move to the script's directory
# Move to the script's directory
cd "${0%/*}"
cd "${0%/*}"
my_command="${0##*/}"


# Find the enablement files. This may be an empty list if there's no match.
# Find the enablement files. This may be an empty list if there's no match.
default_enablement_policy=(../texts/enablement-policy-*.txt)
default_enablement_policy=(../texts/enablement-policy-*.txt)
@@ -38,6 +34,26 @@ default_enablement_policy=(../texts/enablement-policy-*.txt)
: ${ROLLING_TF_SUBPROCESS_OUTPUT:=0}
: ${ROLLING_TF_SUBPROCESS_OUTPUT:=0}
export ROLLING_TF_SUBPROCESS_OUTPUT
export ROLLING_TF_SUBPROCESS_OUTPUT



show_help() {
    cat <<EOF

$my_command: Run all or specified ravenwood tests

  Usage:
     $my_command [OPTIONS]
        Run all ravenwood tests and relevant host side tests.

     $my_command [OPTIONS] TEST-MODULE-NAME...
        Run specified test module

  Options:
EOF
    sed -n -e '/OPTIONS-START/,/OPTIONS-END/s/^ *\([a-zA-Z]\)) #/   -\1/p' "$my_command"
    echo
    return
}

smoke=0
smoke=0
include_re=""
include_re=""
exclude_re=""
exclude_re=""
@@ -49,49 +65,49 @@ atest_opts=""
list_options=""
list_options=""
with_tools_tests=1
with_tools_tests=1


while getopts "sx:f:dtbLa:rD" opt; do
while getopts "sx:f:dtbLa:rDRh" opt; do
case "$opt" in
case "$opt" in
    s)
# OPTIONS-START
        # Remove slow tests.
    s) # Remove slow tests
        smoke=1
        smoke=1
        exclude_large_tests=1
        exclude_large_tests=1
        ;;
        ;;
    x)
    x) # Take a PCRE from the arg, and use it as an exclusion filter. Example: -x '^(Cts|hoststub)' # Exclude CTS and hoststubgen tests.
        # Take a PCRE from the arg, and use it as an exclusion filter.
        exclude_re="$OPTARG"
        exclude_re="$OPTARG"
        ;;
        ;;
    f)
    f) # Take a PCRE from the arg, and use it as an inclusion filter.
        # Take a PCRE from the arg, and use it as an inclusion filter.
        include_re="$OPTARG"
        include_re="$OPTARG"
        ;;
        ;;
    d)
    d) # Dry run
        # Dry run
        dry_run="echo"
        dry_run="echo"
        ;;
        ;;
    t)
    t) # Redirect log to terminal
        # Redirect log to terminal
        export RAVENWOOD_LOG_OUT=-
        export RAVENWOOD_LOG_OUT=-
        ;;
        ;;
    a)
    a) # atest options (e.g. "-t")
        # atest options (e.g. "-t")
        atest_opts="$OPTARG"
        atest_opts="$OPTARG"
        ;;
        ;;
    L)
    L) # exclude large tests
        # exclude large tests
        exclude_large_tests=1
        exclude_large_tests=1
        ;;
        ;;
    r)
    r) # only run tests under frameworks/base/ravenwood/
        # only run tests under frameworks/base/ravenwood/
        list_options="$list_options -r"
        list_options="$list_options -r"
        ;;
        ;;
    D)
    D) # Only run device tests under frameworks/base/ravenwood/
        # Run device tests under f/b/r
        list_options="$list_options -D"
        list_options="$list_options -D"
        with_tools_tests=0
        with_tools_tests=0
        ;;
        ;;
    R) # Run disabled tests too
        export RAVENWOOD_RUN_DISABLED_TESTS=1
        ;;
    h) # Show help
        show_help
        exit 0
        ;;
    '?')
    '?')
        exit 1
        exit 1
        ;;
        ;;
# OPTIONS-END
esac
esac
done
done
shift $(($OPTIND - 1))
shift $(($OPTIND - 1))
@@ -199,6 +215,8 @@ for test in $(remove_comments ../texts/experimental-api-allowed-tests.txt); do
    export RAVENWOOD_ENABLE_EXP_API_${test}=1
    export RAVENWOOD_ENABLE_EXP_API_${test}=1
done
done


echo "RAVENWOOD_RUN_DISABLED_TESTS=$RAVENWOOD_RUN_DISABLED_TESTS"

# =========================================================
# =========================================================


run() {
run() {
+65 −0

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Original line Diff line number Diff line
@@ -92,6 +92,8 @@ run_all_commands() {


    run_test "Run with no arguments" run-ravenwood-tests-wrapper
    run_test "Run with no arguments" run-ravenwood-tests-wrapper


    run_test "Help" run-ravenwood-tests-wrapper -h

    run_test "Smoke tests" run-ravenwood-tests-wrapper -s
    run_test "Smoke tests" run-ravenwood-tests-wrapper -s


    run_test "Exclude large tests" run-ravenwood-tests-wrapper -L
    run_test "Exclude large tests" run-ravenwood-tests-wrapper -L
@@ -111,6 +113,8 @@ run_all_commands() {


    ALL_TESTS="DeviceTest1 DeviceTest2" run_test "Run device tests (-D) " run-ravenwood-tests-wrapper -D
    ALL_TESTS="DeviceTest1 DeviceTest2" run_test "Run device tests (-D) " run-ravenwood-tests-wrapper -D


    run_test "Run with disabled tests" run-ravenwood-tests-wrapper -R

    echo "== All commands finished =="
    echo "== All commands finished =="
}
}


+5 −2
Original line number Original line Diff line number Diff line
@@ -20,8 +20,10 @@


set -e
set -e


# Tests that shouldn't be in presubmit.
# Tests that shouldn't be in presubmit:
EXEMPT='^(SystemUiRavenTests|CtsViewTestCasesRavenwood)$'
# - See b/440069724 for CarSystemUIRavenTests and CarLibHostUnitTest
# - RavenwoodUiTest_exp uses experimental APIs, so it shouldn't be executed.
EXEMPT='^(SystemUiRavenTests|CtsViewTestCasesRavenwood|CarSystemUIRavenTests|CarLibHostUnitTest|RavenwoodUiTest_exp)$'


is_car() {
is_car() {
    local module="$1"
    local module="$1"
@@ -90,6 +92,7 @@ main() {
    echo "Updated $test_mapping"
    echo "Updated $test_mapping"


    # `|| true` is needed because of `set -e`.
    # `|| true` is needed because of `set -e`.
    # (Otherwise, this script would fail when there's a diff.)
    diff -u "$test_mapping_bak" "$test_mapping" || true
    diff -u "$test_mapping_bak" "$test_mapping" || true
    return 0
    return 0
}
}