From 99cfa96676db1fcb6e4a5db89110c4991782eab6 Mon Sep 17 00:00:00 2001 From: sf-mensch Date: Mon, 25 Mar 2019 21:34:35 +0000 Subject: [PATCH] testsuite.src/run_misc.at: fixed test that expected little-endian values in dump to not check the dump content *FIXME: still expecting ASCII* git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3054 ed166372-6744-4ac0-a67f-bb1ae9efa102 --- tests/testsuite.src/run_misc.at | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/testsuite.src/run_misc.at b/tests/testsuite.src/run_misc.at index 2ef4a86..173ac48 100644 --- a/tests/testsuite.src/run_misc.at +++ b/tests/testsuite.src/run_misc.at @@ -5918,6 +5918,10 @@ AT_CLEANUP AT_SETUP([MF FIGURATIVE to NUMERIC]) AT_KEYWORDS([MOVE]) +# FIXME: This test will NOT work on EBCDIC machines, +# either add it explicit here and split into two or add +# a pre-test and check the expected "native" result + AT_DATA([prog.cob], [ IDENTIFICATION DIVISION. PROGRAM-ID. prog. @@ -5963,12 +5967,16 @@ AT_DATA([prog.cob], [ DISPLAY "MOVE HIGH-VALUES TO BIGFLT" MOVE HIGH-VALUES TO BIGFLT. PERFORM SHOW-BIG. + CALL "dump" USING BIGFLT. DISPLAY "MOVE QUOTE TO BIGFLT" MOVE QUOTE TO BIGFLT. PERFORM SHOW-BIG. + CALL "dump" USING BIGFLT. DISPLAY "MOVE ALL * TO BIGFLT" MOVE ALL '*' TO BIGFLT. PERFORM SHOW-BIG. + *> Note: the next results are dependant on endianess + *> therefore no dump here DISPLAY "MOVE ALL '21' TO BIGFLT" MOVE ALL '21' TO BIGFLT. PERFORM SHOW-BIG. @@ -5977,7 +5985,6 @@ AT_DATA([prog.cob], [ CALL "dump" USING MYFLD. SHOW-BIG. DISPLAY "BIGFLT is " BIGFLT. - CALL "dump" USING BIGFLT. ]) AT_DATA([cmod.c], [[ @@ -6033,10 +6040,8 @@ BIGFLT is 2.1973164E-18 22222222 . MOVE ALL * TO BIGFLT BIGFLT is 5.4312347E+12 -DA119E54 . MOVE ALL '21' TO BIGFLT BIGFLT is 2.1212121E+37 -E5547F7D . ], []) AT_CLEANUP -- 2.15.3 From e0d02d05d50804d6fefe3f01d7eee8c943cb07e4 Mon Sep 17 00:00:00 2001 From: sf-mensch Date: Mon, 25 Mar 2019 21:41:12 +0000 Subject: [PATCH] testsuite.src/run_misc.at: fixed test that expected little-endian values in dump to not check the dump content *FIXME: still expecting ASCII* git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3055 ed166372-6744-4ac0-a67f-bb1ae9efa102 diff --git a/tests/testsuite.src/run_misc.at b/tests/testsuite.src/run_misc.at index 173ac48..51f4b84 100644 --- a/tests/testsuite.src/run_misc.at +++ b/tests/testsuite.src/run_misc.at @@ -6005,7 +6005,7 @@ prog.cob:28: warning: numeric value is expected prog.cob:6: warning: 'MYFLD' defined here as PIC 9(4) prog.cob:34: warning: numeric value is expected prog.cob:6: warning: 'MYFLD' defined here as PIC 9(4) -prog.cob:50: warning: numeric value is expected +prog.cob:52: warning: numeric value is expected prog.cob:7: warning: 'BIGFLT' defined here as USAGE FLOAT ]) -- 2.15.3 From 71b65c9fe2c6997e33c56457977d79fd10c3a8f2 Mon Sep 17 00:00:00 2001 From: sf-mensch Date: Mon, 15 Apr 2019 21:29:54 +0000 Subject: [PATCH] Partially merged r525 from branches/reportwriter and r3106 from branches/pangaea: libcob/common.c (cob_sys_getopt_long_long): fix ENDIAN problem with CBL_GC_GETOPT also applied minor reformatting to keep the function formatted consistently git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3115 ed166372-6744-4ac0-a67f-bb1ae9efa102 diff --git a/libcob/common.c b/libcob/common.c index 5262282..d99c533 100644 --- a/libcob/common.c +++ b/libcob/common.c @@ -5138,9 +5138,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo COB_CHK_PARMS (CBL_GC_GETOPT, 6); - /* - * Read in sizes of some parameters - */ + /* read in sizes of some parameters */ if (COB_MODULE_PTR->cob_procedure_params[1]) { lo_size = COB_MODULE_PTR->cob_procedure_params[1]->size; } @@ -5151,9 +5149,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo opt_val_size = COB_MODULE_PTR->cob_procedure_params[5]->size; } - /* - * Buffering longoptions (COBOL), target format (struct option) - */ + /* buffering longoptions (COBOL), target format (struct option) */ if (lo_size % sizeof (longoption_def) == 0) { lo_amount = (int)lo_size / sizeof (longoption_def); longoptions_root = (struct option*) cob_malloc (sizeof (struct option) * (lo_amount + 1U)); @@ -5168,9 +5164,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo } longind = cob_get_int (COB_MODULE_PTR->cob_procedure_params[2]); - /* - * Add 0-termination to strings. - */ + /* add 0-termination to strings */ shortoptions = cob_malloc (so_size + 1U); if (COB_MODULE_PTR->cob_procedure_params[0]) { cob_field_to_string (COB_MODULE_PTR->cob_procedure_params[0], shortoptions, so_size); @@ -5196,9 +5190,7 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo longoptions = longoptions + 1; } - /* - * Appending final record, so getopt can spot the end of longoptions - */ + /* appending final record, so getopt can spot the end of longoptions */ longoptions->name = NULL; longoptions->has_arg = 0; longoptions->flag = NULL; @@ -5211,17 +5203,42 @@ cob_sys_getopt_long_long (void *so, void *lo, void *idx, const int long_only, vo return_value = cob_getopt_long_long (cob_argc, cob_argv, shortoptions, longoptions, &longind, long_only); temp = (char *) &return_value; - /* - * Write data back to COBOL - */ - if (temp[0] == '?' || temp[0] == ':' || temp[0] == 'W' - || temp[0] == -1 || temp[0] == 0) exit_status = return_value; - else exit_status = 3; + /* write data back to COBOL */ +#ifdef WORDS_BIGENDIAN + if (temp[3] == '?' + || temp[3] == ':' + || temp[3] == 'W' + || temp[3] == 0) { + exit_status = temp[3] & 0xFF; + } else if (return_value == -1) { + exit_status = -1; + } else { + exit_status = 3; + } + /* cob_getopt_long_long sometimes returns and 'int' value and sometimes a 'x ' in the int */ + if (temp[0] == 0 + && temp[1] == 0 + && temp[2] == 0) { + /* Move option value to 1st byte and SPACE fill the 'int' */ + temp[0] = temp[3]; + temp[1] = temp[2] = temp[3] = ' '; + } +#else + if (temp[0] == '?' + || temp[0] == ':' + || temp[0] == 'W' + || temp[0] == -1 + || temp[0] == 0) { + exit_status = return_value; + } else { + exit_status = 3; + } for (i = 3; i > 0; i--) { - if (temp[i] == 0x00) temp[i] = 0x20; + if (temp[i] == 0) temp[i] = ' '; else break; } +#endif cob_set_int (COB_MODULE_PTR->cob_procedure_params[2], longind); memcpy (return_char, &return_value, 4); -- 2.15.3 From 9151800276cff454f11d250cb19d267def883978 Mon Sep 17 00:00:00 2001 From: sf-mensch Date: Mon, 15 Apr 2019 21:38:53 +0000 Subject: [PATCH] Partially merged r525 from branches/reportwriter: libcob/fileio.c (cob_sys_create_file, cob_sys_open_file): fix ENDIAN problem with CBL_CREATE_FILE, CBL_OPEN_FILE also applied minor reformatting to keep the function formatted consistently git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3116 ed166372-6744-4ac0-a67f-bb1ae9efa102 diff --git a/libcob/fileio.c b/libcob/fileio.c index 885cd48..521e245 100644 --- a/libcob/fileio.c +++ b/libcob/fileio.c @@ -5559,6 +5559,22 @@ cob_sys_open_file (unsigned char *file_name, unsigned char *file_access, COB_CHK_PARMS (CBL_OPEN_FILE, 5); +#ifdef WORDS_BIGENDIAN + /* if value is passed as numeric literal, it becomes an 'int' so value is in 4th byte */ + if (file_access[0] == 0 + && file_access[1] == 0 + && file_access[2] == 0) + file_access += 3; + if (file_lock[0] == 0 + && file_lock[1] == 0 + && file_lock[2] == 0) + file_lock += 3; + if (file_dev[0] == 0 + && file_dev[1] == 0 + && file_dev[2] == 0) + file_dev += 3; +#endif + return open_cbl_file (file_name, file_access, file_handle, 0); } @@ -5573,6 +5589,24 @@ cob_sys_create_file (unsigned char *file_name, unsigned char *file_access, * @param: file_dev : not implemented, set 0 */ + COB_CHK_PARMS (CBL_CREATE_FILE, 5); + +#ifdef WORDS_BIGENDIAN + /* if value is passed as numeric literal, it becomes an 'int' so value is in 4th byte */ + if (file_access[0] == 0 + && file_access[1] == 0 + && file_access[2] == 0) + file_access += 3; + if (file_lock[0] == 0 + && file_lock[1] == 0 + && file_lock[2] == 0) + file_lock += 3; + if (file_dev[0] == 0 + && file_dev[1] == 0 + && file_dev[2] == 0) + file_dev += 3; +#endif + if (*file_lock != 0) { cob_runtime_warning (_("call to CBL_CREATE_FILE with wrong file_lock: %d"), *file_lock); } @@ -5580,8 +5614,6 @@ cob_sys_create_file (unsigned char *file_name, unsigned char *file_access, cob_runtime_warning (_("call to CBL_CREATE_FILE with wrong file_dev: %d"), *file_dev); } - COB_CHK_PARMS (CBL_CREATE_FILE, 5); - return open_cbl_file (file_name, file_access, file_handle, O_CREAT | O_TRUNC); } -- 2.15.3 From f6ff480b71da490476abc84699558bddef6b9a56 Mon Sep 17 00:00:00 2001 From: sf-mensch Date: Tue, 18 Jun 2019 20:09:46 +0000 Subject: [PATCH] tests: * atlocal.in explicit disable BDB internal locking by unsetting DB_HOME to work around issues in different environments and to not pollute the users's general BDB locking files * skip UDF recursion test previously marked as expected fail as the current implementation may or may not work depending on the underlying C compiler/library in use (including the exact version...) git-svn-id: https://svn.code.sf.net/p/open-cobol/code/trunk@3194 ed166372-6744-4ac0-a67f-bb1ae9efa102 diff --git a/tests/testsuite.src/run_functions.at b/tests/testsuite.src/run_functions.at index 7c3c660..5ddbd58 100644 --- a/tests/testsuite.src/run_functions.at +++ b/tests/testsuite.src/run_functions.at @@ -1,4 +1,4 @@ -## Copyright (C) 2003-2012, 2014-2018 Free Software Foundation, Inc. +## Copyright (C) 2003-2012, 2014-2019 Free Software Foundation, Inc. ## Written by Keisuke Nishida, Roger While, Simon Sobisch, Edward Hart ## ## This file is part of GnuCOBOL. @@ -4145,7 +4145,7 @@ AT_CLEANUP AT_SETUP([UDF with recursion]) AT_KEYWORDS([functions LOCAL-STORAGE]) -AT_XFAIL_IF(true) # see bug #222 and r2291 - postponed +AT_SKIP_IF(true) # see bug #222 and r2291 - postponed AT_DATA([prog.cob], [ IDENTIFICATION DIVISION. -- 2.15.3