Commit b8c34ead authored by Nicolas Geoffray's avatar Nicolas Geoffray Committed by Gerrit Code Review
Browse files

Merge "Revert "Remove double unloading hack""

parents e2cfab50 e9cae495
......@@ -418,6 +418,26 @@ void CommonRuntimeTestImpl::TearDown() {
(*icu_cleanup_fn)();
Runtime::Current()->GetHeap()->VerifyHeap(); // Check for heap corruption after the test
// Manually closing the JNI libraries.
// Runtime does not support repeatedly doing JNI->CreateVM, thus we need to manually clean up the
// dynamic linking loader so that gtests would not fail.
// Bug: 25785594
if (runtime_->IsStarted()) {
{
// We retrieve the handle by calling dlopen on the library. To close it, we need to call
// dlclose twice, the first time to undo our dlopen and the second time to actually unload it.
// See man dlopen.
void* handle = dlopen("libjavacore.so", RTLD_LAZY);
dlclose(handle);
CHECK_EQ(0, dlclose(handle));
}
{
void* handle = dlopen("libopenjdkd.so", RTLD_LAZY);
dlclose(handle);
CHECK_EQ(0, dlclose(handle));
}
}
}
static std::string GetDexFileName(const std::string& jar_prefix, bool host) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment