From: Colin Cross Date: Sun, 18 Sep 2016 00:27:24 +0000 (-0700) Subject: Revert "test: Remove icu cleanup hack" X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3c73829dbd9993b821171cdfe604d69a8330a20b;p=android-x86%2Fart.git Revert "test: Remove icu cleanup hack" This reverts commit d4b294c14bd4e1654b276b931ee035b895b8e6cd. Without this hack, the gCommonICUDataArray seems to non-deterministically accumulate entries, and sometimes overflows, causing test failures. Bug: 31469648 Test: gdb /data/nativetest64/art/arm64/art_runtime_compiler_tests/reflection_test Change-Id: Ie5a5b7b957de79758a227bfd2919b4cd0155cde8 --- diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index 72349527d..5bc4e8810 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -409,6 +409,15 @@ void CommonRuntimeTestImpl::TearDown() { TearDownAndroidData(android_data_, true); dalvik_cache_.clear(); + // icu4c has a fixed 10-element array "gCommonICUDataArray". + // If we run > 10 tests, we fill that array and u_setCommonData fails. + // There's a function to clear the array, but it's not public... + typedef void (*IcuCleanupFn)(); + void* sym = dlsym(RTLD_DEFAULT, "u_cleanup_" U_ICU_VERSION_SHORT); + CHECK(sym != nullptr) << dlerror(); + IcuCleanupFn icu_cleanup_fn = reinterpret_cast(sym); + (*icu_cleanup_fn)(); + Runtime::Current()->GetHeap()->VerifyHeap(); // Check for heap corruption after the test }