using ::android::base::Result; using ::android::base::testing::HasValue;
// 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. #ifdefined(__LP64__)
constexpr constchar* kDex2oatBinary = "dex2oat64"; #else
constexpr constchar* kDex2oatBinary = "dex2oat32"; #endif
class Dex2oatCtsTest : public CommonArtTest, public Dex2oatScratchDirs { public: void SetUp() override {
CommonArtTest::SetUp();
Dex2oatScratchDirs::SetUp(android_data_);
}
protected: // Stripped down counterpart to Dex2oatEnvironmentTest::Dex2Oat that only adds // enough arguments for our purposes.
Result<int> Dex2Oat(const std::vector<std::string>& dex2oat_args, std::string* output) {
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. constchar* android_root = getenv("ANDROID_ROOT");
CHECK(android_root != nullptr);
argv.push_back("--android-root=" + std::string(android_root));
// We need dex2oat to actually log things. auto post_fork_fn = []() { return setenv("ANDROID_LOG_TAGS", "*:d", 1) == 0; };
ForkAndExecResult res = ForkAndExec(argv, post_fork_fn, output); if (res.stage != ForkAndExecResult::kFinished) { return ErrnoErrorf("Failed to finish dex2oat invocation '{}'",
android::base::Join(argv, ' '));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.