Skip to content

Commit 744da50

Browse files
author
Alan Christie
committed
- Adjustment for Windows (including tweak in Docker tester)
- Adjusted README
1 parent 7235cff commit 744da50

File tree

4 files changed

+45
-7
lines changed

4 files changed

+45
-7
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ text-file format used to both describe and execute built-in tests.
88
## Execution environment
99
You will need: -
1010

11-
- Groovy
1211
- Conda
12+
- Groovy (v2.4)
13+
- Python
1314

1415
Although the project is based on [Gradle], which is Groovy-based,
1516
you will need to install **Groovy**. We've tested this framework using Groovy
@@ -170,10 +171,36 @@ that can be tested using `setup.py`. To test these modules run the
170171
following from the `src/python` directory: -
171172

172173
$ python setup.py test
173-
174+
175+
## Considerations for Windows
176+
The tests and test framework are designed to operate from within a unix-like
177+
environment but if you are forced to execute pipeline tests from Windows the
178+
following approach is recommended: -
179+
180+
You will need:
181+
182+
- Conda
183+
- Groovy (v2.4)
184+
- Git-Bash
185+
186+
1. Install [Git for Windows]. This will give you a unix bash-like
187+
execution environment
188+
1. From within the Git-bash shell navigate to your pipelines project.
189+
1. Ensure that you can execute both Python and Groovy from within the
190+
Git-Bash shell (i.e. `python --version` and `groovy --version` work)
191+
1. From the pipelines project root enter your Conda environment
192+
with something like `source activate my-conda-env`
193+
194+
With the above steps complete you should be able to execute the pipelines
195+
tester by navigating to the sub-module in your pipelines project: -
196+
197+
$ cd pipelines-utils
198+
$ ./gradlew runPipelineTester
199+
174200
---
175201

176202
[Conda]: https://conda.io/docs/
203+
[Git for Windows]: http://gitforwindows.org
177204
[Gradle]: https://gradle.org
178205
[Groovy]: http://groovy-lang.org
179206
[PIP]: https://pypi.python.org/pypi

src/groovy/ContainerExecutor.groovy

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ class ContainerExecutor {
4848
StringBuilder sout = new StringBuilder()
4949
StringBuilder serr = new StringBuilder()
5050

51-
// Note: PIN and POUT have trailing forward-slashed for now
51+
// Windows/Git-Bash PIN/POUT path tweak...
52+
String osName = System.properties['os.name']
53+
if (osNmae && osName.startsWith('Win')) {
54+
pin = pin.replace('\\', '/')
55+
pin = pin.replace('C:', '/c')
56+
pout = pout.replace('\\', '/')
57+
pout = pout.replace('C:', '/c')
58+
}
59+
60+
// Note: PIN and POUT have trailing forward-slashes for now
5261
// to allow a migratory use of $PIN}file references
5362
// rather than insisting on ${PIN}/file which would fail if
5463
// PIN wasn't defined - it's about lowest risk changes.

src/groovy/PipelineTester.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
// Version
3333
// Update with every change/release
34-
String version = '2.1.0'
34+
String version = '2.1.1'
3535

3636
println "+----------------+"
3737
println "| PipelineTester | v$version"

src/groovy/ShellExecutor.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ class ShellExecutor {
2424

2525
/**
2626
* Executes the given command using the shell in the supplied execution
27-
* directory.
27+
* directory. Normally this would be executed in a unix-like environment.
28+
* In Windows this would be from something like a Git-Bash shell.
2829
*
2930
* @param command The command to run
3031
* @param edir The directory in which to run the command
32+
* (execution directory)
3133
* @param pin The pipeline input directory
3234
* (used to define the PIN environment variable)
3335
* @param pout The pipeline output directory
@@ -44,9 +46,9 @@ class ShellExecutor {
4446
StringBuilder sout = new StringBuilder()
4547
StringBuilder serr = new StringBuilder()
4648

47-
// Windows hack?
49+
// Windows/Git-Bash PIN/POUT path tweak...
4850
String osName = System.properties['os.name']
49-
if (osName.startsWith('Win')) {
51+
if (osName && osName.startsWith('Win')) {
5052
pin = pin.replace('\\', '/')
5153
pin = pin.replace('C:', '/c')
5254
pout = pout.replace('\\', '/')

0 commit comments

Comments
 (0)