Skip to content

Commit e9d3e55

Browse files
committed
fix tests
1 parent 2048278 commit e9d3e55

3 files changed

Lines changed: 27 additions & 28 deletions

File tree

.github/workflows/test.yaml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
- name: Update Package Information
88
run: sudo apt-get update
99
- name: Install Dependencies
10-
run: sudo apt-get install -y xvfb mesa-utils libgl1-mesa-dri
10+
run: sudo apt-get install -y xvfb mesa-utils libgl1-mesa-dri libglx-mesa0 libxrender-dev libx11-dev libxext-dev
1111
- uses: actions/checkout@v6
1212
- name: Set up JDK 21
1313
uses: actions/setup-java@v5
@@ -21,17 +21,29 @@ jobs:
2121
export DISPLAY=":99"
2222
export GALLIUM_DRIVER="llvmpipe"
2323
export LIBGL_ALWAYS_SOFTWARE="1"
24-
# Start Xvfb
24+
export LIBGL_DEBUG="verbose"
25+
# Start Xvfb with GLX support
2526
echo "Starting Xvfb"
26-
Xvfb :99 -ac -screen 0 "$XVFB_WHD" -nolisten tcp +extension GLX +render -noreset &
27+
Xvfb :99 -ac -screen 0 "$XVFB_WHD" -nolisten tcp +extension GLX +extension RENDER -noreset > /tmp/xvfb.log 2>&1 &
2728
Xvfb_pid="$!"
2829
echo "Waiting for Xvfb (PID: $Xvfb_pid) to be ready..."
29-
while ! xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; do
30-
sleep 0.1
30+
sleep 2
31+
for i in {1..30}; do
32+
if xdpyinfo -display "${DISPLAY}" > /dev/null 2>&1; then
33+
echo "Xvfb is running."
34+
break
35+
fi
36+
sleep 0.5
3137
done
32-
echo "Xvfb is running."
38+
39+
# Verify GLX works
40+
glxinfo -display :99 2>&1 | head -20 || echo "glxinfo not available, continuing anyway"
3341
3442
./gradlew --no-daemon test
43+
44+
# Clean up Xvfb
45+
kill $Xvfb_pid 2>/dev/null || true
46+
cat /tmp/xvfb.log || true
3547
- name: Upload Images
3648
uses: actions/upload-artifact@v4
3749
with:
@@ -69,22 +81,4 @@ jobs:
6981
path: |
7082
target/*.png
7183
build/**/*.png
72-
test-macos:
73-
runs-on: macos-latest
74-
steps:
75-
- uses: actions/checkout@v6
76-
- name: Set up JDK 21
77-
uses: actions/setup-java@v5
78-
with:
79-
java-version: 21
80-
distribution: 'temurin'
81-
cache: gradle
82-
- name: Build with Gradle
83-
run: ./gradlew --no-daemon test
84-
- name: Upload Images
85-
uses: actions/upload-artifact@v6
86-
with:
87-
name: images-macos
88-
path: |
89-
target/*.png
90-
build/**/*.png
84+

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ dependencies {
5959

6060
java {
6161
toolchain {
62-
languageVersion = JavaLanguageVersion.of(8)
62+
languageVersion = JavaLanguageVersion.of(21)
6363
}
6464
withSourcesJar()
6565
withJavadocJar()
@@ -86,6 +86,7 @@ sourceSets {
8686

8787
tasks.withType(JavaCompile).configureEach {
8888
options.encoding = 'UTF-8'
89+
options.release = 8
8990
}
9091

9192
tasks.withType(Javadoc).configureEach {
@@ -95,6 +96,7 @@ tasks.withType(Javadoc).configureEach {
9596
tasks.test {
9697
useJUnitPlatform()
9798
workingDir = projectDir
99+
timeout = Duration.ofMinutes(15)
98100
}
99101

100102
tasks.jar {

test/org/lwjgl/opengl/awt/CompareScreenshotTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,11 @@ public void run() {
297297
screenShotSuffix = "_" + screenShotIndex;
298298
}
299299

300+
File outputDir = new File("build/test-screenshots");
301+
outputDir.mkdirs();
302+
300303
ImageIO.write(background, "png", new File(
301-
new File("target"),
304+
outputDir,
302305
System.getProperty("os.name") + "_" +
303306
testInfo.getTestClass().map(Class::getSimpleName).orElse("unknown") + "_" +
304307
testInfo.getTestMethod().map(Method::getName).orElse("unknown") + screenShotSuffix + ".png"));
@@ -312,7 +315,7 @@ public void run() {
312315
testInfo.getTestMethod().map(Method::getName).orElse("unknown") + screenShotSuffix + ".png"));
313316

314317
File resultDestination = new File(
315-
new File("target"),
318+
outputDir,
316319
System.getProperty("os.name") + "_" +
317320
testInfo.getTestClass().map(Class::getSimpleName).orElse("unknown") + "_" +
318321
testInfo.getTestMethod().map(Method::getName).orElse("unknown") + screenShotSuffix + "_diff.png");

0 commit comments

Comments
 (0)