OSDN Git Service

Revert "test: Remove icu cleanup hack"
authorColin Cross <ccross@android.com>
Sun, 18 Sep 2016 00:27:24 +0000 (17:27 -0700)
committerColin Cross <ccross@android.com>
Sun, 18 Sep 2016 01:03:51 +0000 (18:03 -0700)
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

runtime/common_runtime_test.cc

index 7234952..5bc4e88 100644 (file)
@@ -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<IcuCleanupFn>(sym);
+  (*icu_cleanup_fn)();
+
   Runtime::Current()->GetHeap()->VerifyHeap();  // Check for heap corruption after the test
 }