Skip to content

Commit b78fac9

Browse files
committed
2 parents 1384000 + 0de3c5e commit b78fac9

38 files changed

+2216
-722
lines changed

files/qa-databases.conf

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# QA-specific databases.conf, would be copied manually to $FB_HOME
1+
# QA-specific databases.conf, will be ADDED $FB_HOME/databases.conf
22
# by batch scenario as part of preparation, before QA suite run.
3+
# ::: NB :::
4+
# DO NOT add here aliases 'employee', 'employee.fdb' and 'security.db'
5+
# ####################################################################
36
# Discussed with pcisar, letters since 30-may-2022 13:48, subject:
4-
# "new qa, core_4964_test.py: strange outcome when use... shutil.copy() // comparing to shutil.copy2()"
5-
###################################################################
6-
7-
employee.fdb = $(dir_sampleDb)/employee.fdb
8-
employee = $(dir_sampleDb)/employee.fdb
7+
# "new qa, core_4964_test.py: strange outcome when use... shutil.copy()"
8+
# ####################################################################
99

1010
# Hereafter we specify data for tests which require special settings for database.
11-
# NOTE: each alias must EXACTLY match to value specified in the test!
11+
# Each alias must EXACTLY match to value in the test, including letters case.
1212
#
1313

1414
# Test issue: https://github.com/FirebirdSQL/firebird/issues/5160
@@ -197,6 +197,22 @@ tmp_trg_disconn_timeout_alias = $(dir_sampleDb)/qa/tmp_disconn_trg_timeout.fdb
197197
OnDisconnectTriggerTimeout = 2
198198
}
199199

200+
tmp_gh_6802_alias = $(dir_sampleDb)/qa/tmp_gh_6802.fdb
201+
{
202+
# Determines the number of seconds that the lock manager will wait after a
203+
# conflict has been encountered before purging locks from dead processes
204+
# and doing extra deadlock scan cycle.
205+
#
206+
# Per-database configurable.
207+
208+
DeadlockTimeout = 6
209+
}
210+
211+
tmp_gh_7106_alias = $(dir_sampleDb)/qa/tmp_gh_7106.fdb
212+
{
213+
SecurityDatabase = tmp_gh_7106_alias
214+
}
215+
200216

201217

202218
# Databases for replication tests:

tests/bugs/core_0190_test.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
"""
44
ID: issue-517
5-
ISSUE: 517
6-
TITLE: Trigger with except-s on view with union
7-
DESCRIPTION:
8-
JIRA: CORE-190
9-
FBTEST: bugs.core_0190
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/517
6+
TITLE: trigger with except-s on view with union
7+
NOTES:
8+
Test should be added during initial migration from fbtest but did not, the reason is unknown.
9+
Noted by Anton Zuev: https://github.com/FirebirdSQL/firebird-qa/pull/5
10+
Checked on 3.0.11.33665, 4.0.3.2904, 5.0.0.970
1011
"""
1112

1213
import pytest
@@ -41,16 +42,8 @@
4142

4243
act = isql_act('db', test_script)
4344

44-
expected_stdout = """
45-
"""
46-
47-
expected_stderr = """
48-
"""
49-
5045
@pytest.mark.version('>=3.0')
5146
def test_1(act: Action):
52-
act.expected_stdout = expected_stdout
53-
act.expected_stderr = expected_stderr
54-
act.execute()
47+
act.expected_stdout = ''
48+
act.execute(combine_output = True)
5549
assert act.clean_stdout == act.clean_expected_stdout
56-
assert act.clean_stderr == act.clean_expected_stderr

tests/bugs/core_0733_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ def test_1(act: Action, capsys):
142142
# Linux: 0.684; 1.000; 1.000; 1.067; 0.867; 0.813; 0.800; 0.777; 0.750 // 4.0.1
143143
# 0.928; 1.000; 0.933; 1.000; 1.077; 0.750; 0.938; 0.929; 0.928 // 3.0.8
144144
if act.is_version('<4'):
145-
# 16.09.2022, 43.0.8 Classic: Windows -> 1.2
145+
# 16.09.2022, 4.3.0.8 Classic: Windows -> 1.2
146146
MAX_CPU_RATIO_TXT2BIN_WCOMPR_OFF = 1.1 if platform.system() == 'Linux' else 1.5
147147
else:
148-
MAX_CPU_RATIO_TXT2BIN_WCOMPR_OFF = 1.1 if platform.system() == 'Linux' else 0.95
148+
# 05.03.2023, 5.0.0.970, SS, Linux: 1.1 --> 1.3
149+
MAX_CPU_RATIO_TXT2BIN_WCOMPR_OFF = 1.3 if platform.system() == 'Linux' else 0.95
149150

150151
# Register Firebird server (D:\FB\probes\fid-set-dpb-probe-05x.py)
151152
srv_cfg = driver_config.register_server(name = 'test_srv_core_0733', config = '')

tests/bugs/core_1549_test.py

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,60 @@
6565

6666
act = isql_act('db', test_script)
6767

68-
expected_stdout = """
69-
EXISTS with ref. to 1st stream:
68+
fb3x_expected_out = """
69+
EXISTS with ref. to 1st stream:
7070
71-
Select Expression
71+
Select Expression
72+
-> Filter
73+
-> Table "T" as "X" Access By ID
74+
-> Bitmap
75+
-> Index "T_ID" Range Scan (full match)
76+
Select Expression
77+
-> Filter
78+
-> Table "T" as "Z" Access By ID
79+
-> Bitmap
80+
-> Index "T_ID" Range Scan (full match)
81+
Select Expression
82+
-> Nested Loop Join (inner)
83+
-> Filter
84+
-> Table "T" as "A" Full Scan
85+
-> Filter
86+
-> Table "T" as "B" Access By ID
87+
-> Bitmap
88+
-> Index "T_ID" Range Scan (lower bound: 1/1)
89+
90+
91+
Two sep. DT and EXISTS inside:
92+
93+
Select Expression
94+
-> Filter
95+
-> Table "T" as "B X" Access By ID
96+
-> Bitmap
97+
-> Index "T_ID" Range Scan (full match)
98+
Select Expression
99+
-> Filter
100+
-> Table "T" as "A X" Access By ID
101+
-> Bitmap
102+
-> Index "T_ID" Range Scan (full match)
103+
Select Expression
104+
-> Nested Loop Join (inner)
105+
-> Filter
106+
-> Table "T" as "A T1" Full Scan
107+
-> Filter
108+
-> Table "T" as "B T2" Access By ID
109+
-> Bitmap
110+
-> Index "T_ID" Range Scan (lower bound: 1/1)
111+
"""
112+
113+
fb5x_expected_out = """
114+
EXISTS with ref. to 1st stream:
115+
116+
Sub-query
72117
-> Filter
73118
-> Table "T" as "X" Access By ID
74119
-> Bitmap
75120
-> Index "T_ID" Range Scan (full match)
76-
Select Expression
121+
Sub-query
77122
-> Filter
78123
-> Table "T" as "Z" Access By ID
79124
-> Bitmap
@@ -87,15 +132,16 @@
87132
-> Bitmap
88133
-> Index "T_ID" Range Scan (lower bound: 1/1)
89134
135+
Two sep. DT and EXISTS inside:
90136
91-
Two sep. DT and EXISTS inside:
92137
93-
Select Expression
138+
139+
Sub-query
94140
-> Filter
95141
-> Table "T" as "B X" Access By ID
96142
-> Bitmap
97143
-> Index "T_ID" Range Scan (full match)
98-
Select Expression
144+
Sub-query
99145
-> Filter
100146
-> Table "T" as "A X" Access By ID
101147
-> Bitmap
@@ -109,10 +155,9 @@
109155
-> Bitmap
110156
-> Index "T_ID" Range Scan (lower bound: 1/1)
111157
"""
112-
113158
@pytest.mark.version('>=3.0')
114159
def test_1(act: Action):
115-
act.expected_stdout = expected_stdout
116-
act.execute()
160+
act.expected_stdout = fb3x_expected_out if act.is_version('<5') else fb5x_expected_out
161+
act.execute(combine_output = True)
117162
assert act.clean_stdout == act.clean_expected_stdout
118163

tests/bugs/core_2078_test.py

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292

293293
act = isql_act('db', test_script)
294294

295-
expected_stdout = """
295+
fb3x_expected_out = """
296296
RUN1_TAB_NAME TBIG
297297
RUN1_IDX_NAME TBIG_IDX1_FK_SML
298298
RUN1_IDX_STAT 0.5000000000
@@ -343,8 +343,59 @@
343343
FETCHES_2_2 acceptable
344344
"""
345345

346+
fb5x_expected_out = """
347+
RUN1_TAB_NAME TBIG
348+
RUN1_IDX_NAME TBIG_IDX1_FK_SML
349+
RUN1_IDX_STAT 0.5000000000
350+
351+
RUN1_TAB_NAME TBIG
352+
RUN1_IDX_NAME TBIG_IDX2_FK_MED
353+
RUN1_IDX_STAT 0.0033333334
354+
355+
RUN1_TAB_NAME TMED
356+
RUN1_IDX_NAME TMED_PK
357+
RUN1_IDX_STAT 0.0033333334
358+
359+
RUN1_TAB_NAME TSML
360+
RUN1_IDX_NAME TSML_PK
361+
RUN1_IDX_STAT 0.0666666701
362+
363+
PLAN HASH (JOIN (M NATURAL, B INDEX (TBIG_IDX2_FK_MED)), S NATURAL)
364+
CNT_1_1 3000
365+
366+
PLAN HASH (JOIN (S NATURAL, B INDEX (TBIG_IDX1_FK_SML)), M NATURAL)
367+
CNT_1_2 1500
368+
369+
RUN2_TAB_NAME TBIG
370+
RUN2_IDX_NAME TBIG_IDX1_FK_SML
371+
RUN2_IDX_STAT 0.5000000000
372+
373+
RUN2_TAB_NAME TBIG
374+
RUN2_IDX_NAME TBIG_IDX2_FK_MED
375+
RUN2_IDX_STAT 0.0033333334
376+
377+
RUN2_TAB_NAME TMED
378+
RUN2_IDX_NAME TMED_PK
379+
RUN2_IDX_STAT 0.0033333334
380+
381+
RUN2_TAB_NAME TSML
382+
RUN2_IDX_NAME TSML_PK
383+
RUN2_IDX_STAT 0.0222222228
384+
385+
PLAN HASH (JOIN (M NATURAL, B INDEX (TBIG_IDX2_FK_MED)), S NATURAL)
386+
CNT_2_1 3000
387+
388+
PLAN HASH (JOIN (S NATURAL, B INDEX (TBIG_IDX1_FK_SML)), M NATURAL)
389+
CNT_2_2 1500
390+
FETCHES_1_1 acceptable
391+
FETCHES_1_2 acceptable
392+
FETCHES_2_1 acceptable
393+
FETCHES_2_2 acceptable
394+
"""
395+
346396
@pytest.mark.version('>=3.0')
347397
def test_1(act: Action):
348-
act.expected_stdout = expected_stdout
398+
act.expected_stdout = fb3x_expected_out if act.is_version('<5') else fb5x_expected_out
349399
act.execute()
400+
#assert act.stdout == act.clean_expected_stdout
350401
assert act.clean_stdout == act.clean_expected_stdout

tests/bugs/core_2303_test.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,26 @@
1313
from firebird.qa import *
1414

1515
db = db_factory()
16+
act = python_act('db')
1617

17-
test_script = """
18-
set blob all;
19-
set list on;
20-
commit;
21-
select
22-
(select sign(count(*)) from rdb$relations r)
23-
,s.mon$explained_plan as mon_explained_blob_id
24-
from mon$statements s
25-
where
26-
s.mon$transaction_id = current_transaction
27-
and s.mon$sql_text containing 'from mon$statements' -- prevent from RDB$AUTH record, 4.0 Classic
28-
;
29-
"""
30-
31-
act = isql_act('db', test_script, substitutions=[('MON_EXPLAINED_BLOB_ID .*', '')])
32-
33-
expected_stdout = """
34-
SIGN 1
35-
18+
TAG_TEXT = 'TAG_FOR_SEARCH'
19+
expected_stdout = f"""
20+
select 1 /* {TAG_TEXT} */ from rdb$database
3621
Select Expression
37-
-> Singularity Check
38-
-> Aggregate
39-
-> Table "RDB$RELATIONS" as "R" Full Scan
40-
Select Expression
41-
-> Filter
42-
-> Table "MON$STATEMENTS" as "S" Full Scan
22+
-> Table "RDB$DATABASE" Full Scan
4323
"""
4424

4525
@pytest.mark.version('>=3.0')
46-
def test_1(act: Action):
26+
def test_1(act: Action, capsys):
27+
with act.db.connect() as con:
28+
cur1 = con.cursor()
29+
cur2 = con.cursor()
30+
ps = cur1.prepare(f'select 1 /* {TAG_TEXT} */ from rdb$database')
31+
cur2.execute(f"select mon$sql_text, mon$explained_plan from mon$statements s where s.mon$sql_text containing '{TAG_TEXT}' and s.mon$sql_text NOT containing 'mon$statements'")
32+
for r in cur2:
33+
print(r[0])
34+
print(r[1])
35+
4736
act.expected_stdout = expected_stdout
48-
act.execute()
37+
act.stdout = capsys.readouterr().out
4938
assert act.clean_stdout == act.clean_expected_stdout
50-

0 commit comments

Comments
 (0)