Reorganise tests (#378)

dev/0.11
modmuss50 2021-04-02 12:20:03 +01:00 committed by GitHub
parent ce19467121
commit 153afc1418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 61 additions and 59 deletions

View File

@ -61,7 +61,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: gradle test --tests *${{ matrix.test }} --stacktrace
- run: gradle test --tests ${{ matrix.test }} --stacktrace
env:
TEST_WARNING_MODE: fail

View File

@ -211,21 +211,21 @@ publishing {
task writeActionsTestMatrix() {
doLast {
def testMatrix = []
file('src/test/groovy/net/fabricmc/loom').eachFile {
file('src/test/groovy/net/fabricmc/loom/test/intergration').eachFile {
if (it.name.endsWith("Test.groovy")) {
if (it.text.contains("@Ignore")) {
// A quick hack to disable currently broken tests.
return
}
if (it.name.endsWith("ReproducibleBuildTest.groovy")) {
// This test gets a special case to run across all os's
return
}
testMatrix.add(it.name.replace(".groovy", ""))
def className = it.name.replace(".groovy", "")
testMatrix.add("net.fabricmc.loom.test.intergration.${className}")
}
}
// Run all the unit tests togeather
testMatrix.add("net.fabricmc.loom.test.unit.*")
def json = groovy.json.JsonOutput.toJson(testMatrix)
def output = file("build/test_matrix.json")
output.parentFile.mkdir()

View File

@ -22,10 +22,10 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ArchiveAssertionsTrait
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ArchiveAssertionsTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -45,9 +45,9 @@ class AccessWidenerTest extends Specification implements ProjectTestTrait, Archi
result.task(":build").outcome == SUCCESS
getArchiveEntry("fabric-example-mod-1.0.0.jar", "modid.accesswidener") == expected().replaceAll('\r', '')
where:
gradle | _
'6.8.3' | _
'7.0-rc-1' | _
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
String expected() {

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -46,9 +46,9 @@ class DecompileTest extends Specification implements ProjectTestTrait {
where:
decompiler | task | gradle
'fernflower' | "genSources" | "6.8.3"
'fernflower' | "genSources" | "4.9"
'fernflower' | "genSources" | "7.0-rc-1"
'cfr' | "genSourcesWithExperimentalCfr" | "6.8.3"
'fernflower' | "genSources" | DEFAULT_GRADLE
'fernflower' | "genSources" | LEGACY_GRADLE
'fernflower' | "genSources" | PRE_RELEASE_GRADLE
'cfr' | "genSourcesWithExperimentalCfr" | DEFAULT_GRADLE
}
}

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -43,8 +43,8 @@ class KotlinTest extends Specification implements ProjectTestTrait {
then:
result.task(":build").outcome == SUCCESS
where:
gradle | _
'6.8.3' | _
'7.0-rc-1' | _
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
}

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -40,7 +40,7 @@ class LegacyProjectTest extends Specification implements ProjectTestTrait {
@Unroll
def "build"() {
when:
def result = create("build", "4.9")
def result = create("build", LEGACY_GRADLE)
then:
result.task(":build").outcome == SUCCESS
}

View File

@ -22,10 +22,10 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ArchiveAssertionsTrait
import net.fabricmc.loom.util.MockMavenServerTrait
import net.fabricmc.loom.test.util.ArchiveAssertionsTrait
import net.fabricmc.loom.test.util.MockMavenServerTrait
import spock.lang.Specification
import spock.lang.Stepwise
import spock.lang.Unroll

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -43,8 +43,8 @@ class MojangMappingsProjectTest extends Specification implements ProjectTestTrai
then:
result.task(":build").outcome == SUCCESS
where:
gradle | _
'6.8.3' | _
'7.0-rc-1' | _
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
}

View File

@ -22,10 +22,10 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ArchiveAssertionsTrait
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ArchiveAssertionsTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -54,8 +54,8 @@ class MultiProjectTest extends Specification implements ProjectTestTrait, Archiv
hasArchiveEntry("multiproject-1.0.0.jar", "META-INF/jars/fabric-api-base-0.2.1+9354966b7d.jar")
where:
gradle | _
'6.8.3' | _
'7.0-rc-1' | _
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
}

View File

@ -22,12 +22,12 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import com.google.common.hash.HashCode
import com.google.common.hash.Hashing
import com.google.common.io.Files
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import spock.lang.Specification
import spock.lang.Unroll
@ -43,9 +43,9 @@ class SimpleProjectTest extends Specification implements ProjectTestTrait {
then:
result.task(":build").outcome == SUCCESS
where:
gradle | _
'6.8.3' | _
'7.0-rc-1' | _
gradle | _
DEFAULT_GRADLE | _
PRE_RELEASE_GRADLE | _
}
@Unroll

View File

@ -22,9 +22,9 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.intergration
import net.fabricmc.loom.util.ProjectTestTrait
import net.fabricmc.loom.test.util.ProjectTestTrait
import org.zeroturnaround.zip.ZipUtil
import spock.lang.Specification

View File

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package net.fabricmc.loom
package net.fabricmc.loom.test.unit
import groovy.xml.QName
import net.fabricmc.loom.util.GroovyXmlUtil

View File

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package net.fabricmc.loom.util
package net.fabricmc.loom.test.util
import org.zeroturnaround.zip.ZipUtil

View File

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package net.fabricmc.loom.util
package net.fabricmc.loom.test.util
import io.javalin.Javalin
import org.apache.commons.io.IOUtils

View File

@ -22,15 +22,17 @@
* SOFTWARE.
*/
package net.fabricmc.loom.util
package net.fabricmc.loom.test.util
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
trait ProjectTestTrait {
static File gradleHome = File.createTempDir()
final static String LEGACY_GRADLE = "4.9"
final static String DEFAULT_GRADLE = "6.8.3"
final static String PRE_RELEASE_GRADLE = "7.0-rc-2"
static File gradleHome = File.createTempDir()
File testProjectDir = File.createTempDir()
abstract String name()
@ -93,7 +95,7 @@ trait ProjectTestTrait {
}
String warningMode(String gradleVersion) {
if (gradleVersion == "4.9") {
if (gradleVersion == LEGACY_GRADLE) {
return "all"
}