diff options
author | 2024-08-23 21:28:41 +0100 | |
---|---|---|
committer | 2024-08-27 10:08:39 +0000 | |
commit | 581f40f6612a2a2d31e9f91ffe50b7c362490af2 (patch) | |
tree | 2c1de3eeb799681527d13396c7169b3b290c2f14 | |
parent | 951a3d920800fe4363eabf0f60d322e7c135e0c0 (diff) |
Fix selinux failure in art_standalone_dex2oat_cts_tests on S.
Invoke either dex2oat32 or dex2oat64, to avoid the symlink
/apex/com.android.art/bin/dex2oat, which we don't have the sepolicy to
read on S (it was added in https://r.android.com/2063854).
This will also make the test exercise both dex2oat binaries.
Test: atest -a art_standalone_dex2oat_cts_tests
on redfin with SQ3A.220705.003.A1
Bug: 360737799
Change-Id: Iad89615d1e893657a0c2550f581a0b7bab77ee83
-rw-r--r-- | dex2oat/dex2oat_cts_test.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/dex2oat/dex2oat_cts_test.cc b/dex2oat/dex2oat_cts_test.cc index 0b5ee5be7d..15f100e561 100644 --- a/dex2oat/dex2oat_cts_test.cc +++ b/dex2oat/dex2oat_cts_test.cc @@ -19,6 +19,15 @@ namespace art { +// Test the binary with the same bitness as the test. This is also done to avoid +// the symlink /apex/com.android.art/bin/dex2oat, which we don't have selinux +// permission to read on S. +#if defined(__LIB64__) +constexpr const char* kDex2oatBinary = "dex2oat64"; +#else +constexpr const char* kDex2oatBinary = "dex2oat32"; +#endif + class Dex2oatCtsTest : public CommonArtTest, public Dex2oatScratchDirs { public: void SetUp() override { @@ -37,8 +46,8 @@ class Dex2oatCtsTest : public CommonArtTest, public Dex2oatScratchDirs { int Dex2Oat(const std::vector<std::string>& dex2oat_args, std::string* output, std::string* error_msg) { - // This command line should work regardless of bitness, ISA, etc. - std::vector<std::string> argv = {std::string(kAndroidArtApexDefaultPath) + "/bin/dex2oat"}; + std::vector<std::string> argv = {std::string(kAndroidArtApexDefaultPath) + "/bin/" + + kDex2oatBinary}; argv.insert(argv.end(), dex2oat_args.begin(), dex2oat_args.end()); // We must set --android-root. |