From c21a078dc61d2dca34614adbc33fde8781536a3a Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sun, 28 May 2023 14:28:40 +0900 Subject: [PATCH 1/3] temp: update Makefile.am and cicd.yml --- .github/workflows/cicd.yml | 82 +++++++++++++++++++------------------- .gitignore | 2 +- tests/cobol85/Makefile.am | 16 ++++---- tests/cobol85/Makefile.in | 16 ++++---- tests/cobol85/summary.log | 14 +++++++ 5 files changed, 72 insertions(+), 58 deletions(-) create mode 100644 tests/cobol85/summary.log diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index f12dcdb3..ed1fe091 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -39,53 +39,53 @@ jobs: make install export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - - name: Run tests "command-line-options" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./command-line-options - cd ../ + #- name: Run tests "command-line-options" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./command-line-options + # cd ../ - - name: Run tests "misc" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./misc - cd ../ + #- name: Run tests "misc" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./misc + # cd ../ - - name: Run tests "data-rep" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./data-rep - cd ../ + #- name: Run tests "data-rep" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./data-rep + # cd ../ - - name: Run tests "i18n_sjis" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./i18n_sjis + #- name: Run tests "i18n_sjis" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./i18n_sjis - - name: Run tests "jp-compat" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./jp-compat - cd ../ + #- name: Run tests "jp-compat" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./jp-compat + # cd ../ - - name: Run tests "run" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./run - cd ../ + #- name: Run tests "run" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./run + # cd ../ - - name: Run tests "syntax" - run: | - export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/ - ./syntax - cd ../ + #- name: Run tests "syntax" + # run: | + # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + # cd tests/ + # ./syntax + # cd ../ - name: Run NIST test run: | diff --git a/.gitignore b/.gitignore index ede1a6f5..d0a3341d 100644 --- a/.gitignore +++ b/.gitignore @@ -60,7 +60,7 @@ tests/cobol85/*/*.log tests/cobol85/*/tmp.cbl tests/cobol85/*/report.txt tests/cobol85/*/XXXXX* -tests/cobol85/summary.log +#tests/cobol85/summary.log texi/Makefile bin/.deps/ bin/cob-config diff --git a/tests/cobol85/Makefile.am b/tests/cobol85/Makefile.am index 50e56cd0..2736bb96 100755 --- a/tests/cobol85/Makefile.am +++ b/tests/cobol85/Makefile.am @@ -18,15 +18,15 @@ COBOL = cobj -std=cobol85 COB85DIR = "`cd $(srcdir) && pwd`" test: $(MODULES_MAKEFILES) - @for m in $(MODULES); do \ - (cd $$m && make test) \ - done - perl $(srcdir)/summary.pl $(MODULES) > summary.log - @for MODULE in $(MODULES); do\ - (cat $$MODULE/report.txt) \ - done cat summary.log - head -n -2 summary.log | tail -n +4 | awk '$$4 != 0 || $$5 != 0 {exit 1}' + cat summary.log | tail -n 1 | awk '$$4 != 0 || $$5 != 0 || $$2 != $$3 {exit 1}' +#@for m in $(MODULES); do \ +# (cd $$m && make test) \ +#done +#perl $(srcdir)/summary.pl $(MODULES) > summary.log +#@for MODULE in $(MODULES); do\ +# (cat $$MODULE/report.txt) \ +#done save: @for m in $(MODULES); do \ diff --git a/tests/cobol85/Makefile.in b/tests/cobol85/Makefile.in index 0fa84e47..bbf0ec10 100644 --- a/tests/cobol85/Makefile.in +++ b/tests/cobol85/Makefile.in @@ -486,15 +486,15 @@ uninstall-am: test: $(MODULES_MAKEFILES) - @for m in $(MODULES); do \ - (cd $$m && make test) \ - done - perl $(srcdir)/summary.pl $(MODULES) > summary.log - @for MODULE in $(MODULES); do\ - (cat $$MODULE/report.txt) \ - done cat summary.log - head -n -2 summary.log | tail -n +4 | awk '$$4 != 0 || $$5 != 0 {exit 1}' + cat summary.log | tail -n 1 | awk '$$4 != 0 || $$5 != 0 || $$2 != $$3 {exit 1}' +#@for m in $(MODULES); do \ +# (cd $$m && make test) \ +#done +#perl $(srcdir)/summary.pl $(MODULES) > summary.log +#@for MODULE in $(MODULES); do\ +# (cat $$MODULE/report.txt) \ +#done save: @for m in $(MODULES); do \ diff --git a/tests/cobol85/summary.log b/tests/cobol85/summary.log new file mode 100644 index 00000000..cf35d952 --- /dev/null +++ b/tests/cobol85/summary.log @@ -0,0 +1,14 @@ +------ Directory Information ------- --- Total Tests Information --- +Module Programs Executed Error Crash Pass Fail Deleted Inspect Total +------ -------- -------- ----- ----- ----- ---- ------- ------- ----- +NC 90 90 0 0 4352 0 6 11 4369 +SM 15 15 0 0 290 0 3 1 294 +IC 13 13 0 0 97 0 0 0 97 +SQ 81 81 0 0 512 0 6 81 599 +IX 39 38 0 0 506 1 1 0 508 +ST 39 39 0 0 278 0 0 0 278 +SG 5 5 0 0 193 0 0 0 193 +OB 5 5 0 0 16 0 0 0 16 +IF 42 42 0 0 732 0 0 0 732 +------ -------- -------- ----- ----- ----- ---- ------- ------- ----- +Total 329 328 0 0 6976 1 16 93 7086 From 40d6dc195d5fd9cde43d49128ca95937c19e58f3 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sun, 28 May 2023 15:30:34 +0900 Subject: [PATCH 2/3] temp: fix the bug of RELATIVE files --- .github/workflows/cicd.yml | 4 +++- .gitignore | 2 +- .../libcobj/file/CobolRelativeFile.java | 14 ++++++++------ tests/cobol85/Makefile.am | 14 +++++++------- tests/cobol85/Makefile.in | 14 +++++++------- tests/cobol85/report.pl | 1 - tests/cobol85/summary.log | 14 -------------- 7 files changed, 26 insertions(+), 37 deletions(-) delete mode 100644 tests/cobol85/summary.log diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index ed1fe091..a6803e93 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -90,7 +90,9 @@ jobs: - name: Run NIST test run: | export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - cd tests/cobol85/ + cd tests/cobol85 + make IX/Makefile + cd IX make test #- name: Run tests "i18n_utf8" diff --git a/.gitignore b/.gitignore index d0a3341d..ede1a6f5 100644 --- a/.gitignore +++ b/.gitignore @@ -60,7 +60,7 @@ tests/cobol85/*/*.log tests/cobol85/*/tmp.cbl tests/cobol85/*/report.txt tests/cobol85/*/XXXXX* -#tests/cobol85/summary.log +tests/cobol85/summary.log texi/Makefile bin/.deps/ bin/cob-config diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java index 3ec7225e..a13dea7c 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java @@ -23,6 +23,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.ByteBuffer; import jp.osscons.opensourcecobol.libcobj.data.AbstractCobolField; public class CobolRelativeFile extends CobolFile { @@ -226,7 +227,7 @@ public int start_(int cond, AbstractCobolField key) { kindex++; } - for (; ; ) { + for (;;) { off = kindex * relsize; try { this.fp.seek((long) off); @@ -283,7 +284,7 @@ public int read_(AbstractCobolField key, int readOpts) { return COB_STATUS_23_KEY_NOT_EXISTS; } - if (this.record.getSize() == 0) { + if (ByteBuffer.wrap(size).getLong() == 0) { this.fp.seek(this.fp.getFilePointer() - size.length); return COB_STATUS_23_KEY_NOT_EXISTS; } @@ -293,7 +294,9 @@ public int read_(AbstractCobolField key, int readOpts) { } this.record.getDataStorage().memcpy(bytes); return COB_STATUS_00_SUCCESS; - } catch (FileNotFoundException e) { + } catch ( + + FileNotFoundException e) { return COB_STATUS_30_PERMANENT_ERROR; } catch (IOException e) { return COB_STATUS_30_PERMANENT_ERROR; @@ -310,7 +313,7 @@ public int readNext(int readOpts) { try { relsize = this.record_max + size.length; - for (; ; ) { + for (;;) { if (this.fp.read(size, offset, size.length) != size.length) { return COB_STATUS_10_END_OF_FILE; } @@ -326,8 +329,7 @@ public int readNext(int readOpts) { off = this.fp.getFilePointer(); relnum = (int) ((off / relsize) + 1); this.keys[0].getField().setInt(relnum); - if (String.valueOf(relnum).length() - > this.keys[0].getField().getAttribute().getDigits()) { + if (String.valueOf(relnum).length() > this.keys[0].getField().getAttribute().getDigits()) { return COB_STATUS_14_OUT_OF_KEY_RANGE; } } diff --git a/tests/cobol85/Makefile.am b/tests/cobol85/Makefile.am index 2736bb96..a5417af7 100755 --- a/tests/cobol85/Makefile.am +++ b/tests/cobol85/Makefile.am @@ -18,15 +18,15 @@ COBOL = cobj -std=cobol85 COB85DIR = "`cd $(srcdir) && pwd`" test: $(MODULES_MAKEFILES) + @for m in $(MODULES); do \ + (cd $$m && make test) \ + done + perl $(srcdir)/summary.pl $(MODULES) > summary.log + @for MODULE in $(MODULES); do\ + (cat $$MODULE/report.txt) \ + done cat summary.log cat summary.log | tail -n 1 | awk '$$4 != 0 || $$5 != 0 || $$2 != $$3 {exit 1}' -#@for m in $(MODULES); do \ -# (cd $$m && make test) \ -#done -#perl $(srcdir)/summary.pl $(MODULES) > summary.log -#@for MODULE in $(MODULES); do\ -# (cat $$MODULE/report.txt) \ -#done save: @for m in $(MODULES); do \ diff --git a/tests/cobol85/Makefile.in b/tests/cobol85/Makefile.in index bbf0ec10..c384d36c 100644 --- a/tests/cobol85/Makefile.in +++ b/tests/cobol85/Makefile.in @@ -486,15 +486,15 @@ uninstall-am: test: $(MODULES_MAKEFILES) + @for m in $(MODULES); do \ + (cd $$m && make test) \ + done + perl $(srcdir)/summary.pl $(MODULES) > summary.log + @for MODULE in $(MODULES); do\ + (cat $$MODULE/report.txt) \ + done cat summary.log cat summary.log | tail -n 1 | awk '$$4 != 0 || $$5 != 0 || $$2 != $$3 {exit 1}' -#@for m in $(MODULES); do \ -# (cd $$m && make test) \ -#done -#perl $(srcdir)/summary.pl $(MODULES) > summary.log -#@for MODULE in $(MODULES); do\ -# (cat $$MODULE/report.txt) \ -#done save: @for m in $(MODULES); do \ diff --git a/tests/cobol85/report.pl b/tests/cobol85/report.pl index 4250a721..40709eae 100755 --- a/tests/cobol85/report.pl +++ b/tests/cobol85/report.pl @@ -54,7 +54,6 @@ $skip{SG203A} = 1; $skip{OBNC1M} = 1; $skip{OBNC2M} = 1; -#$skip{IX106A} = 1; $skip{NC127A} = 1; $skip{NC219A} = 1; $skip{IC222A} = 1; diff --git a/tests/cobol85/summary.log b/tests/cobol85/summary.log deleted file mode 100644 index cf35d952..00000000 --- a/tests/cobol85/summary.log +++ /dev/null @@ -1,14 +0,0 @@ ------- Directory Information ------- --- Total Tests Information --- -Module Programs Executed Error Crash Pass Fail Deleted Inspect Total ------- -------- -------- ----- ----- ----- ---- ------- ------- ----- -NC 90 90 0 0 4352 0 6 11 4369 -SM 15 15 0 0 290 0 3 1 294 -IC 13 13 0 0 97 0 0 0 97 -SQ 81 81 0 0 512 0 6 81 599 -IX 39 38 0 0 506 1 1 0 508 -ST 39 39 0 0 278 0 0 0 278 -SG 5 5 0 0 193 0 0 0 193 -OB 5 5 0 0 16 0 0 0 16 -IF 42 42 0 0 732 0 0 0 732 ------- -------- -------- ----- ----- ----- ---- ------- ------- ----- -Total 329 328 0 0 6976 1 16 93 7086 From 9c5cc8394ca5b3938c15b211757e9fa9ef7ae9cb Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Sun, 28 May 2023 15:40:50 +0900 Subject: [PATCH 3/3] update: format java files and update cicd.yml --- .github/workflows/cicd.yml | 84 +++++++++---------- .../libcobj/file/CobolRelativeFile.java | 13 ++- 2 files changed, 47 insertions(+), 50 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index a6803e93..132ae753 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -39,60 +39,58 @@ jobs: make install export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - #- name: Run tests "command-line-options" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./command-line-options - # cd ../ + - name: Run tests "command-line-options" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./command-line-options + cd ../ - #- name: Run tests "misc" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./misc - # cd ../ + - name: Run tests "misc" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./misc + cd ../ - #- name: Run tests "data-rep" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./data-rep - # cd ../ + - name: Run tests "data-rep" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./data-rep + cd ../ - #- name: Run tests "i18n_sjis" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./i18n_sjis + - name: Run tests "i18n_sjis" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./i18n_sjis - #- name: Run tests "jp-compat" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./jp-compat - # cd ../ + - name: Run tests "jp-compat" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./jp-compat + cd ../ - #- name: Run tests "run" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./run - # cd ../ + - name: Run tests "run" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./run + cd ../ - #- name: Run tests "syntax" - # run: | - # export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - # cd tests/ - # ./syntax - # cd ../ + - name: Run tests "syntax" + run: | + export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" + cd tests/ + ./syntax + cd ../ - name: Run NIST test run: | export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" cd tests/cobol85 - make IX/Makefile - cd IX make test #- name: Run tests "i18n_utf8" diff --git a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java index a13dea7c..c2d1da70 100644 --- a/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java +++ b/libcobj/src/jp/osscons/opensourcecobol/libcobj/file/CobolRelativeFile.java @@ -19,11 +19,11 @@ package jp.osscons.opensourcecobol.libcobj.file; import java.io.*; +import java.nio.ByteBuffer; import java.nio.channels.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.ByteBuffer; import jp.osscons.opensourcecobol.libcobj.data.AbstractCobolField; public class CobolRelativeFile extends CobolFile { @@ -227,7 +227,7 @@ public int start_(int cond, AbstractCobolField key) { kindex++; } - for (;;) { + for (; ; ) { off = kindex * relsize; try { this.fp.seek((long) off); @@ -294,9 +294,7 @@ public int read_(AbstractCobolField key, int readOpts) { } this.record.getDataStorage().memcpy(bytes); return COB_STATUS_00_SUCCESS; - } catch ( - - FileNotFoundException e) { + } catch (FileNotFoundException e) { return COB_STATUS_30_PERMANENT_ERROR; } catch (IOException e) { return COB_STATUS_30_PERMANENT_ERROR; @@ -313,7 +311,7 @@ public int readNext(int readOpts) { try { relsize = this.record_max + size.length; - for (;;) { + for (; ; ) { if (this.fp.read(size, offset, size.length) != size.length) { return COB_STATUS_10_END_OF_FILE; } @@ -329,7 +327,8 @@ public int readNext(int readOpts) { off = this.fp.getFilePointer(); relnum = (int) ((off / relsize) + 1); this.keys[0].getField().setInt(relnum); - if (String.valueOf(relnum).length() > this.keys[0].getField().getAttribute().getDigits()) { + if (String.valueOf(relnum).length() + > this.keys[0].getField().getAttribute().getDigits()) { return COB_STATUS_14_OUT_OF_KEY_RANGE; } }