Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2019-04-18 16:07:33 +0000
committerThomas Watson2019-04-18 16:07:33 +0000
commit1671181d2493ef3161a7d2c6838f10e78905b53e (patch)
tree3726e8151cff2b21330fa4e71bc7b0cbe89840d3
parentff70c66be91389ffb10151276725b21683f5fe64 (diff)
downloadrt.equinox.framework-1671181d2493ef3161a7d2c6838f10e78905b53e.tar.gz
rt.equinox.framework-1671181d2493ef3161a7d2c6838f10e78905b53e.tar.xz
rt.equinox.framework-1671181d2493ef3161a7d2c6838f10e78905b53e.zip
Bug 540507 - Improve tests for parallel bundle startI20190419-1800I20190418-1800
Change-Id: I284c75fad586647b67d616eed2d8690ae902608b Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rwxr-xr-xbundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
index 294b3e69f..e04fea889 100755
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
@@ -3578,11 +3578,26 @@ public class SystemBundleTests extends AbstractBundleTests {
}
}
- public void testStartLevelMultiThread() throws IOException, InterruptedException {
+ public void testStartLevelMultiThreadExplicit4() throws IOException, InterruptedException {
+ doTestStartLevelMultiThread(4);
+ }
+
+ public void testStartLevelMultiThreadExplicit1() throws IOException, InterruptedException {
+ doTestStartLevelMultiThread(1);
+ }
+
+ public void testStartLevelMultiThreadAvailableProcessors() throws IOException, InterruptedException {
+ doTestStartLevelMultiThread(0);
+ }
+
+ private void doTestStartLevelMultiThread(int expectedCount) throws IOException, InterruptedException {
File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
Map<String, String> configuration = new HashMap();
configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
- configuration.put(EquinoxConfiguration.PROP_EQUINOX_START_LEVEL_THREAD_COUNT, "5");
+ configuration.put(EquinoxConfiguration.PROP_EQUINOX_START_LEVEL_THREAD_COUNT, String.valueOf(expectedCount));
+ if (expectedCount <= 0) {
+ expectedCount = Runtime.getRuntime().availableProcessors();
+ }
Equinox equinox = null;
final int numBundles = 40;
final File[] testBundleFiles = createBundles(new File(config, "testBundles"), numBundles);
@@ -3617,16 +3632,17 @@ public class SystemBundleTests extends AbstractBundleTests {
});
final CountDownLatch waitForStartLevel = new CountDownLatch(1);
- equinox.adapt(FrameworkStartLevel.class).setStartLevel(5, new FrameworkListener() {
+ equinox.adapt(FrameworkStartLevel.class).setStartLevel(10, new FrameworkListener() {
@Override
public void frameworkEvent(FrameworkEvent event) {
waitForStartLevel.countDown();
}
});
- waitForStartLevel.await(10, TimeUnit.SECONDS);
+ waitForStartLevel.await(20, TimeUnit.SECONDS);
assertEquals("Did not finish start level setting.", 0, waitForStartLevel.getCount());
- assertEquals("Wrong number of start threads.", 5, startingThreads.size());
+ assertEquals("Wrong number of start threads.", expectedCount, startingThreads.size());
+ assertEquals("Wrong number of started bundles.", numBundles, startingBundles.size());
ListIterator<Bundle> itr = startingBundles.listIterator();
while (itr.hasNext()) {

Back to the top