mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-12 02:10:30 +00:00
Fix client tests not running on Forge
This was introduced by the FG6 update - the cctest.client property didn't get set, and so tests never started!
This commit is contained in:
parent
90ed0b24e7
commit
dd08d1ec8e
@ -4,6 +4,7 @@
|
||||
|
||||
package cc.tweaked.gradle
|
||||
|
||||
import net.minecraftforge.gradle.common.util.RunConfig
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.invocation.Gradle
|
||||
@ -53,6 +54,25 @@ abstract class ClientJavaExec : JavaExec() {
|
||||
@get:OutputFile
|
||||
val testResults = project.layout.buildDirectory.file("test-results/$name.xml")
|
||||
|
||||
private fun setTestProperties() {
|
||||
if (!clientDebug) systemProperty("cctest.client", "")
|
||||
if (renderdoc) environment("LD_PRELOAD", "/usr/lib/librenderdoc.so")
|
||||
systemProperty("cctest.gametest-report", testResults.get().asFile.absoluteFile)
|
||||
workingDir(project.buildDir.resolve("gametest").resolve(name))
|
||||
}
|
||||
|
||||
init {
|
||||
setTestProperties()
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this task to run a given [RunConfig].
|
||||
*/
|
||||
fun setRunConfig(config: RunConfig) {
|
||||
(this as JavaExec).setRunConfig(config)
|
||||
setTestProperties() // setRunConfig may clobber some properties, ensure everything is set.
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy configuration from a task with the given name.
|
||||
*/
|
||||
@ -64,11 +84,7 @@ abstract class ClientJavaExec : JavaExec() {
|
||||
fun copyFrom(task: JavaExec) {
|
||||
for (dep in task.dependsOn) dependsOn(dep)
|
||||
task.copyToFull(this)
|
||||
|
||||
if (!clientDebug) systemProperty("cctest.client", "")
|
||||
if (renderdoc) environment("LD_PRELOAD", "/usr/lib/librenderdoc.so")
|
||||
systemProperty("cctest.gametest-report", testResults.get().asFile.absoluteFile)
|
||||
workingDir(project.buildDir.resolve("gametest").resolve(name))
|
||||
setTestProperties() // copyToFull may clobber some properties, ensure everything is set.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,10 +114,12 @@ def main():
|
||||
|
||||
images: list[Image] = []
|
||||
for project, dir in {
|
||||
"Forge": "projects/forge",
|
||||
"Fabric": "projects/fabric",
|
||||
"Forge": "projects/forge/build/gametest/runGametestClient",
|
||||
"Fabric": "projects/fabric/build/gametest/runGametestClient",
|
||||
"Fabric (+Sodium)": "projects/fabric/build/gametest/runGametestClientWithSodium",
|
||||
"Fabric (+Iris)": "projects/fabric/build/gametest/runGametestClientWithIris",
|
||||
}.items():
|
||||
for file in sorted(pathlib.Path(dir).glob("build/gametest/*/screenshots/*.png")):
|
||||
for file in sorted(pathlib.Path(dir).glob("screenshots/*.png")):
|
||||
name = [project, *(_normalise_id(x) for x in file.stem.split("."))]
|
||||
|
||||
mtime = datetime.fromtimestamp(file.stat().st_mtime, tz=timezone.utc)
|
||||
|
Loading…
Reference in New Issue
Block a user