Skip to content

Commit

Permalink
Merge pull request #328 from openmainframeproject/211-support-for-sho…
Browse files Browse the repository at this point in the history
…wing-all-tests-in-curent-workspace-and-picking-which-tests-to-run-in-vs-code-extension

Extension Config can now take absolute path
  • Loading branch information
Rune-Christensen authored Oct 23, 2023
2 parents ab41fe6 + 9eae3ac commit b0b39da
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 29 deletions.
Binary file modified build/distributions/cobol-check-0.2.8.zip
Binary file not shown.
25 changes: 16 additions & 9 deletions config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ cobolcheck.decimalPointIsComma = false
cobolcheck.append.rules = null

#---------------------------------------------------------------------------------------------------------------------
# Path for the generated Cobol test code
# Path for the generated Cobol test code and the executeable file
# On Linux begin the path with a / to make it absolute and an x:\\ or x:/ to do he same on Windows.
# Default: ./
#---------------------------------------------------------------------------------------------------------------------
cobolcheck.test.program.path = ./
# cobolcheck.test.program.path = /home/myName/temp
# cobolcheck.test.program.path = c:\\Developer\\temp
# cobolcheck.test.program.path = c:/Developer/temp
cobolcheck.test.program.path = Cobol-check

#---------------------------------------------------------------------------------------------------------------------
# Suffix to append to the name of each program under test to produce the name of the corresponding
Expand All @@ -74,7 +78,7 @@ cobolcheck.test.unmockcall.display = false
# Path for the generated testsuite parse error log
# Default: ./
#---------------------------------------------------------------------------------------------------------------------
testsuite.parser.error.log.path = ./
testsuite.parser.error.log.path = Cobol-check

#---------------------------------------------------------------------------------------------------------------------
# Name of the generated testsuite parse error log file - with extension
Expand Down Expand Up @@ -127,13 +131,13 @@ test.suite.directory = src/test/cobol
#---------------------------------------------------------------------------------------------------------------------
# Location of test output. File extension is determined by a given format.
#---------------------------------------------------------------------------------------------------------------------
test.results.file = output/testResults
test.results.file = vs-code-extension/Cobol-check/output/testResults

#---------------------------------------------------------------------------------------------------------------------
# Determines the format of the test results written to the output file.
# Supported formats: txt, xml, html.
#---------------------------------------------------------------------------------------------------------------------
test.results.format = txt
test.results.format = html

#---------------------------------------------------------------------------------------------------------------------
# Determines the format style of the test results written to the output file.
Expand All @@ -143,7 +147,7 @@ test.results.format = txt
# Other formats and styles can be used interchangeably.
# Supported styles: directOutput, JUnit, tableDocument, tableEmbed
#---------------------------------------------------------------------------------------------------------------------
test.results.format.style = directOutput
test.results.format.style = tableDocument

#---------------------------------------------------------------------------------------------------------------------
# If application source filenames have a suffix, specify it here without the period or dot.
Expand All @@ -168,7 +172,7 @@ application.copybook.filename.suffix = CBL,cbl,COB,cob,CPY,cpy
# This is the relative or absolute path of the concatenated file. If not specified, the default
# is "./ALLTESTS" relative to the directory in which Cobol Check was started.
#---------------------------------------------------------------------------------------------------------------------
concatenated.test.suites = ./ALLTESTS
concatenated.test.suites = Cobol-check/ALLTESTS

#---------------------------------------------------------------------------------------------------------------------
# The GnuCOBOL compiler has a lot of different compile options.
Expand All @@ -180,7 +184,7 @@ concatenated.test.suites = ./ALLTESTS
# Example:
# gnucobol.compile.options = -std=ibm,-fsingle-quote
#---------------------------------------------------------------------------------------------------------------------
gnucobol.compile.options = null
gnucobol.compile.options = -std=ibm,-fsingle-quote,-fnot-reserved=EVENT

#---------------------------------------------------------------------------------------------------------------------
# Shell scripts and JCL files for executing your test suites.
Expand All @@ -193,10 +197,13 @@ gnucobol.compile.options = null
# Cobol Check will select one of these entries based on which platform it thinks it's running on.
#---------------------------------------------------------------------------------------------------------------------

cobolcheck.script.directory = scripts
cobolcheck.script.directory = Cobol-check/scripts
linux.process = linux_gnucobol_run_tests
osx.process = linux_gnucobol_run_tests
freebsd.process = linux_gnucobol_run_tests
windows.process = windows_gnucobol_run_tests.cmd
zos.process =
unix.process = linux_gnucobol_run_tests
cobol_run_tests
cobol_run_tests

5 changes: 3 additions & 2 deletions scripts/linux_gnucobol_run_tests
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# GnuCOBOL 2.2 or later is installed and on the path. Its executable or alias or symlink is named "cobc".

cobc -x $@
cd "$(dirname $1)"
cobc -xj $@
name=$(echo "$1" | cut -f 1 -d '.')
"${name}"
"${name}"
5 changes: 4 additions & 1 deletion scripts/windows_gnucobol_run_tests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ rem
rem Assumptions:
rem
rem GnuCOBOL 3.+ is installed and on the path. Its executable or alias or symlink is named "cobc".
cobc -x %* && "%~dpn1"
%~d1
cd %~p1
cobc -xj %*
%~n1
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ private static String getCorrectRunContext(String path){
if (path.startsWith(".") && path.length() > 0){
path = path.substring(1);
}
if (path.length() > 0 && (path.startsWith("/") || path.substring(1,3).equals(":\\") || path.substring(1,3).equals(":/"))){
return StringHelper.adjustPathString(path);
}
return StringHelper.adjustPathString(PathHelper.endWithFileSeparator(runDirectory) + path);
}
return StringHelper.adjustPathString(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FileNameMatcher extends SimpleFileVisitor<Path> {
private boolean defaultToAllFiles = false;

public FileNameMatcher(String pattern) {
if (pattern.length() == 0) {
if (pattern.length() == 0 || pattern.equals("null")) {
defaultToAllFiles = true;
}
matcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern);
Expand Down
10 changes: 7 additions & 3 deletions vs-code-extension/Cobol-check/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ cobolcheck.decimalPointIsComma = false
cobolcheck.append.rules = null

#---------------------------------------------------------------------------------------------------------------------
# Path for the generated Cobol test code
# Path for the generated Cobol test code and the executeable file
# On Linux begin the path with a / to make it absolute and an x:\\ or x:/ to do he same on Windows.
# Default: ./
#---------------------------------------------------------------------------------------------------------------------
# cobolcheck.test.program.path = /home/myName/temp
# cobolcheck.test.program.path = c:\\Developer\\temp
# cobolcheck.test.program.path = c:/Developer/temp
cobolcheck.test.program.path = Cobol-check

#---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -120,7 +124,7 @@ test.suite.directory = src/test/cobol
#---------------------------------------------------------------------------------------------------------------------
# Location of test output. File extension is determined by a given format.
#---------------------------------------------------------------------------------------------------------------------
test.results.file = Cobol-check/output/testResults
test.results.file = vs-code-extension/Cobol-check/output/testResults

#---------------------------------------------------------------------------------------------------------------------
# Determines the format of the test results written to the output file.
Expand All @@ -147,7 +151,7 @@ application.source.filename.suffix = CBL,cbl,COB,cob
# If application copybook filenames have a suffix, specify it here without the period or dot
# e.g. application.copybook.filename.suffix = CBL
#---------------------------------------------------------------------------------------------------------------------
application.copybook.filename.suffix = CBL,cbl,COB,cob
application.copybook.filename.suffix = CBL,cbl,COB,cob,CPY,cpy

#---------------------------------------------------------------------------------------------------------------------
# Optional override of system default Locale for log messages and exception messages.
Expand Down
14 changes: 9 additions & 5 deletions vs-code-extension/Cobol-check/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ cobolcheck.decimalPointIsComma = false
cobolcheck.append.rules = null

#---------------------------------------------------------------------------------------------------------------------
# Path for the generated Cobol test code
# Path for the generated Cobol test code and the executeable file
# On Linux begin the path with a / to make it absolute and an x:\\ or x:/ to do he same on Windows.
# Default: ./
#---------------------------------------------------------------------------------------------------------------------
cobolcheck.test.program.path = Cobol-check
# cobolcheck.test.program.path = /home/myName/temp
# cobolcheck.test.program.path = c:\\Developer\\temp
# cobolcheck.test.program.path = c:/Developer/temp
cobolcheck.test.program.path = ./

#---------------------------------------------------------------------------------------------------------------------
# Suffix to append to the name of each program under test to produce the name of the corresponding
Expand All @@ -67,7 +71,7 @@ cobolcheck.test.program.name = CC##99.CBL
# Path for the generated testsuite parse error log
# Default: ./
#---------------------------------------------------------------------------------------------------------------------
testsuite.parser.error.log.path = Cobol-check
testsuite.parser.error.log.path = ./

#---------------------------------------------------------------------------------------------------------------------
# Name of the generated testsuite parse error log file - with extension
Expand Down Expand Up @@ -120,7 +124,7 @@ test.suite.directory = src/test/cobol
#---------------------------------------------------------------------------------------------------------------------
# Location of test output. File extension is determined by a given format.
#---------------------------------------------------------------------------------------------------------------------
test.results.file = Cobol-check/output/testResults
test.results.file = vs-code-extension/Cobol-check/output/testResults

#---------------------------------------------------------------------------------------------------------------------
# Determines the format of the test results written to the output file.
Expand All @@ -147,7 +151,7 @@ application.source.filename.suffix = CBL,cbl,COB,cob
# If application copybook filenames have a suffix, specify it here without the period or dot
# e.g. application.copybook.filename.suffix = CBL
#---------------------------------------------------------------------------------------------------------------------
application.copybook.filename.suffix = CBL,cbl,COB,cob
application.copybook.filename.suffix = CBL,cbl,COB,cob,CPY,cpy

#---------------------------------------------------------------------------------------------------------------------
# Optional override of system default Locale for log messages and exception messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
# GnuCOBOL 2.2 or later is installed and on the path.
# Its executable or alias or symlink is named "cobc".

cd "$(dirname $1)"
cobc -xj $@
name=$(echo "$1" | cut -f 1 -d '.')
"${name}"
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@echo off
:: Windows - compile and execute a test Cobol program
::
:: Assumptions:
::
:: GnuCOBOL 2.2 or later is installed and on the path.
:: Its executable or alias or symlink is named "cobc".

cobc -xj %* && %~n1
rem Windows - compile and execute a test Cobol program
rem
rem Assumptions:
rem
rem GnuCOBOL 3.+ is installed and on the path. Its executable or alias or symlink is named "cobc".
%~d1
cd %~p1
cobc -xj %*
%~n1

0 comments on commit b0b39da

Please sign in to comment.