From ad48b2ffd8b2e03cd6268ea18b9744148f525694 Mon Sep 17 00:00:00 2001 From: Norbert Runge Date: Mon, 26 Jun 2017 16:30:38 +0000 Subject: [PATCH] ICU-13239 moves to its own file a currently disabled test and re-enable test. X-SVN-Rev: 40215 --- .../icu/dev/test/format/MeasureUnitTest.java | 28 ----------------- .../test/format/MeasureUnitThreadTest.java | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitThreadTest.java diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java index ddfd80c95ca..14de333161e 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java @@ -241,34 +241,6 @@ public class MeasureUnitTest extends TestFmwk { } } - /** - * @author markdavis - * - */ - // TODO(junit): resolve -// public static void main(String[] args) { -// //generateConstants(); if (true) return; -// -// // Ticket #12034 deadlock on multi-threaded static init of MeasureUnit. -// // The code below reliably deadlocks with ICU 56. -// // The test is here in main() rather than in a test function so it can be made to run -// // before anything else. -// Thread thread = new Thread() { -// @Override -// public void run() { -// @SuppressWarnings("unused") -// Set measureUnitTypes = MeasureUnit.getAvailableTypes(); -// } -// }; -// thread.start(); -// @SuppressWarnings("unused") -// Currency cur = Currency.getInstance(ULocale.ENGLISH); -// try {thread.join();} catch(InterruptedException e) {}; -// // System.out.println("Done with MeasureUnit thread test."); -// -// new MeasureUnitTest().run(args); -// } - /* @Test public void testZZZ() { diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitThreadTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitThreadTest.java new file mode 100644 index 00000000000..e78f1cbf4de --- /dev/null +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitThreadTest.java @@ -0,0 +1,31 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html#License + +package com.ibm.icu.dev.test.format; + +import org.junit.Test; + +import com.ibm.icu.dev.test.TestFmwk; +import com.ibm.icu.util.Currency; +import com.ibm.icu.util.MeasureUnit; +import com.ibm.icu.util.ULocale; + +public class MeasureUnitThreadTest extends TestFmwk { + + @Test + public void MUThreadTest() { + // Ticket #12034 deadlock on multi-threaded static init of MeasureUnit. + // The code below reliably deadlocks with ICU 56. + // The test is here in its own file so it can be made to run independent of anything else. + Thread thread = new Thread() { + @Override + public void run() { + MeasureUnit.getAvailableTypes(); + } + }; + thread.start(); + Currency.getInstance(ULocale.ENGLISH); + try {thread.join();} catch(InterruptedException e) {}; + } +} +