Create a standalone libdexfile external test in CTS for module API
coverage.

Test: m cts cts-tradefed
      cts-tradefed run commandAndExit cts \
        --module art_standalone_libdexfile_external_tests
Bug: 208464252
Change-Id: I8da28e3f052c18575f9e1048f8df678f4fa951a0
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 1e8d4db..bc722d8 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -353,11 +353,10 @@
     ],
 }
 
-art_cc_test {
-    name: "art_libdexfile_external_tests",
+art_cc_defaults {
+    name: "art_libdexfile_external_tests_defaults",
     defaults: [
         "art_module_source_build_defaults",
-        "art_test_defaults",
     ],
     test_suites: ["general-tests"],
     srcs: [
@@ -374,6 +373,42 @@
     ],
 }
 
+// Version of ART gtest `art_libdexfile_external_tests` bundled with the ART APEX on target.
+// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
+art_cc_test {
+    name: "art_libdexfile_external_tests",
+    defaults: [
+        "art_test_defaults",
+        "art_libdexfile_external_tests_defaults",
+    ],
+}
+
+// Standalone version of ART gtest `art_libdexfile_external_tests`, not bundled with the ART APEX on
+// target.
+art_cc_test {
+    name: "art_standalone_libdexfile_external_tests",
+    defaults: [
+        "art_standalone_test_defaults",
+        "art_libdexfile_external_tests_defaults",
+    ],
+
+    // Support multilib variants (using different suffix per sub-architecture), which is needed on
+    // build targets with secondary architectures, as the CTS test suite packaging logic flattens
+    // all test artifacts into a single `testcases` directory.
+    compile_multilib: "both",
+    multilib: {
+        lib32: {
+            suffix: "32",
+        },
+        lib64: {
+            suffix: "64",
+        },
+    },
+
+    test_config_template: ":art-gtests-target-standalone-cts-template",
+    test_suites: ["cts"], // For backed-by API coverage.
+}
+
 // Support library with a C++ API for accessing the libdexfile API for external
 // (non-ART) users.
 //