@@ -567,14 +567,15 @@ class Tester {
567
567
568
568
// Redirect the '-o' option, if there is a '-o' in the command
569
569
def oOption = pipelineCommand =~ / $outputRegex/
570
- File testOutputFile = null
570
+ File testOutputPath = null
571
+ String outputFileBaseName = null // i.e. "output"
571
572
if (oOption. count > 0 ) {
572
573
573
574
// Construct and make the path for any '-o' output
574
- File testOutputPath =
575
- new File (outputBasePath, " ${ currentTestFilename} _${ section.key} " )
575
+ testOutputPath = new File (outputBasePath, " ${ currentTestFilename} _${ section.key} " )
576
576
testOutputPath. mkdir()
577
- testOutputFile = new File (testOutputPath, oOption[0 ][1 ])
577
+ outputFileBaseName = oOption[0 ][1 ]
578
+ File testOutputFile = new File (testOutputPath, outputFileBaseName)
578
579
info(" Out : $testOutputFile " )
579
580
// Now swap-out the original '-o'...
580
581
String redirectedOutputOption = " -o ${ testOutputFile.toString()} "
@@ -615,15 +616,16 @@ class Tester {
615
616
616
617
// If command execution was successful (exit value of 0)
617
618
// then:
618
- // - check that the output file was created (if expected)
619
+ // - check that an output file was created (if expected)
619
620
// - iterate through any optional _see_ values,
620
621
// checking that the pipeline log contains the defined text.
621
622
boolean validated = true
622
623
if (exitValue == 0 ) {
623
624
624
- // Does the output file exist?
625
- if (testOutputFile != null ) {
626
- if (! testOutputFile. exists()) {
625
+ // Do we expect output files?
626
+ if (testOutputPath != null ) {
627
+ def outputFiles = new FileNameFinder (). getFileNames(testOutputPath, " {outputFileBaseName}.*" )
628
+ if (outputFiles. size() == 0 ) {
627
629
err(" Expected output file '$testOutputFile ' but it wasn't there" )
628
630
validated = false
629
631
}
0 commit comments