Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ddh 13413 fix missing output #353

Merged
merged 4 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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](https://neopragma.com/projects/cobol-check/).)
- 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
Loading