Skip to content

Commit

Permalink
Initial commit on branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Egeberg Hansen committed May 13, 2024
1 parent 4789318 commit 4c2d646
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,5 @@ output/testResults.txt
approval-test-actual.txt
default.conf
null
ParserErrorLog.txt
ParserErrorLog.txt
/zapp.json
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Mock SQL tables
- Mock batch file I/O

## \[0.2.9\] 2024-04-23
### Not released
- Fixing bug in showing unit test result twice.

## \[0.2.8\] 2023-10-17
### Implemented
- Proper handling of END-EXEC without trailing period in WORKING-STORAGE
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'jacoco'
}

def productVersion = '0.2.8'
def productVersion = '0.2.9'
def productName = 'cobol-check'
group = 'org.openmainframeproject'
description = 'Unit testing framework for Cobol'
Expand Down
Binary file added build/distributions/cobol-check-0.2.9.zip
Binary file not shown.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ public Formatter(DataTransferObjectStyle dataTransferObjectStyle){
*/
public void parseText(String text, String testSuitePackage){
String[] lines = text.split(Constants.NEWLINE);

for (String line : lines){
if (line.trim().isEmpty() || line.startsWith("==="))
continue;


//Getting Test Suite name
if (line.trim().equalsIgnoreCase(testSuiteKeyword))
expectTestSuiteName = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ int launchProgram(ProcessLauncher launcher, String programPath,
int launchProgram(ProcessLauncher launcher, String programPath) throws InterruptedException {
if (launcher == null) return -1;
Process process = launcher.run(programPath);

int exitCode = 1;
exitCode = process.waitFor();
return exitCode;
return exitCode;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public void runTestProgram(String programName, boolean isLastRun) throws Interru
int exitCode = launcher.launchProgram(pLauncher, PathHelper.getTestSourceOutPath(), (proc) ->
processOutputWriter.writeProcessOutputToTestResultsFile(proc, Config.getTestResultFormat(),
Config.getTestResultFormatStyle(), programName, true, isLastRun));

if (processOutputWriter.writeWasSuccesful){
Log.info(Messages.get("INF011", processName, processOutputWriter.getTestResultsFilePath()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,45 @@ public void writeProcessOutputToTestResultsFile(Process proc, TestOutputFormat f
}

private void getProcessOut(Process proc) {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream()));
Reader reader = new InputStreamReader(proc.getInputStream());
int maxBytesToReadFromCobolCheck = 25000;
char tempReadBuffer[] = new char[maxBytesToReadFromCobolCheck];
int writeOffset = 0;
int numberOfCharsRead = 0;
char cobolCheckOutput[] = null;
try {
numberOfCharsRead = reader.read(tempReadBuffer, writeOffset, maxBytesToReadFromCobolCheck);
System.out.println("ProcessOutputWriter: numberOfCharsRead = " + numberOfCharsRead);
if(numberOfCharsRead == maxBytesToReadFromCobolCheck) {
int largeMaxBytesToReadFromCobolCheck = 100000;
char largeTempReadBuffer[] = new char[maxBytesToReadFromCobolCheck + largeMaxBytesToReadFromCobolCheck];
System.arraycopy(tempReadBuffer, 0, largeTempReadBuffer, 0, tempReadBuffer.length);
int largeNumberOfCharsRead = reader.read(largeTempReadBuffer, tempReadBuffer.length, largeMaxBytesToReadFromCobolCheck);
System.out.println("ProcessOutputWriter: largeNumberOfCharsRead = " + largeNumberOfCharsRead);
numberOfCharsRead += largeNumberOfCharsRead;
cobolCheckOutput = new char[numberOfCharsRead];
System.arraycopy(largeTempReadBuffer, 0, cobolCheckOutput, 0, numberOfCharsRead);
}
else {
cobolCheckOutput = new char[numberOfCharsRead];
System.arraycopy(tempReadBuffer, 0, cobolCheckOutput, 0, numberOfCharsRead);
}
reader.close();
System.out.println("ProcessOutputWriter: numberOfCharsRead = " + numberOfCharsRead);
}
catch(IOException e) {
System.out.println("ProcessOutputWriter - getProcessOut - e = " + e);
}

BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
processInput = "";
processError = "";

processError = "";
try{
String s = null;
while ((s = stdInput.readLine()) != null){
if (s != null)
processInput += s + Constants.NEWLINE;
processInput = "";
for (int i = 0; i < numberOfCharsRead; i++) {
processInput += cobolCheckOutput[i];
}

while ((s = stdError.readLine()) != null){
if (s != null)
processError += s + Constants.NEWLINE;
Expand All @@ -80,11 +107,9 @@ private void getProcessOut(Process proc) {
processInput = StringHelper.removeLastIndex(processInput);
processError = StringHelper.removeLastIndex(processError);

stdInput.close();
stdError.close();
}
catch (IOException ex)
{
catch (IOException ex) {
Log.warn(Messages.get("WRN007"));
}
}
Expand Down
Binary file not shown.
89 changes: 88 additions & 1 deletion vs-code-extension/Cobol-check/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,94 @@ windows.process = windows_gnucobol_run_tests.cmd
zos.process =
unix.process = linux_gnucobol_run_tests
cobol_run_tests
cobol_run_tests



























































































Expand Down
2 changes: 1 addition & 1 deletion vs-code-extension/client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { getContentFromFilesystem, MarkdownTestData, TestCase, testData, TestFil
let externalVsCodeInstallationDir = vscode.extensions.getExtension("openmainframeproject.cobol-check-extension").extensionPath;
let configPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/config.properties');
let defaultConfigPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/default.properties');
let cobolCheckJarPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/bin/cobol-check-0.2.8.jar');
let cobolCheckJarPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/bin/cobol-check-0.2.9.jar');
let currentPlatform = getOS();


Expand Down
2 changes: 1 addition & 1 deletion vs-code-extension/client/src/services/TestTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { handleCobolCheckOut } from '../Helpers/ExtensionHelper';
const textDecoder = new TextDecoder('utf-8');
let externalVsCodeInstallationDir = vscode.extensions.getExtension("openmainframeproject.cobol-check-extension").extensionPath;
let configPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/config.properties');
let cobolCheckJarPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/bin/cobol-check-0.2.8.jar');
let cobolCheckJarPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/bin/cobol-check-0.2.9.jar');



Expand Down

0 comments on commit 4c2d646

Please sign in to comment.