Skip to content

The key name in java.test.config should align with the launch configuraiton #852

@astrelsky

Description

@astrelsky

I have the following defined in my workspace /.vscode/settings.json

"java.test.config": {
        "name": "GhidraTest",
        "vmArgs": ["-Djava.system.class.loader=ghidra.GhidraClassLoader", "-Declipse.project.dir=${workspaceFolder}", "-Dpython.console.encoding=UTF-8", "-Dfile.encoding=UTF8", "-Dlog4j.skipJansi=true", "-Duser.country=US", "-Duser.language=en", "-Dsun.stdout.encoding=UTF-8", "-Dsun.err.encoding=UTF-8", "-Dvisualvm.display.name=Ghidra"]
    }

Upon running a test and explicitly selecting the GhidraTest configuration option the following output is produced. Note the incorrect vmargs. (If args is set they also get ignored.)

Launching with the following launch configuration: '{
  "name": "Launch Java Tests",
  "type": "java",
  "request": "launch",
  "mainClass": "org.eclipse.jdt.internal.junit.runner.RemoteTestRunner",
  "projectName": "Ghidra-Cpp-Class-Analyzer",
  "classPaths": [
    "C:\\Users\\astre\\Documents\\Ghidra-Cpp-Class-Analyzer\\bin\\main",
    "C:\\Users\\astre\\Documents\\Ghidra-Cpp-Class-Analyzer\\bin\\test",
    -snipped- # ghidra jars. .classpath works
    "C:\\Users\\astre\\.vscode-insiders\\extensions\\redhat.java-0.52.0\\server\\config_win\\org.eclipse.osgi\\75\\0\\.cp",
    "C:\\Users\\astre\\.vscode-insiders\\extensions\\redhat.java-0.52.0\\server\\config_win\\org.eclipse.osgi\\46\\0\\.cp"
  ],
  "modulePaths": [],
  "args": [
    "-version",
    "3",
    "-port",
    "58930",
    "-testLoaderClass",
    "org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader",
    "-loaderpluginname",
    "org.eclipse.jdt.junit4.runtime",
    "-test",
    "ghidra.app.cmd.data.rtti.gcc.TypeInfoTest:test",
    "-port",
    "58929",
    "-port",
    "58929"
  ],
  "vmArgs": [
    "-ea"
  ],
  "encoding": "utf8",
  "env": {
    -snipped-
  },
  "console": "internalConsole",
  "noDebug": true
}'
%TESTC  1 v2
%TSTTREE1,test(ghidra.app.cmd.data.rtti.gcc.TypeInfoTest),false,1,false,-1,test(ghidra.app.cmd.data.rtti.gcc.TypeInfoTest),,
%TESTS  1,test(ghidra.app.cmd.data.rtti.gcc.TypeInfoTest)
%ERROR  1,test(ghidra.app.cmd.data.rtti.gcc.TypeInfoTest)
%TRACES 
java.lang.NullPointerException
	at ghidra.app.cmd.data.rtti.gcc.TypeInfoTest.test(TypeInfoTest.java:19)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at generic.test.TestThread.run(TestThread.java:106)
%TRACEE 
%TESTE  1,test(ghidra.app.cmd.data.rtti.gcc.TypeInfoTest)
%RUNTIME6062

The NullPointerException that is causing my test to fail is because the extension points aren't being loaded which I think is because the classloader isn't being set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    engDebts for engineering

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions