Skip to content

Commit 01f40a7

Browse files
Merge pull request #400 from thomasNellemann-BD/handle-88-level-spanning-multible-lines
Make cobol-check insert FD variables in the FD area and not in WS. This removes naming collisions (Handle 88 level spanning multiple lines)
2 parents 74b6f2c + 82e323a commit 01f40a7

File tree

58 files changed

+1422
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1422
-211
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*~
33
*.lock
44
*.DS_Store
5-
*.swp
65
*.out
76
ALLTESTS
87
ALPHAT
@@ -51,7 +50,6 @@ hs_err_pid*
5150
##############################
5251
## Maven
5352
##############################
54-
target/
5553
pom.xml.tag
5654
pom.xml.releaseBackup
5755
pom.xml.versionsBackup

CC##99

-37.7 KB
Binary file not shown.

CC##TEST

-37.8 KB
Binary file not shown.

approvaltest

100755100644
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
./cobolcheck -p NUMBERS > approval-test-actual.txt
2-
./cobolcheck -p ALPHA >> approval-test-actual.txt
3-
./cobolcheck -p GREETING >> approval-test-actual.txt
4-
./cobolcheck -p FILECOPY >> approval-test-actual.txt
5-
./cobolcheck -p MOCKTEST >> approval-test-actual.txt
6-
./cobolcheck -p DPICNUMBERS >> approval-test-actual.txt
1+
./temp/approvalTest/cobolcheck -p NUMBERS > ./actual-output.txt
2+
./temp/approvalTest/cobolcheck -p ALPHA >> ./actual-output.txt
3+
./temp/approvalTest/cobolcheck -p GREETING >> ./actual-output.txt
4+
./temp/approvalTest/cobolcheck -p FILECOPY >> ./actual-output.txt
5+
./temp/approvalTest/cobolcheck -p MOCKTEST >> ./actual-output.txt
6+
./temp/approvalTest/cobolcheck -p DPICNUMBERS >> ./actual-output.txt

approvaltestWin.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
./cobolcheck -p ALPHA DB2PROG DPICNUMBERS FILECOPY GREETING MOCK MOCKPARA MOCKTEST NUMBERS RETURNCODE TESTNESTED LONGLINESANDNUMBERS > approval-test-actual.txt
1+
temp/approvalTest/cobolcheck.cmd -p NUMBERS ALPHA GREETING FILECOPY MOCKTEST DPICNUMBERS > actual-output.txt

build.gradle

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def productName = 'cobol-check'
1111
group = 'org.openmainframeproject'
1212
description = 'Unit testing framework for Cobol'
1313

14-
def approvalExpectedOutput = "approval-test-expected.txt"
15-
def approvalActualOutput = "output/testResults.txt"
14+
def approvalExpectedOutput = "./expected-output.txt"
15+
def approvalActualOutput = "./actual-output.txt"
1616

1717
sonarqube {
1818
properties {
@@ -162,12 +162,17 @@ task copyJarToExtension(type: Copy) {
162162

163163
task copyRunScripts(type: Copy) {
164164
description 'Makes copies of run scripts'
165+
166+
// copy and modify run scripts for bin version
165167
from "${projectDir}/cobolcheck.cmd"
166-
into "${projectDir}/GradleTemp"
168+
into "${projectDir}/temp/approvalTest"
167169
filter { line -> line.replaceAll('@VERSION@', productVersion) }
168170
from "${projectDir}/cobolcheck"
169-
into "${projectDir}/GradleTemp"
171+
into "${projectDir}/temp/approvalTest"
170172
filter { line -> line.replaceAll('@VERSION@', productVersion) }
173+
174+
println("Copied with jar version ${productVersion} to approvalTest directory")
175+
171176
}
172177

173178
task prepareDistribution(type: Zip) {
@@ -185,37 +190,52 @@ task prepareDistribution(type: Zip) {
185190
rename("build/libs/(.*)", "\$1")
186191
}
187192

188-
from ("${projectDir}/GradleTemp")
193+
from ("${projectDir}/gradleBuildTemp")
189194

190195
doLast {
191-
delete "GradleTemp"
196+
delete "${projectDir}/gradleBuildTemp"
192197
}
193198
}
194199

195-
def approvalTest = tasks.register("approvalTest", Test) {
200+
def approvalTest
201+
approvalTest = tasks.register("approvalTest", Test) {
196202
description 'Run approval test only'
197-
dependsOn fatJar
203+
dependsOn copyJarToBin, copyRunScripts
204+
198205
def output = -1
206+
def weRanATest = false
207+
def runningOs = OS_NAME.toLowerCase()
199208

200-
if ("${OS_NAME}" == "linux") {
209+
if (runningOs == "linux") {
201210
println "Linux detected"
211+
212+
// grant execute permission to run script
213+
def procChmod = "chmod +x ./approvaltest".execute()
214+
procChmod.waitForProcessOutput(System.out, System.err)
215+
202216
def proc = "./approvaltest".execute()
203217
proc.waitForProcessOutput(System.out, System.err)
218+
weRanATest = true
204219
}
205-
if ("${OS_NAME}".toLowerCase().contains("windows")) {
220+
if (runningOs.contains("windows")) {
206221
println "Windows detected"
207222
def proc = "./approvaltestWin.cmd".execute()
208223
proc.waitForProcessOutput(System.out, System.err)
224+
weRanATest = true
209225
}
210226

211-
output = new BuildHelper().compareFiles(approvalExpectedOutput, approvalActualOutput, true)
212-
println "exit from compare: ${output}"
213-
214-
if (output != 0) {
215-
println "*** FAIL ***"
216-
throw new StopExecutionException("${approvalExpectedOutput} and ${approvalActualOutput} are different")
227+
if (!weRanATest){
228+
println "No prepared test for the OS detected: ${runningOs} - skipping"
217229
} else {
218-
println "${approvalExpectedOutput} matches ${approvalActualOutput} - PASS"
230+
output = new BuildHelper().compareFiles(approvalExpectedOutput, approvalActualOutput, true)
231+
println "exit from compare: ${output}"
232+
233+
if (output != 0) {
234+
println "*** FAIL ***"
235+
throw new StopExecutionException("${approvalExpectedOutput} and ${approvalActualOutput} are different")
236+
} else {
237+
println "${approvalExpectedOutput} matches ${approvalActualOutput} - PASS"
238+
}
219239
}
220240
}
221241

@@ -241,7 +261,7 @@ task osInfo {
241261
}
242262

243263
class BuildHelper{
244-
int compareFiles(String file1, String file2, boolean trimLines){
264+
static int compareFiles(String file1, String file2, boolean trimLines){
245265
BufferedReader reader1
246266
BufferedReader reader2
247267
try{
-191 KB
Binary file not shown.
-227 KB
Binary file not shown.
-227 KB
Binary file not shown.
-227 KB
Binary file not shown.

0 commit comments

Comments
 (0)