Skip to content

Commit 79b9a00

Browse files
ci: run autotest-based tests on Windows using Git Bash (#823)
* ci: run other tests on windows * fix: tests/atlocal-win.env * ci: fix CLASSPATH * ci: fix windows-test-other.yml * ci: replace cobj with ${COBJ} * fix(tests): make command-line-options tests work on Windows - Introduce PATHSEP variable (`:` on Unix, `;` on Windows) in atlocal files - Use ${PATHSEP} for CLASSPATH separators in m.at and jar.at - Skip debug.at on Windows pending cobj.exe -debug segfault fix * fix(tests): skip jar.at on Windows due to cobj.exe -java-package bug cobj.exe generates malformed jar paths when using -java-package option on Windows, producing "Parameter format not correct" errors. * fix(tests): skip two jp-compat tests on Windows - Skip COB_DATE CURRENT-DATE time test (requires GNU date -d and +%s) - Skip SEARCH KEY IN RHS test (cobj.exe segfaults on Windows) * fix(tests): skip 8 run tests on Windows due to cobj.exe bugs - Skip subscripts out-of-bounds tests (2): cobj.exe segfault - Skip ref-mod tests (3): cobj.exe segfault - Skip MOVE with refmod test (1): cobj.exe segfault - Skip PROGRAM-ID case tests (2): class/file name case mismatch
1 parent ebed424 commit 79b9a00

51 files changed

Lines changed: 471 additions & 218 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pull-request.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
windows-build:
154154
needs: check-workflows
155155
uses: ./.github/workflows/windows-build.yml
156-
with:
156+
with:
157157
upload-artifacts: true
158158

159159
windows-test:
@@ -165,6 +165,28 @@ jobs:
165165
with:
166166
test-name: ${{ matrix.test_name }}
167167

168+
windows-generate-test-scripts:
169+
needs: check-workflows
170+
uses: ./.github/workflows/windows-generate-test-scripts.yml
171+
172+
windows-test-other:
173+
needs: [windows-build, windows-generate-test-scripts]
174+
strategy:
175+
fail-fast: false
176+
matrix:
177+
test_name:
178+
- "command-line-options"
179+
- "data-rep"
180+
- "jp-compat"
181+
- "run"
182+
- "syntax"
183+
- "file-lock"
184+
- "file-lock2"
185+
- "misc"
186+
uses: ./.github/workflows/windows-test-other.yml
187+
with:
188+
test-name: ${{ matrix.test_name }}
189+
168190
static-analysis:
169191
needs: check-workflows
170192
uses: ./.github/workflows/static-analysis.yml

.github/workflows/push.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157
windows-build:
158158
needs: check-workflows
159159
uses: ./.github/workflows/windows-build.yml
160-
with:
160+
with:
161161
upload-artifacts: true
162162

163163
windows-test:
@@ -169,6 +169,28 @@ jobs:
169169
with:
170170
test-name: ${{ matrix.test_name }}
171171

172+
windows-generate-test-scripts:
173+
needs: check-workflows
174+
uses: ./.github/workflows/windows-generate-test-scripts.yml
175+
176+
windows-test-other:
177+
needs: [windows-build, windows-generate-test-scripts]
178+
strategy:
179+
fail-fast: false
180+
matrix:
181+
test_name:
182+
- "command-line-options"
183+
- "data-rep"
184+
- "jp-compat"
185+
- "run"
186+
- "syntax"
187+
- "file-lock"
188+
- "file-lock2"
189+
- "misc"
190+
uses: ./.github/workflows/windows-test-other.yml
191+
with:
192+
test-name: ${{ matrix.test_name }}
193+
172194
static-analysis:
173195
needs: check-workflows
174196
uses: ./.github/workflows/static-analysis.yml
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Generate test scripts for Windows
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
generate:
11+
runs-on: ubuntu-latest
12+
container:
13+
image: ubuntu:24.04
14+
steps:
15+
- name: Install dependencies
16+
run: |
17+
apt-get update -y
18+
apt-get install -y build-essential gettext autoconf bison flex
19+
20+
- name: Checkout opensource COBOL 4J
21+
uses: actions/checkout@v6
22+
23+
- name: Generate test scripts
24+
run: |
25+
./configure
26+
cd tests
27+
make
28+
29+
- name: Upload test scripts
30+
uses: actions/upload-artifact@v7
31+
with:
32+
name: windows-test-scripts
33+
path: |
34+
tests/syntax
35+
tests/run
36+
tests/run-O
37+
tests/data-rep
38+
tests/data-rep-O
39+
tests/jp-compat
40+
tests/command-line-options
41+
tests/cobj-idx
42+
tests/file-lock
43+
tests/file-lock2
44+
tests/misc
45+
tests/atconfig
46+
tests/package.m4
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Windows other tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
test-name:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
test:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- name: Download test scripts
18+
uses: actions/download-artifact@v8
19+
with:
20+
name: windows-test-scripts
21+
path: tests/
22+
23+
- name: Download libcobj.jar
24+
uses: actions/download-artifact@v8
25+
with:
26+
name: libcobj.jar
27+
path: libcobj/app/build/libs/
28+
29+
- name: Download cobj.exe
30+
uses: actions/download-artifact@v8
31+
with:
32+
name: cobj.exe
33+
path: win/x64/Release/
34+
35+
- name: Install Java
36+
uses: actions/setup-java@v5
37+
with:
38+
distribution: 'temurin'
39+
java-version: '11'
40+
41+
- name: Install opensource COBOL 4J
42+
run: |
43+
cd win
44+
./make-install.ps1
45+
46+
- name: Set up test environment
47+
shell: bash
48+
run: |
49+
cd tests
50+
cp atlocal-win.env atlocal
51+
WORKSPACE=$(cd .. && pwd)
52+
sed -i "s|abs_builddir=.*|abs_builddir='${WORKSPACE}/tests'|" atconfig
53+
sed -i "s|abs_srcdir=.*|abs_srcdir='${WORKSPACE}/tests'|" atconfig
54+
sed -i "s|abs_top_srcdir=.*|abs_top_srcdir='${WORKSPACE}'|" atconfig
55+
sed -i "s|abs_top_builddir=.*|abs_top_builddir='${WORKSPACE}'|" atconfig
56+
sed -i "s|SHELL=.*|SHELL='$(which bash)'|" atconfig
57+
58+
- name: Run tests ${{ inputs.test-name }}
59+
shell: bash
60+
run: |
61+
# Create a diff wrapper that strips trailing CR so CRLF output from
62+
# Windows binaries compares equal to LF expected outputs.
63+
mkdir -p /tmp/diff-wrapper
64+
printf '%s\n' '#!/bin/bash' 'exec /usr/bin/diff --strip-trailing-cr "$@"' > /tmp/diff-wrapper/diff
65+
chmod +x /tmp/diff-wrapper/diff
66+
export PATH="/tmp/diff-wrapper:$PATH"
67+
export CLASSPATH=".;C:/opensourcecobol4j/lib/libcobj.jar"
68+
cd tests
69+
./${{ inputs.test-name }}
70+
71+
- name: Upload log files if tests fail
72+
if: failure()
73+
uses: actions/upload-artifact@v7
74+
with:
75+
name: windows-${{ inputs.test-name }}-log
76+
path: tests/${{ inputs.test-name }}.dir/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ https://www.oracle.com/java/technologies/downloads/?er=221886#java8-windows
110110
Then, libcobj.jar will be created in `libcobj\app\build\libs\`.
111111
112112
### Place files in the appropriate location
113-
1. If you build in Debug mode, change the 5th line of win/make-install.ps1 from `\x64\Release\cobj.exe` to `\x64\Debug\cobj.exe`.
113+
1. If you build in Debug mode, change the 6th line of win/make-install.ps1 from `\x64\Release\cobj.exe` to `\x64\Debug\cobj.exe`.
114114
2. Open PowerShell
115115
3. Move to "win" directory and execute make-install.ps1.
116116
```
@@ -124,6 +124,7 @@ https://www.oracle.com/java/technologies/downloads/?er=221886#java8-windows
124124
| cobj.exe | C:\opensourcecobol4j\bin |
125125
| libcobj.jar | C:\opensourcecobol4j\lib |
126126
| config files | C:\opensourcecobol4j\config |
127+
| copy files | C:\opensourcecobol4j\copy |
127128
128129
* If you want to change the location of the files, modify make-install.ps1.
129130

README_JP.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Windows版のopensource COBOL 4JはVisual Studioに含まれるCLコンパイラ
102102
これにより、`libcobj\app\build\libs\`に"libcobj.jar"が作成される。
103103
104104
### ファイルを適切な位置に配置
105-
1. Debugモードでビルドした場合、`win/make-install.ps1`の5行目を`\x64\Release\cobj.exe`から`\x64\Debug\cobj.exe`に変更する。
105+
1. Debugモードでビルドした場合、`win/make-install.ps1`の6行目を`\x64\Release\cobj.exe`から`\x64\Debug\cobj.exe`に変更する。
106106
2. PowerShellを開く。
107107
3. ”win”ディレクトリに移動し、`make-install.ps1`を実行する。
108108
```
@@ -115,6 +115,7 @@ Windows版のopensource COBOL 4JはVisual Studioに含まれるCLコンパイラ
115115
| cobj.exe | C:\opensourcecobol4j\bin |
116116
| libcobj.jar | C:\opensourcecobol4j\lib |
117117
| configファイル | C:\opensourcecobol4j\config |
118+
| copyファイル | C:\opensourcecobol4j\copy |
118119
119120
* ファイルの配置場所を変更したい場合は、`make-install.ps1`に記載してあるパスを編集してください。
120121

tests/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
Execute make command to generate the following test scripts.
22

3+
* cobj-idx
4+
* cobol\_utf8
35
* command-line-options
46
* data-rep
7+
* file-lock
8+
* file-lock2
59
* i18n\_sjis
610
* i18n\_utf8
711
* jp-compat

tests/README_JP.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
makeコマンドを実行すると,下記のテストスクリプトが生成される
22

3+
* cobj-idx
4+
* cobol\_utf8
35
* command-line-options
46
* data-rep
7+
* file-lock
8+
* file-lock2
59
* i18n\_sjis
610
* i18n\_utf8
711
* jp-compat

tests/atlocal-win.env

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Environment variables for autotest on Windows CI
2+
# Equivalent of atlocal.in for Windows builds
3+
4+
COBJ="C:/opensourcecobol4j/bin/cobj.exe"
5+
COBJ_IDX="C:/opensourcecobol4j/bin/cobj-idx-test"
6+
RUN_MODULE="java"
7+
PATHSEP=";"
8+
IS_WINDOWS="1"
9+
export COBJ COBJ_IDX PATHSEP IS_WINDOWS
10+
11+
# Compiler flags
12+
FLAGS="-std=cobol2002 -debug -Wall"
13+
CONF_JP_COMPAT="-conf=C:/opensourcecobol4j/config/jp-compat.conf"
14+
CONF_LIMIT_TEST="-conf=C:/opensourcecobol4j/config/boundary-limit.conf"
15+
16+
# Compile commands
17+
COMPILE="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall"
18+
COMPILE_DEFAULT="C:/opensourcecobol4j/bin/cobj.exe"
19+
COMPILE_ONLY="C:/opensourcecobol4j/bin/cobj.exe -fsyntax-only -std=cobol2002 -debug -Wall"
20+
COMPILE_MODULE="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall"
21+
COMPILE_JP_COMPAT="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/jp-compat.conf"
22+
COMPILE_JP_COMPAT_DEFAULT="C:/opensourcecobol4j/bin/cobj.exe -conf=C:/opensourcecobol4j/config/jp-compat.conf"
23+
COMPILE_SUBSCRIPT="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/jp-compat.conf"
24+
COMPILE_ONLY_JP_COMPAT="C:/opensourcecobol4j/bin/cobj.exe -fsyntax-only -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/jp-compat.conf"
25+
COMPILE_LIMIT_TEST="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/boundary-limit.conf"
26+
COMPILE_ONLY_LIMIT_TEST="C:/opensourcecobol4j/bin/cobj.exe -fsyntax-only -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/boundary-limit.conf"
27+
COMPILE_MODULE_JP_COMPAT="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/jp-compat.conf"
28+
COMPILE_MODULE_LIMIT_TEST="C:/opensourcecobol4j/bin/cobj.exe -std=cobol2002 -debug -Wall -conf=C:/opensourcecobol4j/config/boundary-limit.conf"
29+
30+
# Config/copy directories
31+
COB_CONFIG_DIR="C:/opensourcecobol4j/config"
32+
COB_COPY_DIR="C:/opensourcecobol4j/copy"
33+
34+
# Template for data-rep tests (abs_srcdir is set in atconfig)
35+
TEMPLATE="${abs_srcdir}/data-rep.src"
36+
37+
SKIP_TEST="exit 77"

tests/atlocal.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ CONF_LIMIT_TEST="-conf=${abs_top_builddir}/config/boundary-limit.conf"
3232
COBJ="${abs_top_builddir}/cobj/cobj"
3333
COBJ_IDX="${abs_top_builddir}/libcobj/bin/cobj-idx-test"
3434
RUN_MODULE="java"
35+
PATHSEP=":"
36+
export COBJ COBJ_IDX PATHSEP
3537
#COBCRUN="${abs_top_builddir}/bin/cobcrun"
3638

3739
TEMPLATE="${abs_srcdir}/data-rep.src"

0 commit comments

Comments
 (0)