Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fed55698e6
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 74 lines (69 sloc) 2.833 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
test {
    jvmArgs "-ea", "-Xms${groovyJUnit_ms}", "-Xmx${groovyJUnit_mx}", "-XX:PermSize=${groovyJUnit_permSize}", "-XX:MaxPermSize=${groovyJUnit_maxPermSize}"
    def headless = System.properties['java.awt.headless']
    if (headless == 'true') {
        systemProperties 'java.awt.headless': "true"
    }
    def testdb = System.properties['groovy.testdb.props']
    if (testdb) {
        systemProperties 'groovy.testdb.props': testdb
    }
    systemProperties 'apple.awt.UIElement': "true", "javadocAssertion.src.dir": './src/main'
    systemProperties "gradle.home": gradle.gradleHomeDir // this is needed by the security.policy
    doFirst {
        // this is needed by the security.policy. We set it at execution time to avoid resolving a configuration when not needed.
// temp hack
// systemProperties "gradle.junit": configurations.testCompile.fileCollection { dep -> dep.name == 'junit' }.singleFile.absolutePath
    }
    classpath = files('src/test') + classpath
// forkEvery = 10
// maxParallelForks = Runtime.runtime.availableProcessors()
    scanForTestClasses = false
    ignoreFailures = false
    ext.resultText = ''
    includes = getIncludePattern()
    doLast {
        ant.delete {
            fileset(dir: '.', includes: '*.class')
        }
    }
}

boolean isRunningOnCI() {
    new File('.').absolutePath.contains('ci.codehaus.org')
}

logger.lifecycle "Detected ${isRunningOnCI()?'Continuous Integration environment':'development environment'}"

allprojects {
    test {
        forkEvery = isRunningOnCI()?50:200
        maxParallelForks = isRunningOnCI()?1:Runtime.runtime.availableProcessors()
    }
}
tasks.addRule("Pattern: testSingle<Name> will test **/<Name>.class") {String taskName ->
    if (taskName.startsWith("testSingle")) {
        tasks.add(taskName).dependsOn(test)
        test.includes = ['**/' + taskName.substring(10) + '.class']
        test.outputs.upToDateWhen { false }
    }
}

def getIncludePattern() {
    def baseInclude = ['UberTestCaseBugs.class',
            'UberTestCaseGroovySourceCodehausPackages.class',
            'UberTestCaseGroovySourceRootPackage.class',
            "UberTestCaseGroovySourceSubPackages.class",
            "UberTestCaseJavaSourceCodehausPackages.class",
            "UberTestCaseJavaSourceGroovyPackagesNonSecurity.class",
            "UberTestCaseTCK.class"
            // temporarily disable security test suite, see GRADLE-2170
            //,"UberTestCaseJavaSourceGroovyPackagesSecurity.class"
    ]
    if (System.properties['junit.network']) {
        baseInclude += ['groovy/grape/*Test.class']
    }
    if (!isJava15()) {
        baseInclude += [
                "UberTestCaseGroovySourceSubPackages_VM6.class",
                "UberTestCaseGroovySourceCodehausPackages_VM6.class"
        ]
    }
    baseInclude
}
Something went wrong with that request. Please try again.