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

Commit efeea1e2 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

"run-ravenwood-tests.sh -r" for running tests in fbr.

- Also fixed the bug where the script stops when diff detests a change.
  (caused by addition of "-e"?)

Bug: 292141694
Flag: TEST_ONLY
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh -s
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh -r
Change-Id: If4be750c1f2cdabe81a7b98240263a18ccc59b87
parent b1deaeea
Loading
Loading
Loading
Loading
+26 −4
Original line number Diff line number Diff line
@@ -17,17 +17,39 @@

set -e

fbr_only=0
while getopts "r" opt; do
case "$opt" in
    r)
        # Only print tests under frameworks/base/ravenwood/
        fbr_only=1
        ;;
    '?')
        exit 1
        ;;
esac
done
shift $(($OPTIND - 1))

in="$OUT/module-info.json"
cache="$OUT/ravenwood-test-list.cached.tmp"
cache_temp="$OUT/ravenwood-test-list.temp.tmp"
cache="$OUT/ravenwood-test-list-fbr${fbr_only}.cached.txt"
cache_temp="${cache}.tmp"

extra_select=""
if (( $fbr_only )) ; then
    extra_select='| select( .value.path.[] | startswith("frameworks/base/ravenwood"))'
fi

if [[ "$in" -nt "$cache" ]] ; then
# If module-info.json or this script itself is newer than the cache file,
# then re-generate it.
if [[ "$in" -nt "$cache" ]] || [[ "$0" -nt "$cache" ]] ; then
    rm -f "$cache_temp" "$cache"

    # First, create to a temp file, and once it's completed, rename it
    # to the actual cache file, so that if the command failed or is interrupted,
    # we don't update the cache.
    jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json" | sort > "$cache_temp"
    jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) '"$extra_select"' | .key' \
            "$OUT/module-info.json" | sort > "$cache_temp"
    mv "$cache_temp" "$cache"
fi

+8 −3
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ dry_run=""
exclude_large_tests=0
atest_opts=""
build_only=0
while getopts "sx:f:dtbLa:" opt; do
list_options=""
while getopts "sx:f:dtbLa:r" opt; do
case "$opt" in
    s)
        # Remove slow tests.
@@ -74,6 +75,10 @@ case "$opt" in
        # exclude large tests
        exclude_large_tests=1
        ;;
    r)
        # only run tests under frameworks/base/ravenwood/
        list_options="$list_options -r"
        ;;
    '?')
        exit 1
        ;;
@@ -82,7 +87,7 @@ done
shift $(($OPTIND - 1))

all_tests=(hoststubgentest tiny-framework-dump-test hoststubgen-invoke-test ravenwood-stats-checker ravenhelpertest)
all_raven_tests=( $( ./list-ravenwood-tests.sh ) )
all_raven_tests=( $( ./list-ravenwood-tests.sh $list_options ) )

all_tests+=( "${all_raven_tests[@]}" )

@@ -144,7 +149,7 @@ done

# Calculate the removed tests.

diff="$(diff  <(echo "${all_tests[@]}" | tr ' ' '\n') <(echo "${targets[@]}" | tr ' ' '\n') | grep -v [0-9] )"
diff="$(diff  <(echo "${all_tests[@]}" | tr ' ' '\n') <(echo "${targets[@]}" | tr ' ' '\n') | grep -v [0-9] || true)"

if [[ "$diff" != "" ]]; then
    echo "Excluded tests:"