Skip to content

Commit

Permalink
Fixed - Reverted previous fix to double output as it caused issues wi…
Browse files Browse the repository at this point in the history
…th the output sometimes not returning the entire output. Fixed windows run test cmd file instead. Addtionally bumped the vscode version to release it to market place

Signed-off-by: Thomas Christensen <tac@bankdata.dk>
  • Loading branch information
Thomas Christensen committed Oct 7, 2024
1 parent d9abb9a commit 599a760
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 37 deletions.
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.12\] 2024-10-07
- Reverted unit test result twice fix and fixed the windows run tests script instead. This should fix double output error and missing output errors.
- Bumped versions to properly release vscode extension that uses new cobol-check.

## \[0.2.11\] 2024-05-13
- Fixing bug when cobolcheck.test.program.name was ending with white spaces.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ As of March 2022 we could use help with:

## Downloads

Version 0.2.10 pre-release is available!
Version 0.2.12 pre-release is available!

[//]: # (- Find the download on the project home page on the [Neo Pragma site]&#40;https://neopragma.com/projects/cobol-check/&#41;.)
- Find distributions here: [Cobol Check Ditributions](https://github.com/openmainframeproject/cobol-check/tree/Developer/build/distributions).
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.11'
def productVersion = '0.2.12'
def productName = 'cobol-check'
group = 'org.openmainframeproject'
description = 'Unit testing framework for Cobol'
Expand Down
Binary file added build/distributions/cobol-check-0.2.12.zip
Binary file not shown.
3 changes: 1 addition & 2 deletions scripts/windows_gnucobol_run_tests.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ 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
cobc -xj %*
Original file line number Diff line number Diff line change
Expand Up @@ -61,42 +61,20 @@ public void writeProcessOutputToTestResultsFile(Process proc, TestOutputFormat f

private void getProcessOut(Process proc) {
StringBuilder processErrorBuilder = new StringBuilder();
StringBuilder processInputBuilder = new StringBuilder();
final Object lock = new Object(); // For synchronizing access if necessary

Thread inputThread = new Thread(() -> {
Reader reader = new InputStreamReader(proc.getInputStream());
int maxBytesToReadFromCobolCheck = 25000;
char tempReadBuffer[] = new char[maxBytesToReadFromCobolCheck];
int writeOffset = 0;
int numberOfCharsRead = 0;
char cobolCheckOutput[] = null;
try {
synchronized (lock) {
numberOfCharsRead = reader.read(tempReadBuffer, writeOffset, maxBytesToReadFromCobolCheck);
if(numberOfCharsRead > 0) {
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);
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);
}
try (BufferedReader stdOut = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
String s;
while ((s = stdOut.readLine()) != null) {
synchronized (lock) {
processInputBuilder.append(s).append(Constants.NEWLINE);
}
reader.close();
}
} catch (IOException e) {
Log.warn(Messages.get("WRN007"));
}
processInput = "";
for (int i = 0; i < numberOfCharsRead; i++) {
processInput += cobolCheckOutput[i];
}
});

Thread errorThread = new Thread(() -> {
Expand Down Expand Up @@ -125,7 +103,7 @@ private void getProcessOut(Process proc) {
}

// Convert StringBuilder to String, removing the last NEWLINE if necessary
processInput = StringHelper.removeLastIndex(processInput.toString());
processInput = StringHelper.removeLastIndex(processInputBuilder.toString());
processError = StringHelper.removeLastIndex(processErrorBuilder.toString());
}

Expand Down
4 changes: 4 additions & 0 deletions vs-code-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log

All notable changes to the "cobol-unit-test" extension will be documented in this file. Versioning according to SemVer: https://semver.org/

## [0.4.5] 04.04.2024
- Now using COBOL Check version 0.2.12

## [0.4.4] 04.04.2024
- Now using COBOL Check version 0.2.9

Expand Down
Binary file not shown.
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.11.jar');
let cobolCheckJarPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/bin/cobol-check-0.2.12.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.11.jar');
let cobolCheckJarPath = appendPath(externalVsCodeInstallationDir, 'Cobol-check/bin/cobol-check-0.2.12.jar');



Expand Down
4 changes: 2 additions & 2 deletions vs-code-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Snippets"
],
"description": "Extension for running unit tests in Cobol",
"version": "0.4.4",
"version": "0.4.5",
"icon": "images/cobol-check-logo-small.png",
"repository": {
"type": "git",
Expand Down Expand Up @@ -40,7 +40,7 @@
}
],
"description": "Extension for running unit tests in Cobol",
"version": "0.4.4",
"version": "0.4.5",
"icon": "images/cobol-check-logo-small.png",
"repository": {
"type": "git",
Expand Down

0 comments on commit 599a760

Please sign in to comment.