diff options
author | 2024-08-29 10:56:08 -0700 | |
---|---|---|
committer | 2024-08-29 11:56:03 -0700 | |
commit | 4ae8009846c5d317979c3139965388c334448c38 (patch) | |
tree | ba058c0323627179f3d734c4aa92b339644dc06d | |
parent | 1688cca7e046095332216b833777673500e175d0 (diff) |
Add all ravenwood tests as presubmit
Fix: 362955568
Test: treehugger
Flag: EXEMPT test mapping change only
Change-Id: If29f7c002f05a4326cb645ddbd1d285d5c50b951
-rw-r--r-- | ravenwood/.gitignore | 1 | ||||
-rw-r--r-- | ravenwood/TEST_MAPPING | 121 | ||||
-rwxr-xr-x | ravenwood/scripts/list-ravenwood-tests.sh | 2 | ||||
-rwxr-xr-x | ravenwood/scripts/update-test-mapping.sh | 82 |
4 files changed, 199 insertions, 7 deletions
diff --git a/ravenwood/.gitignore b/ravenwood/.gitignore new file mode 100644 index 000000000000..751553b3acb9 --- /dev/null +++ b/ravenwood/.gitignore @@ -0,0 +1 @@ +*.bak diff --git a/ravenwood/TEST_MAPPING b/ravenwood/TEST_MAPPING index 7e2ee3e2a052..b73f2359f909 100644 --- a/ravenwood/TEST_MAPPING +++ b/ravenwood/TEST_MAPPING @@ -1,6 +1,3 @@ -// Keep the following two TEST_MAPPINGs in sync: -// frameworks/base/ravenwood/TEST_MAPPING -// frameworks/base/tools/hoststubgen/TEST_MAPPING { "presubmit": [ { "name": "tiny-framework-dump-test" }, @@ -39,12 +36,71 @@ } ], "ravenwood-presubmit": [ + // AUTO-GENERATED-START + // DO NOT MODIFY MANUALLY + // Use scripts/update-test-mapping.sh to update it. { - "name": "RavenwoodMinimumTest", + "name": "AdServicesSharedLibrariesUnitTestsRavenwood", "host": true }, { - "name": "RavenwoodMockitoTest", + "name": "android.test.mock.ravenwood.tests", + "host": true + }, + { + "name": "CarLibHostUnitTest", + "host": true + }, + { + "name": "CarServiceHostUnitTest", + "host": true + }, + { + "name": "CarSystemUIRavenTests", + "host": true + }, + { + "name": "CtsAccountManagerTestCasesRavenwood", + "host": true + }, + { + "name": "CtsAppTestCasesRavenwood", + "host": true + }, + { + "name": "CtsContentTestCasesRavenwood", + "host": true + }, + { + "name": "CtsDatabaseTestCasesRavenwood", + "host": true + }, + { + "name": "CtsGraphicsTestCasesRavenwood", + "host": true + }, + { + "name": "CtsIcuTestCasesRavenwood", + "host": true + }, + { + "name": "CtsInputMethodTestCasesRavenwood", + "host": true + }, + { + "name": "CtsOsTestCasesRavenwood", + "host": true + }, + { + "name": "CtsProtoTestCasesRavenwood", + "host": true + }, + { + "name": "CtsResourcesTestCasesRavenwood", + "host": true + }, + { + "name": "CtsTextTestCasesRavenwood", "host": true }, { @@ -52,12 +108,65 @@ "host": true }, { - "name": "RavenwoodResApkTest", + "name": "FrameworksCoreSystemPropertiesTestsRavenwood", + "host": true + }, + { + "name": "FrameworksCoreTestsRavenwood", + "host": true + }, + { + "name": "FrameworksInputMethodSystemServerTestsRavenwood", + "host": true + }, + { + "name": "FrameworksMockingServicesTestsRavenwood", + "host": true + }, + { + "name": "FrameworksServicesTestsRavenwood", + "host": true + }, + { + "name": "FrameworksUtilTestsRavenwood", + "host": true + }, + { + "name": "InternalTestsRavenwood", + "host": true + }, + { + "name": "PowerStatsTestsRavenwood", "host": true }, { "name": "RavenwoodBivalentTest", "host": true + }, + { + "name": "RavenwoodMinimumTest", + "host": true + }, + { + "name": "RavenwoodMockitoTest", + "host": true + }, + { + "name": "RavenwoodResApkTest", + "host": true + }, + { + "name": "RavenwoodRuntimeTest", + "host": true + }, + { + "name": "RavenwoodServicesTest", + "host": true + }, + { + "name": "SystemUiRavenTests", + "host": true } + // AUTO-GENERATED-END ] } diff --git a/ravenwood/scripts/list-ravenwood-tests.sh b/ravenwood/scripts/list-ravenwood-tests.sh index fb9b823ee93b..05f3fdffdaa7 100755 --- a/ravenwood/scripts/list-ravenwood-tests.sh +++ b/ravenwood/scripts/list-ravenwood-tests.sh @@ -15,4 +15,4 @@ # List all the ravenwood test modules. -jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json" +jq -r 'to_entries[] | select( .value.compatibility_suites | index("ravenwood-tests") ) | .key' "$OUT/module-info.json" | sort diff --git a/ravenwood/scripts/update-test-mapping.sh b/ravenwood/scripts/update-test-mapping.sh new file mode 100755 index 000000000000..b6cf5b857682 --- /dev/null +++ b/ravenwood/scripts/update-test-mapping.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# Copyright (C) 2024 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Update f/b/r/TEST_MAPPING with all the ravenwood tests as presubmit. +# +# Note, before running it, make sure module-info.json is up-to-date by running +# (any) build. + +set -e + +main() { + local script_name="${0##*/}" + local script_dir="${0%/*}" + local test_mapping="$script_dir/../TEST_MAPPING" + local test_mapping_bak="$script_dir/../TEST_MAPPING.bak" + + local header="$(sed -ne '1,/AUTO-GENERATED-START/p' "$test_mapping")" + local footer="$(sed -ne '/AUTO-GENERATED-END/,$p' "$test_mapping")" + + echo "Getting all tests" + local tests=( $("$script_dir/list-ravenwood-tests.sh") ) + + local num_tests="${#tests[@]}" + + if (( $num_tests == 0 )) ; then + echo "Something went wrong. No ravenwood tests detected." 1>&2 + return 1 + fi + + echo "Tests: ${tests[@]}" + + echo "Creating backup at $test_mapping_bak" + cp "$test_mapping" "$test_mapping_bak" + + echo "Updating $test_mapping" + { + echo "$header" + + echo " // DO NOT MODIFY MANUALLY" + echo " // Use scripts/$script_name to update it." + + local i=0 + while (( $i < $num_tests )) ; do + local comma="," + if (( $i == ($num_tests - 1) )); then + comma="" + fi + echo " {" + echo " \"name\": \"${tests[$i]}\"," + echo " \"host\": true" + echo " }$comma" + + i=$(( $i + 1 )) + done + + echo "$footer" + } >"$test_mapping" + + if cmp "$test_mapping_bak" "$test_mapping" ; then + echo "No change detecetd." + return 0 + fi + echo "Updated $test_mapping" + + # `|| true` is needed because of `set -e`. + diff -u "$test_mapping_bak" "$test_mapping" || true + return 0 +} + +main |