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

Building clean repo causes AssertionFailedError after GIO test #145

Closed
Tennessene opened this issue Oct 8, 2024 · 2 comments
Closed

Building clean repo causes AssertionFailedError after GIO test #145

Tennessene opened this issue Oct 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Tennessene
Copy link
Contributor

I have tried to build Java-GI on Ubuntu 24.04 and Fedora 40. I get the same error on each. I also tried multiple Java distributions. I have made sure I have all the required packages.

I get the following error:

> Task :gio:test

StrvArrayTest > testStrvArrayToJava() FAILED
    org.opentest4j.AssertionFailedError at StrvArrayTest.java:31

20 tests completed, 1 failed

Here is what the report says:

org.opentest4j.AssertionFailedError: expected: not equal but was: <>
	at app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
	at app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at app//org.junit.jupiter.api.AssertNotEquals.failEqual(AssertNotEquals.java:277)
	at app//org.junit.jupiter.api.AssertNotEquals.assertNotEquals(AssertNotEquals.java:263)
	at app//org.junit.jupiter.api.AssertNotEquals.assertNotEquals(AssertNotEquals.java:258)
	at app//org.junit.jupiter.api.Assertions.assertNotEquals(Assertions.java:2819)
	at app//io.github.jwharm.javagi.test.gio.StrvArrayTest.testStrvArrayToJava(StrvArrayTest.java:31)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:580)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1597)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1597)

I am quite sure it is something on Java-GI's end as I ran git clone --recurse-submodules https://github.com/jwharm/java-gi.git and ran ./gradlew build right after like the documentation says.

@Tennessene Tennessene changed the title Building clean repo causes AssertionFailedError Building clean repo causes AssertionFailedError after GIO test Oct 8, 2024
@jwharm
Copy link
Owner

jwharm commented Oct 8, 2024

That testcase checks if a C function with return type char*** (an array of String arrays) correctly results in a Java String[][]. The testcases uses the GIO function DesktopAppInfo.search("gnome") because that's literally the only function in the Gir files that returns a char***, and I hoped that a generic text like "gnome" would always return a few results.

To be absolutely sure that the resulting String[][] arrays contain valid strings, the testcase also checks that the strings are not null and at least one of them contains the text "org.gnome". On my machine, it succeeds. But apparently this is not always the case :-)

It's of course a very naughty testcase and it needs to be replaced with a better one, ideally one that is not as dependent on specific results of DesktopAppInfo.search(). Maybe you have any suggestions? Feel free to experiment with the current testcase - see StrvArrayTest.java.

One day I will implement a real regression suite for java-gi that uses the GObject-Introspection test suites (Regress and GIMarshallers).

@jwharm jwharm added the bug Something isn't working label Oct 8, 2024
@Tennessene
Copy link
Contributor Author

Tennessene commented Oct 8, 2024

Okay, now I know exactly what's happening. I will experiment with this tonight or later tomorrow

@jwharm jwharm closed this as completed in e5ec0d3 Dec 2, 2024
jwharm added a commit that referenced this issue Dec 7, 2024
The testcase now uses a much broader search term so it should work on most systems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants