Skip to content

Commit

Permalink
Merge pull request #134 from Thevakumar-Luheerathan/support-parallel-…
Browse files Browse the repository at this point in the history
…test-flag

Add parallel test flag
  • Loading branch information
Thevakumar-Luheerathan authored Feb 26, 2024
2 parents 75de347 + 4ce1bb6 commit 85446e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class BallerinaPlugin implements Plugin<Project> {
def needPublishToLocalCentral = false
def skipTests = true
def graalvmFlag = ''
def parallelTestFlag = ''
def buildOnDocker = false
def ballerinaDockerTag = ''
def distributionBinPath = ''
Expand Down Expand Up @@ -221,6 +222,9 @@ class BallerinaPlugin implements Plugin<Project> {
println("[Warning] disabled code coverage: running GraalVM tests")
graalvmFlag = '--graalvm'
}
if (project.hasProperty('balParallelTest')) {
parallelTestFlag = '--parallel'
}
if (!ballerinaExtension.isConnector) {
distributionBinPath = project.projectDir.absolutePath + "/build/jballerina-tools-${ballerinaExtension.langVersion}/bin"
}
Expand Down Expand Up @@ -386,17 +390,17 @@ class BallerinaPlugin implements Plugin<Project> {
-v $projectDirectory:/home/ballerina/$parentDirectory.name/$projectDirectory.name \
ballerina/ballerina:$ballerinaDockerTag \
/bin/sh -c "cd $parentDirectory.name/$projectDirectory.name && \
$balJavaDebugParam bal test ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
$balJavaDebugParam bal test ${graalvmFlag} ${parallelTestFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
"""
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$balTestWithDocker"
} else {
commandLine 'sh', '-c', "$balTestWithDocker"
}
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$balJavaDebugParam $distributionBinPath/bal.bat test --offline ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams} && exit %%ERRORLEVEL%%"
commandLine 'cmd', '/c', "$balJavaDebugParam $distributionBinPath/bal.bat test --offline ${graalvmFlag} ${parallelTestFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "$balJavaDebugParam $distributionBinPath/bal test --offline ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
commandLine 'sh', '-c', "$balJavaDebugParam $distributionBinPath/bal test --offline ${graalvmFlag} ${parallelTestFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
}

}
Expand Down

0 comments on commit 85446e7

Please sign in to comment.