Reorganise tests (#378)
This commit is contained in:
		
							parent
							
								
									ce19467121
								
							
						
					
					
						commit
						153afc1418
					
				
					 17 changed files with 61 additions and 59 deletions
				
			
		
							
								
								
									
										2
									
								
								.github/workflows/test-push.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/test-push.yml
									
									
									
									
										vendored
									
									
								
							|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										14
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								build.gradle
									
									
									
									
									
								
							|  | @ -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() | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -46,8 +46,8 @@ class AccessWidenerTest extends Specification implements ProjectTestTrait, Archi | |||
| 			getArchiveEntry("fabric-example-mod-1.0.0.jar", "modid.accesswidener") == expected().replaceAll('\r', '') | ||||
| 		where: | ||||
| 			gradle              | _ | ||||
| 			'6.8.3'    | _ | ||||
| 			'7.0-rc-1' | _ | ||||
| 			DEFAULT_GRADLE      | _ | ||||
| 			PRE_RELEASE_GRADLE  | _ | ||||
| 	} | ||||
| 
 | ||||
| 	String expected() { | ||||
|  | @ -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 | ||||
| 	} | ||||
| } | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -44,7 +44,7 @@ class KotlinTest extends Specification implements ProjectTestTrait { | |||
| 			result.task(":build").outcome == SUCCESS | ||||
| 		where: | ||||
| 			gradle              | _ | ||||
| 			'6.8.3'     | _ | ||||
| 			'7.0-rc-1'  | _ | ||||
| 			DEFAULT_GRADLE      | _ | ||||
| 			PRE_RELEASE_GRADLE  | _ | ||||
| 	} | ||||
| } | ||||
|  | @ -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 | ||||
| 	} | ||||
|  | @ -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 | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -44,7 +44,7 @@ class MojangMappingsProjectTest extends Specification implements ProjectTestTrai | |||
| 			result.task(":build").outcome == SUCCESS | ||||
| 		where: | ||||
| 			gradle              | _ | ||||
| 			'6.8.3'     | _ | ||||
| 			'7.0-rc-1'  | _ | ||||
| 			DEFAULT_GRADLE      | _ | ||||
| 			PRE_RELEASE_GRADLE  | _ | ||||
| 	} | ||||
| } | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -55,7 +55,7 @@ class MultiProjectTest extends Specification implements ProjectTestTrait, Archiv | |||
| 
 | ||||
| 		where: | ||||
| 			gradle              | _ | ||||
| 			'6.8.3'     | _ | ||||
| 			'7.0-rc-1'  | _ | ||||
| 			DEFAULT_GRADLE      | _ | ||||
| 			PRE_RELEASE_GRADLE  | _ | ||||
| 	} | ||||
| } | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -44,8 +44,8 @@ class SimpleProjectTest extends Specification implements ProjectTestTrait { | |||
| 			result.task(":build").outcome == SUCCESS | ||||
| 		where: | ||||
| 			gradle              | _ | ||||
| 			'6.8.3'     | _ | ||||
| 			'7.0-rc-1'  | _ | ||||
| 			DEFAULT_GRADLE      | _ | ||||
| 			PRE_RELEASE_GRADLE  | _ | ||||
| 	} | ||||
| 
 | ||||
| 	@Unroll | ||||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -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 | ||||
|  | @ -22,7 +22,7 @@ | |||
|  * SOFTWARE. | ||||
|  */ | ||||
| 
 | ||||
| package net.fabricmc.loom.util | ||||
| package net.fabricmc.loom.test.util | ||||
| 
 | ||||
| import org.zeroturnaround.zip.ZipUtil | ||||
| 
 | ||||
|  | @ -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 | ||||
|  | @ -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" | ||||
| 		} | ||||
| 
 | ||||
		Loading…
	
		Reference in a new issue