Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not run link handler registration in test execution #2306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void initialize(IWorkbenchConfigurer configurer) {
jfaceComparatorIsSet = true;
}

if (!Platform.inDevelopmentMode()) {
if (!Platform.inDevelopmentMode() && !JUnitTestUtil.isJunitTestRunning()) {
new AutoRegisterSchemeHandlersJob().schedule();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright (c) 2024 SAP SE.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Matthias Becker / Sebastian Ratz - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.internal.ide.application;

import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.ServiceCaller;
import org.eclipse.osgi.service.environment.EnvironmentInfo;

public class JUnitTestUtil {
private static Boolean cachedIsJunitTestRunning = null;

public static boolean isJunitTestRunning() {
if (cachedIsJunitTestRunning == null) {
try {
if (Platform.isRunning()) {
AtomicBoolean result = new AtomicBoolean();
cachedIsJunitTestRunning = ServiceCaller.callOnce(JUnitTestUtil.class, EnvironmentInfo.class, envInfo -> {
String application = envInfo.getProperty("eclipse.application"); //$NON-NLS-1$
result.set(application != null && Set.of( //
// see org.eclipse.pde.internal.launching.IPDEConstants
"org.eclipse.pde.junit.runtime.nonuithreadtestapplication", // //$NON-NLS-1$
Copy link
Contributor Author

@BeckerWdf BeckerWdf Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sratz: from the i-build's log
https://download.eclipse.org/eclipse/downloads/drops4/I20240923-1800/testresults/ep434I-unit-mac64-java17_macosx.cocoa.x86_64_17/org.eclipse.debug.tests.AutomatedSuite.txt
i see
Framework arguments: -application org.eclipse.test.uitestapplication formatter=...
So it looks like org.eclipse.test.uitestapplication is used. Is it missing in this list?

"org.eclipse.pde.junit.runtime.uitestapplication", // //$NON-NLS-1$
"org.eclipse.pde.junit.runtime.coretestapplication", // //$NON-NLS-1$
// see org.eclipse.tycho.surefire.AbstractTestMojo
"org.eclipse.tycho.surefire.osgibooter.uitest", //$NON-NLS-1$
"org.eclipse.tycho.surefire.osgibooter.headlesstest") // //$NON-NLS-1$
.contains(application));
});
cachedIsJunitTestRunning = result.get();
} else {
cachedIsJunitTestRunning = true; // probably
}
} catch (Throwable t) {
// log
cachedIsJunitTestRunning = false;
}
}

return cachedIsJunitTestRunning;
}

}
Loading