diff --git a/tests/bugs/core_3547_test.py b/tests/bugs/core_3547_test.py index 6ea32003..d10f4aaf 100644 --- a/tests/bugs/core_3547_test.py +++ b/tests/bugs/core_3547_test.py @@ -5,6 +5,10 @@ ID: issue-3903 ISSUE: 3903 TITLE: Floating-point negative zero doesn't match positive zero in the index DESCRIPTION: +NOTES: +[09.02.2022] pcisar + Specific stdout is required on Windows for v3 up to 3.0.8 due to small difference + It's possible that this problem would be fixed in 3.0.9. JIRA: CORE-3547 FBTEST: bugs.core_3547 """ @@ -71,10 +75,18 @@ expected_stderr_non_win = """ -Problematic key value is ("COL" = 0.000000000000000) """ -@pytest.mark.version('>=3') +@pytest.mark.version('>=3,<4') def test_1(act: Action): act.expected_stdout = expected_stdout act.expected_stderr = expected_stderr_win if act.platform == 'Windows' else expected_stderr_non_win act.execute() assert (act.clean_stderr == act.clean_expected_stderr and act.clean_stdout == act.clean_expected_stdout) + +@pytest.mark.version('>=4') +def test_2(act: Action): + act.expected_stdout = expected_stdout + act.expected_stderr = expected_stderr_non_win + act.execute() + assert (act.clean_stderr == act.clean_expected_stderr and + act.clean_stdout == act.clean_expected_stdout) diff --git a/tests/bugs/core_4172_test.py b/tests/bugs/core_4172_test.py index afe0720e..1f6a48ff 100644 --- a/tests/bugs/core_4172_test.py +++ b/tests/bugs/core_4172_test.py @@ -31,6 +31,7 @@ FBTEST: bugs.core_4172 import pytest import re import platform +import locale from pathlib import Path from firebird.qa import * @@ -160,6 +161,6 @@ Records affected: 0 def test_2(act_2: Action): act_2.expected_stderr = 'We expect error, but ignore it' act_2.expected_stdout = expected_stdout_2 - act_2.isql(switches=[], input=test_script_2) + act_2.isql(switches=[], input=test_script_2, io_enc=locale.getpreferredencoding()) assert act_2.clean_stdout == act_2.clean_expected_stdout diff --git a/tests/bugs/core_4743_test.py b/tests/bugs/core_4743_test.py index 75aa9b9b..881578bb 100644 --- a/tests/bugs/core_4743_test.py +++ b/tests/bugs/core_4743_test.py @@ -5,11 +5,15 @@ ID: issue-5048 ISSUE: 5048 TITLE: Granted role does not work with non-ascii username DESCRIPTION: +NOTES: +[09.02.2022] pcisar + On Windows the act.db.connect() fails with "Your user name and password are not defined." JIRA: CORE-4743 FBTEST: bugs.core_4743 """ import pytest +import platform from firebird.qa import * db = db_factory(charset='UTF8') @@ -156,6 +160,7 @@ expected_stdout = """ privilege:exec : YES """ +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') @pytest.mark.version('>=4.0') def test_1(act: Action, non_acii_user: User, test_role: Role, capsys): act.isql(switches=['-b', '-q'], input=ddl_script) diff --git a/tests/bugs/core_4760_test.py b/tests/bugs/core_4760_test.py index 009044dc..e193ea00 100644 --- a/tests/bugs/core_4760_test.py +++ b/tests/bugs/core_4760_test.py @@ -10,11 +10,14 @@ NOTES: 1. This problem is covered by test for #5048 (CORE-4743) as side effect 2. For sake of completness, it was reimplemented by simply using user_factory fixture. +[09.02.2022] pcisar + On Windows the act.db.connect() fails with "Your user name and password are not defined." JIRA: CORE-4760 FBTEST: bugs.core_4760 """ import pytest +import platform from firebird.qa import * db = db_factory(charset='UTF8') @@ -23,6 +26,7 @@ non_ascii_user = user_factory('db', name='"Εὐκλείδης"', password='123' act = python_act('db') +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') @pytest.mark.version('>=4.0') def test_1(act: Action, non_ascii_user: User): with act.db.connect(user=non_ascii_user.name, password=non_ascii_user.password) as con: diff --git a/tests/bugs/core_5488_session_idle_test.py b/tests/bugs/core_5488_session_idle_test.py index a38c56cc..5cd6b084 100644 --- a/tests/bugs/core_5488_session_idle_test.py +++ b/tests/bugs/core_5488_session_idle_test.py @@ -27,6 +27,10 @@ DESCRIPTION: Timeout for IDLE connection (SET SESSION IDLE TIMEOUT ) ::: NB::: No events related to SECOND statement should be in the trace log. +NOTES: +[09.02.2022] pcisar + Have to add ('quit;', '') to substitutions, because this command is echoed to stdout on Windows, + while it's not on Linux. JIRA: CORE-5488 FBTEST: bugs.core_5488_session_idle """ @@ -36,7 +40,7 @@ import os import re from firebird.qa import * -substitutions = [('timeout .* second', 'timeout second'), +substitutions = [('timeout .* second', 'timeout second'), ('quit;', ''), ('.*After line [\\d]+.*', ''), ('.*shell.*', '')] db = db_factory() diff --git a/tests/bugs/core_5495_test.py b/tests/bugs/core_5495_test.py index dfbd187b..3b70731e 100644 --- a/tests/bugs/core_5495_test.py +++ b/tests/bugs/core_5495_test.py @@ -37,7 +37,8 @@ test_script = """ commit; """ -act = isql_act('db', test_script, substitutions=[('TCPv.*', 'TCP')]) +act = isql_act('db', test_script, substitutions=[('TCPv.*', 'TCP'), + ('Commit current transaction \\(y/n\\)\\?', '')]) expected_stdout = """ MON$USER TMP$C5495 diff --git a/tests/bugs/core_5637_test.py b/tests/bugs/core_5637_test.py index 328b0ce2..69e2ddd6 100644 --- a/tests/bugs/core_5637_test.py +++ b/tests/bugs/core_5637_test.py @@ -18,7 +18,7 @@ import zipfile from difflib import unified_diff from pathlib import Path from firebird.qa import * -from firebird.driver import SrvRestoreFlag +from firebird.driver import SrvRestoreFlag, ShutdownMode, ShutdownMethod db = db_factory() @@ -42,6 +42,8 @@ def test_1(act: Action, sec_fbk: Path, sec_fdb: Path): # srv.database.validate(database=sec_fdb) validation_log = srv.readlines() + srv.database.shutdown(database=sec_fdb, mode=ShutdownMode.FULL, method=ShutdownMethod.FORCED, timeout=0) + # # assert [line for line in restore_log if 'ERROR' in line.upper()] == [] assert [line for line in validation_log if 'ERROR' in line.upper()] == [] diff --git a/tests/bugs/core_6237_test.py b/tests/bugs/core_6237_test.py index d22aa304..5ef1ce28 100644 --- a/tests/bugs/core_6237_test.py +++ b/tests/bugs/core_6237_test.py @@ -21,12 +21,15 @@ DESCRIPTION: Reproduced on on several builds 4.x before 17.01.2020 (tested: 4.0.0.1712 CS, 4.0.0.1731 CS - got ratio = ~1.95). Reproduced also on 3.0.5.33221 Classic - got ratio ~1.50 ... 1.70; could NOT reproduce on 3.0.5 SuperClassic / SuperServer. +[09.02.2022] pcisar + Fails on Windows 4.0.1 with ratio 1.98 - raw iron W10, does not fail with Linux on the same HW JIRA: CORE-6237 FBTEST: bugs.core_6237 """ import pytest import datetime +import platform from firebird.qa import * db = db_factory() @@ -40,6 +43,7 @@ expected_stdout = """ EXPECTED. Ratio of total elapsed time when use Srp vs Legacy is less then threshold. """ +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') @pytest.mark.version('>=3.0.5') def test_1(act: Action, leg_user: User, srp_user: User, capsys): N_ITER = 50 diff --git a/tests/bugs/core_6248_test.py b/tests/bugs/core_6248_test.py index 52642123..b1ad02b1 100644 --- a/tests/bugs/core_6248_test.py +++ b/tests/bugs/core_6248_test.py @@ -20,6 +20,15 @@ DESCRIPTION: For L=259 we must see in backup log following phrase: gbak:text for attribute 7 is too large in put_asciz(), truncating to 255 bytes - but currently this is not checked here. +[09.02.2022] pcisar + Fails on Windows10 / 4.0.1 with: + "CreateFile (create)" operation for file "..." + -Error while trying to create file + -System can't find specified path + Variant with 255 chars fails in init script, while 259 chars variant fails in database fixture while + db creation. + On national windows with OS i/o error messages in locale.getpreferredencoding(), it may fail while + reading stderr from isql. But using io_enc=locale.getpreferredencoding() will show the message. JIRA: CORE-6248 FBTEST: bugs.core_6248 """ @@ -27,6 +36,7 @@ FBTEST: bugs.core_6248 import pytest import re import time +import platform from difflib import unified_diff from firebird.qa import * from firebird.driver import SrvRepairFlag @@ -107,6 +117,7 @@ def check_filename_presence(lines, *, log_name: str, db: Database): print(f'{log_name} : DB NAME NOT FOUND') +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') @pytest.mark.version('>=4.0') @pytest.mark.parametrize('test_db', [pytest.param((255, 'abc255def'), id='255'), pytest.param((259, 'qwe259rty'), id='259')], indirect=True) diff --git a/tests/bugs/core_6262_test.py b/tests/bugs/core_6262_test.py index 6a81daf3..4daa96e2 100644 --- a/tests/bugs/core_6262_test.py +++ b/tests/bugs/core_6262_test.py @@ -55,7 +55,7 @@ def test_1(act: Action, capsys): act.isql(switches=[], input='\n'.join(chk_script)) # Checks lines_with_charset = lines_without_charset = 0 - for line in act.stdout.splitlines(): + for line in act.clean_stdout.splitlines(): if line.split(): if 'CHARACTER SET' in line: lines_with_charset += 1 diff --git a/tests/bugs/core_6272_test.py b/tests/bugs/core_6272_test.py index 76c4c833..b31f1e3d 100644 --- a/tests/bugs/core_6272_test.py +++ b/tests/bugs/core_6272_test.py @@ -18,12 +18,16 @@ NOTES: NOTE-2. Some messages can appear in the trace log ONE or TWO times (SS/CS ?). Because of this, we are interested only for at least one occurence of each message rather than for each of them (see 'found_patterns', type: set()). +[09.02.2022] pcisar + Fails on Windows (with 4.0.1) - no patterns are found, because one can't use trace with embedded + version on this platform. JIRA: CORE-6272 FBTEST: bugs.core_6272 """ import pytest import re +import platform from pathlib import Path from firebird.qa import * from firebird.driver import DatabaseError @@ -52,6 +56,7 @@ trace = """ trace_conf = temp_file('trace.conf') +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') @pytest.mark.version('>=4.0') def test_1(act: Action, db_nonexistent: Database, trace_conf: Path, capsys): with ServerKeeper(act, None): # Use embedded server for trace diff --git a/tests/bugs/core_6278_test.py b/tests/bugs/core_6278_test.py index 5da02445..f6db4d0d 100644 --- a/tests/bugs/core_6278_test.py +++ b/tests/bugs/core_6278_test.py @@ -90,12 +90,12 @@ def test_1(act: Action, capsys): # For yet unknown reason, trace must be read as in 'cp1252' (neither ascii or utf8 works) with act.trace(db_events=trace, encoding='cp1252'): act.isql(switches=['-q'], input=test_script) - # Process isql output - for line in act.stdout.splitlines(): - if elements := line.rstrip().split(): - count_intermediate_rows = int(elements[0]) - break - # Process trace + # Process isql output + for line in act.clean_stdout.splitlines(): + if elements := line.rstrip().split(): + count_intermediate_rows = int(elements[0]) + break + # Process trace for line in act.trace_log: for p in allowed_patterns: if p.search(line): @@ -107,6 +107,7 @@ def test_1(act: Action, capsys): else: print(line) # Check + act.reset() # necessary to reset 'clean_stdout' !! act.expected_stdout = expected_stdout act.stdout = capsys.readouterr().out assert act.clean_stdout == act.clean_expected_stdout diff --git a/tests/bugs/core_6279_test.py b/tests/bugs/core_6279_test.py index 48b476a0..4fce4abb 100644 --- a/tests/bugs/core_6279_test.py +++ b/tests/bugs/core_6279_test.py @@ -96,7 +96,7 @@ act = python_act('db') @pytest.mark.version('>=4.0') def test_1(act: Action, test_user: User): act.isql(switches=['-q'], input=init_script) - ddl_combinations_script = act.stdout + ddl_combinations_script = act.clean_stdout # act.reset() act.isql(switches=['-q'], input=ddl_combinations_script) diff --git a/tests/bugs/core_6336_test.py b/tests/bugs/core_6336_test.py index 0fc09fef..dfc79275 100644 --- a/tests/bugs/core_6336_test.py +++ b/tests/bugs/core_6336_test.py @@ -68,7 +68,8 @@ import pytest from firebird.qa import * substitutions = [('COLL-VERSION=\\d{2,}.\\d{2,}', 'COLL-VERSION=111.222'), - ('COLL-VERSION=\\d+\\.\\d+\\.\\d+\\.\\d+', 'COLL-VERSION=111.222')] + ('COLL-VERSION=\\d+\\.\\d+\\.\\d+\\.\\d+', 'COLL-VERSION=111.222'), + ('Commit current transaction \\(y/n\\)\\?', '')] db = db_factory() diff --git a/tests/bugs/core_6469_test.py b/tests/bugs/core_6469_test.py index d986050a..57617ac2 100644 --- a/tests/bugs/core_6469_test.py +++ b/tests/bugs/core_6469_test.py @@ -39,6 +39,11 @@ DESCRIPTION: NO such trouble in the Classic. The reason currently (03-mar-2021) remains unknown. Sent letter to Alex et al, 03-mar-2021. +NOTES: +[09.02.2022] pcisar + Test fails on Windows as script execution fails with: + Statement failed, SQLSTATE = 0P000 + Your attachment has no trusted role JIRA: CORE-6469 FBTEST: bugs.core_6469 """ @@ -70,20 +75,20 @@ expected_stdout_win = """ """ trace_win = ['log_initfini = false', - 'log_statement_finish = true', - 'log_errors = true', - 'time_threshold = 0', - ] + 'log_statement_finish = true', + 'log_errors = true', + 'time_threshold = 0', + ] patterns_win = [re.compile('alter session reset', re.IGNORECASE), - re.compile('set session idle timeout', re.IGNORECASE), - re.compile('set statement timeout', re.IGNORECASE), - re.compile('set bind of decfloat to double precision', re.IGNORECASE), - re.compile('set decfloat round ceiling', re.IGNORECASE), - re.compile('set decfloat traps to Division_by_zero', re.IGNORECASE), - re.compile('set time zone', re.IGNORECASE), - re.compile('set role', re.IGNORECASE), - re.compile('set trusted role', re.IGNORECASE)] + re.compile('set session idle timeout', re.IGNORECASE), + re.compile('set statement timeout', re.IGNORECASE), + re.compile('set bind of decfloat to double precision', re.IGNORECASE), + re.compile('set decfloat round ceiling', re.IGNORECASE), + re.compile('set decfloat traps to Division_by_zero', re.IGNORECASE), + re.compile('set time zone', re.IGNORECASE), + re.compile('set role', re.IGNORECASE), + re.compile('set trusted role', re.IGNORECASE)] def run_script(act: Action): __tracebackhide__ = True @@ -132,13 +137,13 @@ def run_script(act: Action): commit; connect '{THIS_COMPUTER_NAME}:{act.db.db_path}' role tmp$r6469; - # + select mon$user,mon$role,mon$auth_method from mon$attachments where mon$attachment_id = current_connection; commit; - # + set trusted role; commit; - # + connect '{act.db.dsn}' user {act.db.user} password '{act.db.password}'; drop mapping trusted_auth; drop mapping win_admins; @@ -146,11 +151,12 @@ def run_script(act: Action): """ act.isql(switches=['-n'], input=script) +@pytest.mark.skipif(reason='FIXME: see notes') @pytest.mark.version('>=4.0') @pytest.mark.platform('Windows') def test_1(act: Action, test_role: Role, capsys): with act.trace(db_events=trace_win): - run_script() + run_script(act) # process trace for line in act.trace_log: if line.split(): @@ -205,20 +211,20 @@ test_script_lin = """ """ trace_lin = ['log_initfini = false', - 'log_connections = true', - 'log_statement_finish = true', - 'log_errors = true', - 'time_threshold = 0', - ] + 'log_connections = true', + 'log_statement_finish = true', + 'log_errors = true', + 'time_threshold = 0', + ] patterns_lin = [re.compile('alter session reset', re.IGNORECASE), - re.compile('set session idle timeout', re.IGNORECASE), - re.compile('set statement timeout', re.IGNORECASE), - re.compile('set bind of decfloat to double precision', re.IGNORECASE), - re.compile('set decfloat round ceiling', re.IGNORECASE), - re.compile('set decfloat traps to Division_by_zero', re.IGNORECASE), - re.compile('set time zone', re.IGNORECASE), - re.compile('set role', re.IGNORECASE)] + re.compile('set session idle timeout', re.IGNORECASE), + re.compile('set statement timeout', re.IGNORECASE), + re.compile('set bind of decfloat to double precision', re.IGNORECASE), + re.compile('set decfloat round ceiling', re.IGNORECASE), + re.compile('set decfloat traps to Division_by_zero', re.IGNORECASE), + re.compile('set time zone', re.IGNORECASE), + re.compile('set role', re.IGNORECASE)] @pytest.mark.version('>=4.0') @pytest.mark.platform('Linux') diff --git a/tests/functional/datatypes/test_dp_single_bit_in_representation.py b/tests/functional/datatypes/test_dp_single_bit_in_representation.py index 20c4c382..215fab89 100644 --- a/tests/functional/datatypes/test_dp_single_bit_in_representation.py +++ b/tests/functional/datatypes/test_dp_single_bit_in_representation.py @@ -4,10 +4,17 @@ ID: dp-single-bit-in-representation TITLE: Check result of EXP() which can be represented only by one ("last") significant bit DESCRIPTION: +NOTES: +[09.02.2022] pcisar + Fails on Windows 4.0.1 with: + Statement failed, SQLSTATE = 22012 + arithmetic exception, numeric overflow, or string truncation + -Floating-point divide by zero. The code attempted to divide a floating-point value by zero. FBTEST: functional.datatypes.dp_single_bit_in_representation """ import pytest +import platform from firebird.qa import * db = db_factory() @@ -34,8 +41,17 @@ expected_stdout = """ E2_DIV_E2 1.000000000000000 """ -@pytest.mark.version('>=3') +@pytest.mark.version('>=3,<4') def test_1(act: Action): act.expected_stdout = expected_stdout act.execute() assert act.clean_stdout == act.clean_expected_stdout + +# This version was create just to skip version 4 for Windows! + +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') +@pytest.mark.version('>4') +def test_2(act: Action): + act.expected_stdout = expected_stdout + act.execute() + assert act.clean_stdout == act.clean_expected_stdout diff --git a/tests/functional/gtcs/test_time_zone.py b/tests/functional/gtcs/test_time_zone.py index c5736d0c..21cc0564 100644 --- a/tests/functional/gtcs/test_time_zone.py +++ b/tests/functional/gtcs/test_time_zone.py @@ -24,10 +24,17 @@ NOTES: Invalid time zone offset: -03 - must use format +/-hours:minutes and be between -14:00 and +14:00 See: https://github.com/FirebirdSQL/firebird/commit/ff37d445ce844f991242b1e2c1f96b80a5d1636d +[09.02.2022] pcisar + Fails on Windows due to differences like: + - CAST 10:11:12.1345 America/Sao_Paulo + ? ^ + + CAST 11:11:12.1345 America/Sao_Paulo + ? ^ FBTEST: functional.gtcs.time_zone """ import pytest +import platform from firebird.qa import * db = db_factory() @@ -1311,6 +1318,7 @@ expected_stderr = """ -Problematic key value is ("V" = '2018-01-01 14:33:33.0000 +02:00') """ +@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') @pytest.mark.version('>=4.0') def test_1(act: Action): act.expected_stdout = expected_stdout