Search code examples
javaeclipsejunitwindows-10jna

JUnit Test (w JNA) Silently Failing?


I'm using Java 11, JNA with a DLL on Windows 10 64-bit, JUnit 4.12, Eclipse 20190314-1200, (aka 4.11.0). This is a gradle-based project, but I ran out of tags.

Quite a bit of that may not be relevant, but context never hurts, right?

While running any unit test that touches the DLL in question, the test silently fails, almost immediately. Almost. When I try to step into the goings on, I land in Structure.autoWrite() (the member function, not the static one), and when I step out, poof. The test ends. The call stack looks remarkably like I called autoWrite() directly, though it is actually a native method call. Eclipse's JUnit UI continues to show that test as if it were still running (little blue triangle overlay on the icon), but the tests all stop. JUnit doesn't even try to run any further tests.

I haven't found any logs. Standard out simply shows my last output (the path JNA uses to find DLLs). I got nuthin'.

Does anyone know of a relevant log file (not in user.name/appdata/local/temp, I checked quite thoroughly)? Some configuration I can tweak for more verbose output? Where I can find the JVM exit code maybe? Anything?


Solution

  • The DLL in question wasn't installed properly (by me), and when I first call an initializer function, it logged an error (in an unexpected corner of my hard drive) and called exit(), which is just rude.

    Your DLL shouldn't end my program's process. At least it didn't cause Eclipse to shut down. That would have been... vexing.

    And that was the last hurdle between me and a full suite of passing unit tests. Whew.

    Upward and onward!