Reorganise tests (#378)
parent
ce19467121
commit
153afc1418
|
@ -61,7 +61,7 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: gradle test --tests *${{ matrix.test }} --stacktrace
|
- run: gradle test --tests ${{ matrix.test }} --stacktrace
|
||||||
env:
|
env:
|
||||||
TEST_WARNING_MODE: fail
|
TEST_WARNING_MODE: fail
|
||||||
|
|
||||||
|
|
14
build.gradle
14
build.gradle
|
@ -211,21 +211,21 @@ publishing {
|
||||||
task writeActionsTestMatrix() {
|
task writeActionsTestMatrix() {
|
||||||
doLast {
|
doLast {
|
||||||
def testMatrix = []
|
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.name.endsWith("Test.groovy")) {
|
||||||
if (it.text.contains("@Ignore")) {
|
|
||||||
// A quick hack to disable currently broken tests.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (it.name.endsWith("ReproducibleBuildTest.groovy")) {
|
if (it.name.endsWith("ReproducibleBuildTest.groovy")) {
|
||||||
// This test gets a special case to run across all os's
|
// This test gets a special case to run across all os's
|
||||||
return
|
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 json = groovy.json.JsonOutput.toJson(testMatrix)
|
||||||
def output = file("build/test_matrix.json")
|
def output = file("build/test_matrix.json")
|
||||||
output.parentFile.mkdir()
|
output.parentFile.mkdir()
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom
|
package net.fabricmc.loom.test.intergration
|
||||||
|
|
||||||
import net.fabricmc.loom.util.ArchiveAssertionsTrait
|
import net.fabricmc.loom.test.util.ArchiveAssertionsTrait
|
||||||
import net.fabricmc.loom.util.ProjectTestTrait
|
import net.fabricmc.loom.test.util.ProjectTestTrait
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ class AccessWidenerTest extends Specification implements ProjectTestTrait, Archi
|
||||||
getArchiveEntry("fabric-example-mod-1.0.0.jar", "modid.accesswidener") == expected().replaceAll('\r', '')
|
getArchiveEntry("fabric-example-mod-1.0.0.jar", "modid.accesswidener") == expected().replaceAll('\r', '')
|
||||||
where:
|
where:
|
||||||
gradle | _
|
gradle | _
|
||||||
'6.8.3' | _
|
DEFAULT_GRADLE | _
|
||||||
'7.0-rc-1' | _
|
PRE_RELEASE_GRADLE | _
|
||||||
}
|
}
|
||||||
|
|
||||||
String expected() {
|
String expected() {
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ class DecompileTest extends Specification implements ProjectTestTrait {
|
||||||
|
|
||||||
where:
|
where:
|
||||||
decompiler | task | gradle
|
decompiler | task | gradle
|
||||||
'fernflower' | "genSources" | "6.8.3"
|
'fernflower' | "genSources" | DEFAULT_GRADLE
|
||||||
'fernflower' | "genSources" | "4.9"
|
'fernflower' | "genSources" | LEGACY_GRADLE
|
||||||
'fernflower' | "genSources" | "7.0-rc-1"
|
'fernflower' | "genSources" | PRE_RELEASE_GRADLE
|
||||||
'cfr' | "genSourcesWithExperimentalCfr" | "6.8.3"
|
'cfr' | "genSourcesWithExperimentalCfr" | DEFAULT_GRADLE
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class KotlinTest extends Specification implements ProjectTestTrait {
|
||||||
result.task(":build").outcome == SUCCESS
|
result.task(":build").outcome == SUCCESS
|
||||||
where:
|
where:
|
||||||
gradle | _
|
gradle | _
|
||||||
'6.8.3' | _
|
DEFAULT_GRADLE | _
|
||||||
'7.0-rc-1' | _
|
PRE_RELEASE_GRADLE | _
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class LegacyProjectTest extends Specification implements ProjectTestTrait {
|
||||||
@Unroll
|
@Unroll
|
||||||
def "build"() {
|
def "build"() {
|
||||||
when:
|
when:
|
||||||
def result = create("build", "4.9")
|
def result = create("build", LEGACY_GRADLE)
|
||||||
then:
|
then:
|
||||||
result.task(":build").outcome == SUCCESS
|
result.task(":build").outcome == SUCCESS
|
||||||
}
|
}
|
|
@ -22,10 +22,10 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom
|
package net.fabricmc.loom.test.intergration
|
||||||
|
|
||||||
import net.fabricmc.loom.util.ArchiveAssertionsTrait
|
import net.fabricmc.loom.test.util.ArchiveAssertionsTrait
|
||||||
import net.fabricmc.loom.util.MockMavenServerTrait
|
import net.fabricmc.loom.test.util.MockMavenServerTrait
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
import spock.lang.Stepwise
|
import spock.lang.Stepwise
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class MojangMappingsProjectTest extends Specification implements ProjectTestTrai
|
||||||
result.task(":build").outcome == SUCCESS
|
result.task(":build").outcome == SUCCESS
|
||||||
where:
|
where:
|
||||||
gradle | _
|
gradle | _
|
||||||
'6.8.3' | _
|
DEFAULT_GRADLE | _
|
||||||
'7.0-rc-1' | _
|
PRE_RELEASE_GRADLE | _
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,10 +22,10 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom
|
package net.fabricmc.loom.test.intergration
|
||||||
|
|
||||||
import net.fabricmc.loom.util.ArchiveAssertionsTrait
|
import net.fabricmc.loom.test.util.ArchiveAssertionsTrait
|
||||||
import net.fabricmc.loom.util.ProjectTestTrait
|
import net.fabricmc.loom.test.util.ProjectTestTrait
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class MultiProjectTest extends Specification implements ProjectTestTrait, Archiv
|
||||||
|
|
||||||
where:
|
where:
|
||||||
gradle | _
|
gradle | _
|
||||||
'6.8.3' | _
|
DEFAULT_GRADLE | _
|
||||||
'7.0-rc-1' | _
|
PRE_RELEASE_GRADLE | _
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,12 +22,12 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom
|
package net.fabricmc.loom.test.intergration
|
||||||
|
|
||||||
import com.google.common.hash.HashCode
|
import com.google.common.hash.HashCode
|
||||||
import com.google.common.hash.Hashing
|
import com.google.common.hash.Hashing
|
||||||
import com.google.common.io.Files
|
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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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.Specification
|
||||||
import spock.lang.Unroll
|
import spock.lang.Unroll
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ class SimpleProjectTest extends Specification implements ProjectTestTrait {
|
||||||
result.task(":build").outcome == SUCCESS
|
result.task(":build").outcome == SUCCESS
|
||||||
where:
|
where:
|
||||||
gradle | _
|
gradle | _
|
||||||
'6.8.3' | _
|
DEFAULT_GRADLE | _
|
||||||
'7.0-rc-1' | _
|
PRE_RELEASE_GRADLE | _
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unroll
|
@Unroll
|
|
@ -22,9 +22,9 @@
|
||||||
* SOFTWARE.
|
* 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 org.zeroturnaround.zip.ZipUtil
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom
|
package net.fabricmc.loom.test.unit
|
||||||
|
|
||||||
import groovy.xml.QName
|
import groovy.xml.QName
|
||||||
import net.fabricmc.loom.util.GroovyXmlUtil
|
import net.fabricmc.loom.util.GroovyXmlUtil
|
|
@ -22,7 +22,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.util
|
package net.fabricmc.loom.test.util
|
||||||
|
|
||||||
import org.zeroturnaround.zip.ZipUtil
|
import org.zeroturnaround.zip.ZipUtil
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.util
|
package net.fabricmc.loom.test.util
|
||||||
|
|
||||||
import io.javalin.Javalin
|
import io.javalin.Javalin
|
||||||
import org.apache.commons.io.IOUtils
|
import org.apache.commons.io.IOUtils
|
|
@ -22,15 +22,17 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.fabricmc.loom.util
|
package net.fabricmc.loom.test.util
|
||||||
|
|
||||||
import org.gradle.testkit.runner.BuildResult
|
import org.gradle.testkit.runner.BuildResult
|
||||||
import org.gradle.testkit.runner.GradleRunner
|
import org.gradle.testkit.runner.GradleRunner
|
||||||
|
|
||||||
trait ProjectTestTrait {
|
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 DEFAULT_GRADLE = "6.8.3"
|
||||||
|
final static String PRE_RELEASE_GRADLE = "7.0-rc-2"
|
||||||
|
|
||||||
|
static File gradleHome = File.createTempDir()
|
||||||
File testProjectDir = File.createTempDir()
|
File testProjectDir = File.createTempDir()
|
||||||
|
|
||||||
abstract String name()
|
abstract String name()
|
||||||
|
@ -93,7 +95,7 @@ trait ProjectTestTrait {
|
||||||
}
|
}
|
||||||
|
|
||||||
String warningMode(String gradleVersion) {
|
String warningMode(String gradleVersion) {
|
||||||
if (gradleVersion == "4.9") {
|
if (gradleVersion == LEGACY_GRADLE) {
|
||||||
return "all"
|
return "all"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue