Skip to content

Commit

Permalink
Merge SVN 4709
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jul 10, 2024
1 parent 5aaa9eb commit b2ff10f
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 7 deletions.
5 changes: 5 additions & 0 deletions libcob/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@

* reportio.c: Fixed spacing and test cases to match Microfocus

2021-12-22 Simon Sobisch <[email protected]>

* fileio.c (indexed_close) [WITH_DB]: fix bug #753 sigsegv on CLOSE
when COB_SYNC is active

2021-12-12 Ron Norman <[email protected]>

* common.h: Added flag_do_rollback
Expand Down
1 change: 1 addition & 0 deletions libcob/fbdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,7 @@ ix_bdb_close (cob_file_api *a, cob_file *f, const int opt)
bdb_env->lock_id_free (bdb_env, p->bdb_lock_id);
}
cob_free (p);
f->file = NULL;

return COB_STATUS_00_SUCCESS;
}
Expand Down
116 changes: 109 additions & 7 deletions tests/testsuite.src/run_file.at
Original file line number Diff line number Diff line change
Expand Up @@ -4582,7 +4582,7 @@ AT_CLEANUP


AT_SETUP([INDEXED sample])
AT_KEYWORDS([runfile optional file status READ WRITE DUPLICATES START])
AT_KEYWORDS([runfile optional file status READ WRITE DUPLICATES START COB_SYNC])

# modified version of GC-FAQ: indexing example
# Author: Brian Tiffin, Date: 17-Feb-2009, 28-Jan-2014
Expand Down Expand Up @@ -4987,6 +4987,50 @@ rewriting key: 12349865
rewriting key: 98651234
])

# recheck with COB_SYNC to cover additional code paths - see bug # 753
AT_CHECK([COB_SYNC=Y $COBCRUN_DIRECT ./prog], [0],
[Read all 00b02 keys sequentially
Reading: 00b02
12345679 00 b 02, some 12345679 data
97654321 00 b 02, some 97654321 data
12349765 00 b 02, some 12349765 data
97651234 00 b 02, some 97651234 data
-----------------------------------------
Read all alternate keys greater than 00a02
Seeking >= 00a02
12345679 00 b 02, some 12345679 data
97654321 00 b 02, some 97654321 data
12349765 00 b 02, some 12349765 data
97651234 00 b 02, some 97651234 data
12345689 00 c 13, some 12345689 data
98654321 00 c 13, some 98654321 data
12349865 00 c 13, some 12349865 data
98651234 00 c 13, some 98651234 data
-----------------------------------------
Read all primary keys less than 87654321
Prime < 87654321
87651234 00 a 01, some 87651234 data
12349865 00 c 13, some 12349865 data
12349765 00 b 02, some 12349765 data
12348765 00 a 01, some 12348765 data
12345689 00 c 13, some 12345689 data
12345679 00 b 02, some 12345679 data
12345678 00 a 01, some 12345678 data
-----------------------------------------
],
[rewriting key: 12345678
rewriting key: 87654321
rewriting key: 12348765
rewriting key: 87651234
rewriting key: 12345679
rewriting key: 97654321
rewriting key: 12349765
rewriting key: 97651234
rewriting key: 12345689
rewriting key: 98654321
rewriting key: 12349865
rewriting key: 98651234
])

AT_CHECK([test "$COB_HAS_ISAM" = "db"], [0], [], [],
# Previous test "failed" --> other ISAM, no need for more checks
Expand Down Expand Up @@ -5043,7 +5087,7 @@ AT_CLEANUP


AT_SETUP([WRITE + REWRITE FILE name])
AT_KEYWORDS([runfile])
AT_KEYWORDS([runfile RELATIVE COB_SYNC])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
Expand Down Expand Up @@ -5192,6 +5236,14 @@ Read BET00000 Sts:00 Trms:0013
REWROTE BET00000 Sts:00 Trms:0014
], [])

# recheck with COB_SYNC to cover additional code paths
AT_CHECK([COB_SYNC=Y $COBCRUN_DIRECT ./prog], [0],
[Loading sample program data file.
Sample program data file load complete.
Read BET00000 Sts:00 Trms:0013
REWROTE BET00000 Sts:00 Trms:0014
], [])

AT_CLEANUP


Expand Down Expand Up @@ -6258,7 +6310,7 @@ AT_CLEANUP
### TO-DO: Already in run_extensions.at.

AT_SETUP([SEQUENTIAL basic I/O])
AT_KEYWORDS([runfile])
AT_KEYWORDS([runfile READ WRITE REWRITE COB_SYNC])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
Expand All @@ -6277,22 +6329,34 @@ AT_DATA([prog.cob], [
MOVE "A" TO file1-rec.
WRITE file1-rec.
CLOSE file1.
OPEN I-O file1.
READ file1.
IF file1-rec <> "A"
display "FIRST READ FAILED"
ELSE
MOVE "X" TO file1-rec
REWRITE file1-rec.
CLOSE file1.
IF file1-rec NOT = "X"
STOP RUN.
OPEN INPUT file1.
READ file1.
IF (file1-rec <> "A")
display "FAILED".
IF file1-rec <> "X"
display "SECOND READ FAILED".
CLOSE file1.
STOP RUN.
])

AT_CHECK([$COMPILE prog.cob], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0])
# recheck with COB_SYNC to cover additional code paths
AT_CHECK([COB_SYNC=Y $COBCRUN_DIRECT ./prog], [0], [], [])

AT_CLEANUP


AT_SETUP([LINE SEQUENTIAL basic I/O])
AT_KEYWORDS([runfile])
AT_KEYWORDS([runfile READ WRITE REWRITE])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
Expand Down Expand Up @@ -21569,7 +21633,7 @@ AT_CLEANUP


AT_SETUP([LINE SEQUENTIAL one Record])
AT_KEYWORDS([runfile])
AT_KEYWORDS([runfile COB_SYNC READ WRITE])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
Expand Down Expand Up @@ -21800,6 +21864,43 @@ Read BET00000 Trms:00010
Read Status: 10
], [])

# recheck with COB_SYNC to cover additional code paths
AT_CHECK([COB_SYNC=Y $COBCRUN_DIRECT ./prog], [0],
[Loading sample program data file.
Sample program data file load complete.
Open Sts:00
Read ALP00000 Trms:08240
Read BET00000 Trms:00010
Read GAM00000 Trms:00013
Read DEL00000 Trms:65535
Read ALP00000 Trms:08240
REWRITE ALP00000 Sts 44 Trms:00010
Read ALP00000 Trms:08240
Read BET00000 Trms:00010
REWRITE BET00000 Sts 00 Trms:00011
Read GAM00000 Trms:00013
Read EPS00000 Sts:00
REWRITE EPS00000 Sts 00 Trms:08240
List back Open Sts:00
Read ALP00000 Trms:08240
Read BET00000 Trms:00011
Read GAM00000 Trms:00013
Read DEL00000 Trms:65535
Read EPS00000 Trms:08240
Read FOR00000 Trms:00254
Read Status: 10
List after extend Open Sts:00
Read ALP00000 Trms:08240
Read BET00000 Trms:00011
Read GAM00000 Trms:00013
Read DEL00000 Trms:65535
Read EPS00000 Trms:08240
Read FOR00000 Trms:00254
Read ALP00000 Trms:08240
Read BET00000 Trms:00010
Read Status: 10
], [])

AT_CLEANUP


Expand Down Expand Up @@ -24292,6 +24393,7 @@ Read Status: 10

AT_CLEANUP


AT_SETUP([OPEN OUTPUT COMMIT / ROLLBACK])
AT_KEYWORDS([runfile])

Expand Down

0 comments on commit b2ff10f

Please sign in to comment.