Skip to content

Commit

Permalink
Virtual thread debug view tests fix
Browse files Browse the repository at this point in the history
#598

This commit will create a separate java 23 project configuration for
virtual thread debug view tests

Partial fix :
#553
  • Loading branch information
SougandhS authored and jukzi committed Jan 24, 2025
1 parent 8767c15 commit 0239014
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ synchronized void assert23Project() {
jp.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_23);
cfgs.add(createLaunchConfiguration(jp, "Main1"));
cfgs.add(createLaunchConfiguration(jp, "Main2"));
cfgs.add(createLaunchConfiguration(jp, "Main21"));
loaded23 = true;
waitForBuild();
assertNoErrorMarkersExist(jp.getProject());
Expand Down Expand Up @@ -792,7 +791,7 @@ private static void closeIntro(final IWorkbench wb) {
}
}

void handleProjectCreationException(Exception e, String pname, IJavaProject jp) {
protected void handleProjectCreationException(Exception e, String pname, IJavaProject jp) {
StringWriter buf = new StringWriter();
String msg = e.getMessage();
if(msg == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024 IBM Corporation.
* Copyright (c) 2024, 2025 IBM Corporation.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,8 +13,12 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.ui;

import java.util.ArrayList;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.internal.ui.views.console.ProcessConsole;
Expand All @@ -23,8 +27,10 @@
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.debug.core.IJavaBreakpoint;
import org.eclipse.jdt.debug.core.IJavaThread;
import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
import org.eclipse.jdt.debug.tests.TestUtil;
import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants;
import org.eclipse.jdt.internal.debug.core.model.JDIThread;
Expand Down Expand Up @@ -76,7 +82,33 @@ protected void tearDown() throws Exception {

@Override
protected IJavaProject getProjectContext() {
return super.get23Project();
create23Project();
return getJavaProject(TWENTYTHREE_PROJECT_NAME);
}

synchronized void create23Project() {
IJavaProject jp = null;
ArrayList<ILaunchConfiguration> cfgs = new ArrayList<>(1);
try {
jp = createProject(TWENTYTHREE_PROJECT_NAME, JavaProjectHelper.TEST_23_SRC_DIR.toString(), JavaProjectHelper.JAVA_SE_23_EE_NAME, false);
jp.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_23);
jp.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_23);
cfgs.add(createLaunchConfiguration(jp, "Main21"));
waitForBuild();
assertNoErrorMarkersExist(jp.getProject());
} catch (Exception e) {
try {
if (jp != null) {
jp.getProject().delete(true, true, null);
for (int i = 0; i < cfgs.size(); i++) {
cfgs.get(i).delete();
}
}
} catch (CoreException ce) {
// ignore
}
super.handleProjectCreationException(e, TWENTYTHREE_PROJECT_NAME, jp);
}
}

public void testVirtualThreadDebugView() throws Exception {
Expand Down

0 comments on commit 0239014

Please sign in to comment.