Make the intergration tests easier to debug (#1401)

* Make the intergration tests easier to debug

* Spotless
This commit is contained in:
modmuss
2025-10-23 19:25:17 +01:00
committed by GitHub
parent 692ab93693
commit 36cf73997f
2 changed files with 8 additions and 9 deletions

View File

@@ -24,6 +24,8 @@
package net.fabricmc.loom.test
import java.lang.management.ManagementFactory
import org.gradle.util.GradleVersion
class LoomTestConstants {
@@ -46,6 +48,9 @@ class LoomTestConstants {
public static final File TEST_DIR = new File("./.gradle/test-files")
// Try to detect if the debugging agent is enabled.
public static final boolean IS_DEBUGGING_ENABLED = ManagementFactory.runtimeMXBean.inputArguments.any { it.startsWith('-agentlib:jdwp') }
/**
* Nightly gradle versions get removed after a certain amount of time, lets check to see if its still online before running the tests.
*/

View File

@@ -28,7 +28,6 @@ import groovy.transform.Immutable
import org.apache.commons.io.FileUtils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.util.GradleVersion
import spock.lang.Shared
import net.fabricmc.loom.test.LoomTestConstants
@@ -149,7 +148,6 @@ trait GradleProjectTestTrait {
private String gradleHomeDir
private String warningMode
private boolean useBuildSrc
private boolean enableDebugging = true
BuildResult run(Map options) {
// Setup the system props to tell loom that its running in a test env
@@ -165,7 +163,8 @@ trait GradleProjectTestTrait {
args << options.task
}
boolean configurationCache = true
// Configuration cache is not compatible with the debugging agent.
boolean configurationCache = !LoomTestConstants.IS_DEBUGGING_ENABLED
if (options.containsKey("configurationCache")) {
configurationCache = options.configurationCache
@@ -197,10 +196,6 @@ trait GradleProjectTestTrait {
writeBuildSrcDeps(runner)
}
if (options.disableDebugging) {
enableDebugging = false
}
return options.expectFailure ? runner.buildAndFail() : runner.build()
}
@@ -210,8 +205,7 @@ trait GradleProjectTestTrait {
.withPluginClasspath()
.withGradleVersion(gradleVersion)
.forwardOutput()
// Only enable debugging when the current gradle version matches the version we are testing
.withDebug(enableDebugging && gradleVersion == GradleVersion.current().getVersion())
.withDebug(LoomTestConstants.IS_DEBUGGING_ENABLED)
}
File getProjectDir() {