You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2019/08/07 22:26:15 UTC

[lucenenet] 18/42: build.ps1: Added option to specify maximum number of parallel jobs to use during testing

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 9ad6f005cdf63142ff8b8f8564f982bb48828018
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Fri Aug 2 21:54:30 2019 +0700

    build.ps1: Added option to specify maximum number of parallel jobs to use during testing
---
 README.md       |  8 +++++++-
 build.bat       | 16 +++++++++++++++-
 build/build.ps1 | 17 ++++++++++++++++-
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 3b83d5e..4ce4667 100644
--- a/README.md
+++ b/README.md
@@ -180,6 +180,12 @@ To build the source, clone or download and unzip the repository. From the reposi
 		<td>build&nbsp;&#8209;&#8209;Configuration:Debug</td>
 	</tr>
 	<tr>
+		<td>&#8209;mp</td>
+		<td>&#8209;&#8209;MaximumParallelJobs</td>
+		<td>The maximum number of parallel jobs to run during testing. If not supplied, the default is 8.</td>
+		<td>build&nbsp;&#8209;mp:10</td>
+	</tr>
+	<tr>
 		<td>&#8209;pv</td>
 		<td>&#8209;&#8209;PackageVersion</td>
 		<td>The NuGet package version. If not supplied, will use the version from the Version.proj file.</td>
@@ -188,7 +194,7 @@ To build the source, clone or download and unzip the repository. From the reposi
 	<tr>
 		<td>&#8209;t</td>
 		<td>&#8209;&#8209;Test</td>
-		<td>Runs the tests after building. Note that testing typically takes upwards of 2 hours.</td>
+		<td>Runs the tests after building. Note that testing typically takes around 40 minutes with 8 parallel jobs.</td>
 		<td>build&nbsp;&#8209;t</td>
 	</tr>
 	<tr>
diff --git a/build.bat b/build.bat
index c4375e4..4fb317e 100644
--- a/build.bat
+++ b/build.bat
@@ -39,6 +39,9 @@ GOTO endcommentblock
 ::   --Test
 ::   -t - Run the tests.
 ::
+::   --MaximumParallelJobs
+::   -mp - Set the maxumum number of parallel jobs to run during testing. If not supplied, the default is 8.
+::
 ::   All options are case insensitive.
 ::
 ::   To escape any of the options, put double quotes around the entire value, like this:
@@ -63,6 +66,7 @@ IF NOT "%config%" == "" (
  	set configuration=%config%
 )
 set runtests=false
+set maximumParallelJobs=8
 
 FOR %%a IN (%*) DO (
 	FOR /f "useback tokens=*" %%a in ('%%a') do (
@@ -107,6 +111,16 @@ FOR %%a IN (%*) DO (
 		IF /I !test!==--test (
 			set runtests=true
 		)
+
+		set test=!value:~0,4!
+		IF /I !test!==-mp: (
+			set maximumParallelJobs=!value:~4!
+		)
+
+		set test=!value:~0,22!
+		IF /I !test!==--maximumparalleljobs: (
+			set maximumParallelJobs=!value:~22!
+		)
 	)
 )
 
@@ -115,6 +129,6 @@ if "!runtests!"=="true" (
 	set tasks="Default,Test"
 )
 
-powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 %tasks% -properties @{configuration='%configuration%'} -parameters @{ packageVersion='%PackageVersion%';version='%version%' } }"
+powershell -ExecutionPolicy Bypass -Command "& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 %tasks% -properties @{configuration='%configuration%';maximumParalellJobs=%maximumParallelJobs%} -parameters @{ packageVersion='%PackageVersion%';version='%version%' } }"
 
 endlocal
diff --git a/build/build.ps1 b/build/build.ps1
index a29d765..9693969 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -111,6 +111,7 @@ task Init -depends InstallSDK, UpdateLocalSDKVersion -description "This task mak
 	Write-Host "Version: $version"
 	Write-Host "Configuration: $configuration"
 	Write-Host "Platform: $platform"
+	Write-Host "MaximumParallelJobs: $($maximumParalellJobs.ToString())"
 
 	Ensure-Directory-Exists "$release_directory"
 }
@@ -589,11 +590,15 @@ GOTO endcommentblock
 ::   --Test
 ::   -t - Run the tests.
 ::
+::   --MaximumParallelJobs
+::   -mp - Set the maxumum number of parallel jobs to run during testing. If not supplied, the default is 8.
+::
 :: -----------------------------------------------------------------------------------
 :endcommentblock
 setlocal enabledelayedexpansion enableextensions
 
 set runtests=false
+set maximumParallelJobs=8
 
 FOR %%a IN (%*) DO (
 	FOR /f ""useback tokens=*"" %%a in ('%%a') do (
@@ -608,6 +613,16 @@ FOR %%a IN (%*) DO (
 		IF /I !test!==--test (
 			set runtests=true
 		)
+
+		set test=!value:~0,4!
+		IF /I !test!==-mp: (
+			set maximumParallelJobs=!value:~4!
+		)
+
+		set test=!value:~0,22!
+		IF /I !test!==--maximumparalleljobs: (
+			set maximumParallelJobs=!value:~22!
+		)
 	)
 )
 
@@ -616,7 +631,7 @@ if ""!runtests!""==""true"" (
 	set tasks=""Default,Test""
 )
 
-powershell -ExecutionPolicy Bypass -Command ""& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -Task %tasks% -properties @{prepareForBuild='false';backup_files='false'} }""
+powershell -ExecutionPolicy Bypass -Command ""& { Import-Module .\build\psake.psm1; Invoke-Psake .\build\build.ps1 -Task %tasks% -properties @{prepareForBuild='false';backup_files='false';maximumParalellJobs=%maximumParallelJobs%} }""
 
 endlocal
 "