question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with running Ghidra tests in CI

See original GitHub issue

I setup mirror for the Ghidra, and currently able build Ghidra on Linux and Mac, on public CI. But when I add unit tests and even worse integration tests, I have an problem with running tests in CI environment. I completely understand that this may be not your concern, but maybe you have some advice based on your existing experience with running CI for Ghidra.

Let’s start with running gradlew unitTestReport Here the error messages which generated on Linux

java.lang.IllegalArgumentException: java.net.MalformedURLException: unknown protocol: ghidra
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
java.lang.NoClassDefFoundError: Could not initialize class docking.widgets.table.constrainteditor.EnumConstraintEditor
java.lang.NoClassDefFoundError: Could not initialize class docking.widgets.table.constrainteditor.UnsignedLongRangeConstraintEditor
java.lang.NoClassDefFoundError: Could not initialize class docking.widgets.table.constrainteditor.DoubleValueConstraintEditor
java.lang.NoClassDefFoundError: Could not initialize class docking.widgets.table.constrainteditor.DateRangeConstraintEditor
java.lang.NoClassDefFoundError: Could not initialize class docking.widgets.table.constrainteditor.IntegerRangeConstraintEditor
java.lang.NoClassDefFoundError: Could not initialize class docking.widgets.EmptyBorderButton
java.lang.NoClassDefFoundError: Could not initialize class javax.swing.RepaintManager
java.lang.NoClassDefFoundError: Could not initialize class docking.DockingUtils
java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE
java.awt.AWTError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

java.lang.AssertionError: Failed to parse expected composite (see log)

All except latest one clearly from inability to see X11 server in CI environment. Last one not clear for me since I have to debug that, or at least take a look (not have time yet). What I want to have right now is ability to run tests which does not involved in the UI part. So here my quuestions:

  1. How can I run unit tests without running test which involved in UI. I attempt to run gradew unitTestReport -Djava.awt.headless=true and try to play with many other different combinations without luck. But funny things I found that you have that: https://github.com/NationalSecurityAgency/ghidra/blob/master/gradle/javaTestProject.gradle#L150 ,
  2. Is it possible to make java.awt.headless=false switch configurable somehow? Preferable in a way which easy to change in CI environment?
  3. If I annotate tests which are require to use X11 with some category will this change be accepted by Ghidra? There ~450 tests failing due X11 dependency now. I promise to update documentation to reflect that this is possible, or do any similar activity if this is required to make that happens.
  4. How can I run unit tests just for single project in Ghidra? I assume gradlew unitTestReport -PDB but I it runs tests for Base and other projects, which PDB depends on. This is defeats purpose running tests for single project. This allow me to run less tests in one build. Public build has a limit of 1 hour, but I want to run integration tests as well and they do not fit in that time limit when I simply run gradlew integrationTestReport

These build errors prevent me from at least partial validation of the status of my fork.

Link to build with errors, in case sombody interested: https://codevision.visualstudio.com/Ghidra/_build/results?buildId=10106&view=ms.vss-test-web.build-test-results-tab In case if somebody super-interested here link to build definition: https://github.com/kant2002/ghidra-official/blob/dev/.azure/build.yaml

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
devnoname120commented, Jul 21, 2019

Have you tried using a virtual framebuffer such as Xvfb?

You would do something like this:

Xvfb :99 &
export DISPLAY=:99
0reactions
ryanmkurtzcommented, Jul 30, 2019

K I’ll take a look, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Part Two: Reverse Engineering and Patching with Ghidra
In this post, we will delve into reverse engineering and patching the software using the new open source NSA tool Ghidra, which rivals...
Read more >
Alexander Kostenev / ghidra · GitLab - Sign in
NSA has applied Ghidra SRE capabilities to a variety of problems that involve analyzing malicious code and generating deep insights for SRE analysts...
Read more >
Ghidra: DevGuide.md - Fossies
For running tests in headless mode on Linux, in a CI environment, or in Docker, first do: $ Xvfb :99 -nolisten tcp &...
Read more >
Ghidra
To access the help, press F1 or Help on any menu item or dialog. Visit our Wiki · Issue Tracker. Join the Community....
Read more >
Enhancing Usability Of Malware Analysis Pipelines With ...
length of the program and the run time with python script in Ghidra, which in most of the cases. Datalog beats Python scripts....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found