From 655d6efc4159ab00257329c7415d9a7da4383c9b Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Wed, 21 Dec 2022 16:50:57 +0900 Subject: [PATCH 1/2] Implement the matrix build --- .github/workflows/cicd.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index ee645300..997fb98d 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -6,17 +6,29 @@ on: jobs: run-tests: + strategy: + matrix: + os: ["ubuntu:22.04", "almalinux:9"] runs-on: ubuntu-latest + container: + image: ${{ matrix.os }} steps: - # Checkout opensource COBOL - - name: Checkout opensource COBOL 4j - uses: actions/checkout@v2 - - name: Install dependencies + - name: Install dependencies on Ubuntu 22.04 + if: matrix.os == 'ubuntu:22.04' run: | - sudo apt-get update - sudo apt-get install default-jdk - sudo apt-get install -y build-essential bison flex gettext texinfo + apt-get update -y + apt-get install -y default-jdk + apt-get install -y build-essential bison flex gettext texinfo automake autoconf libtool + + - name: Install dependencies on AlmaLinux 9 + if: matrix.os == 'almalinux:9' + run: | + dnf -y update + dnf install -y java-17-openjdk-devel gcc gcc-c++ make bison flex automake autoconf libtool diffutils gettext + + - name: Checkout opensource COBOL 4j + uses: actions/checkout@v2 - name: Install opensource COBOL 4j run: | @@ -25,7 +37,7 @@ jobs: export CLASSPATH=":$HOME/.java_lib/sqlite.jar" ./configure --prefix=/usr/ make - sudo make install + make install export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" - name: Make test scripts @@ -93,7 +105,7 @@ jobs: export CLASSPATH=":$HOME/.java_lib/sqlite.jar" ./configure --prefix=/usr/ --with-vbisam --enable-utf8 make - sudo make install + make install export CLASSPATH=":/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/sqlite.jar" ./i18n_utf8 || true cd ../ From 9506d63c15e16f2cfc05dd291f624a5607a54122 Mon Sep 17 00:00:00 2001 From: Yutaro Sakamoto Date: Mon, 30 Jan 2023 16:13:55 +0900 Subject: [PATCH 2/2] Add a test for exchanging Japanese data between COBOL and Java --- tests/misc.at | 2 +- tests/misc.src/java-interface.at | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/misc.at b/tests/misc.at index b31872a2..e1d8f187 100644 --- a/tests/misc.at +++ b/tests/misc.at @@ -24,4 +24,4 @@ m4_include([comp3-is-numeric.at]) m4_include([high-low-value.at]) m4_include([move-sign-leading-separate-to-signed-comp3.at]) m4_include([java-interface.at]) -m4_include([comp3-int.at]) \ No newline at end of file +m4_include([comp3-int.at]) diff --git a/tests/misc.src/java-interface.at b/tests/misc.src/java-interface.at index 904a07a9..3f57ce38 100644 --- a/tests/misc.src/java-interface.at +++ b/tests/misc.src/java-interface.at @@ -472,4 +472,48 @@ jp.osscons.opensourcecobol.libcobj.ui.CobolResultSetException: The result type i jp.osscons.opensourcecobol.libcobj.ui.CobolResultSetException: The result type is not 'int' jp.osscons.opensourcecobol.libcobj.ui.CobolResultSetException: The result type is not 'double' ]) +AT_CLEANUP + +AT_SETUP([Japanese]) + +AT_DATA([b.cbl], [ + identification division. + program-id. b. + data division. + linkage section. + 01 arg-1 pic 9(3). + 01 arg-2 pic N(5). + procedure division using arg-1 arg-2. + display arg-1. + display arg-2. + add 1 to arg-1. + move N"かきくけこ" to arg-2. +]) + +AT_DATA([a.java], [ +import jp.osscons.opensourcecobol.libcobj.ui.*; +public class a { + public static void main(String@<:@@:>@ args) { + b prog = new b(); + CobolResultSet rs = prog.execute(100, "あいうえお"); + try{ + int ret1 = rs.getInt(1); + String ret2 = rs.getString(2); + System.out.println("ret1: " + ret1); + System.out.println("ret2: " + ret2); + } catch(CobolResultSetException e){ + e.printStackTrace(); + } + } +} +]) + +AT_CHECK([cobj b.cbl]) +AT_CHECK([javac -encoding SJIS a.java]) +AT_CHECK([java -Dfile.encoding=SJIS a], [0], +[100 +あいうえお +ret1: 101 +ret2: かきくけこ +]) AT_CLEANUP \ No newline at end of file