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

Commit 24b6ffb0 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

[Ravenwood] Cache list-ravenwood-tests.sh result

Flag: EXEMPT host test change only
Bug: 292141694
Test: Manual test with `list-ravenwood-tests.sh` and
    `touch $OUT/module-info.json`
Change-Id: I88ca30cc616607b9aa0a1352c1dfb27a057d1f20
parent 2e5d0bfa
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -15,4 +15,20 @@

# List all the ravenwood test modules.

jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json" | sort
set -e

in="$OUT/module-info.json"
cache="$OUT/ravenwood-test-list.cached.tmp"
cache_temp="$OUT/ravenwood-test-list.temp.tmp"

if [[ "$in" -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"
    mv "$cache_temp" "$cache"
fi

cat "$cache"