Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2017-09-15 11:58:56 -0400
committerThomas Watson2017-09-22 15:38:03 -0400
commit4f955cfb6005d25c944c5efa2ca3acd1c65f83a4 (patch)
tree863f815b28f9dfedf94b3a627d2dd2ff82f826eb
parent9e4b3bc7c2fc56f70504f5bcd25b2bf376e8cfc9 (diff)
downloadrt.equinox.framework-4f955cfb6005d25c944c5efa2ca3acd1c65f83a4.tar.gz
rt.equinox.framework-4f955cfb6005d25c944c5efa2ca3acd1c65f83a4.tar.xz
rt.equinox.framework-4f955cfb6005d25c944c5efa2ca3acd1c65f83a4.zip
This testcase is very heavy. In order to reproduce on my local machine I had to install 40000 bundles in parallel over 500 threads This heavy load also exposed an issue with the bundle file closer because the single thread closing bundles would backup pending removals which ultimately lead to too many files being opened at the same time. A workaround was added to add delays when the pending closures got "too high" to allow the closer thread to catch up. The build machines cannot handle this test, diabled by default. Change-Id: Id157bee4e11f02753e6d7927ee2183519f74c3a9 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rwxr-xr-xbundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java78
1 files changed, 77 insertions, 1 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 5129c9f41..369a32bb4 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
@@ -15,7 +15,7 @@ import java.net.*;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.jar.*;
import javax.net.SocketFactory;
@@ -3094,4 +3094,80 @@ public class SystemBundleTests extends AbstractBundleTests {
}
}
}
+
+ // Disabled because the test is too much for the build machines
+ public void disable_testBundleIDLock() {
+ File config = OSGiTestsActivator.getContext().getDataFile(getName()); //$NON-NLS-1$
+ Map<String, Object> configuration = new HashMap<String, Object>();
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+
+ final Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
+ // should be in the STARTING state
+ assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
+ final BundleContext systemContext = equinox.getBundleContext();
+ assertNotNull("System context is null", systemContext); //$NON-NLS-1$
+ try {
+ equinox.start();
+ } catch (BundleException e) {
+ fail("Failed to start the framework", e); //$NON-NLS-1$
+ }
+ assertEquals("Wrong state for SystemBundle", Bundle.ACTIVE, equinox.getState()); //$NON-NLS-1$
+
+ final int numBundles = 40000;
+ final File[] testBundles;
+ try {
+ testBundles = createBundles(new File(config, "bundles"), numBundles); //$NON-NLS-1$
+ } catch (IOException e) {
+ fail("Unexpected error creating budnles", e); //$NON-NLS-1$
+ throw new RuntimeException();
+ }
+
+ ExecutorService executor = Executors.newFixedThreadPool(500);
+ final List<Throwable> errors = new CopyOnWriteArrayList<Throwable>();
+ try {
+ for (int i = 0; i < testBundles.length; i++) {
+ final File testBundleFile = testBundles[i];
+ executor.execute(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ systemContext.installBundle("file:///" + testBundleFile.getAbsolutePath());
+ } catch (BundleException e) {
+ e.printStackTrace();
+ errors.add(e);
+ }
+ }
+ });
+
+ }
+ } finally {
+ executor.shutdown();
+ try {
+ executor.awaitTermination(600, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ fail("Interrupted.", e);
+ }
+ }
+
+ Assert.assertEquals("Errors found.", Collections.emptyList(), errors);
+ Assert.assertEquals("Wrong number of bundles.", numBundles + 1, systemContext.getBundles().length);
+ try {
+ equinox.stop();
+ } catch (BundleException e) {
+ fail("Unexpected erorr stopping framework", e); //$NON-NLS-1$
+ }
+ try {
+ equinox.waitForStop(10000);
+ } catch (InterruptedException e) {
+ fail("Unexpected interrupted exception", e); //$NON-NLS-1$
+ }
+ assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox.getState()); //$NON-NLS-1$
+ }
+
}

Back to the top