2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
|
|
|
ID: issue-3730
|
|
|
|
ISSUE: 3730
|
|
|
|
TITLE: Blob filter to translate internal debug info into text representation
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-3364
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_3364
|
2022-01-22 21:59:15 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
init_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set term ^;
|
|
|
|
create or alter procedure sp_test(a_n smallint) returns(n_fact bigint) as
|
|
|
|
begin
|
|
|
|
n_fact = iif(a_n > 0, a_n, 0);
|
2022-01-22 21:59:15 +01:00
|
|
|
|
|
|
|
while (a_n > 1) do
|
2021-04-26 20:07:00 +02:00
|
|
|
begin
|
|
|
|
n_fact = n_fact * (a_n - 1);
|
|
|
|
a_n = a_n -1;
|
|
|
|
end
|
|
|
|
suspend;
|
|
|
|
end
|
|
|
|
^
|
|
|
|
set term ;^
|
|
|
|
commit;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
db = db_factory(page_size=4096, sql_dialect=3, init=init_script)
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
set list on;
|
|
|
|
set blob all;
|
|
|
|
select rdb$debug_info from rdb$procedures where upper(rdb$procedure_name) = upper('sp_test');
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
act = isql_act('db', test_script, substitutions=[('RDB\\$DEBUG_INFO', ''), ('-', ''),
|
|
|
|
('[0-9]+[ ]+[0-9]+[ ]+[0-9]+', '')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-22 21:59:15 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
RDB$DEBUG_INFO 1a:f0
|
|
|
|
Parameters:
|
|
|
|
Number Name Type
|
|
|
|
--------------------------------------------------
|
|
|
|
0 A_N INPUT
|
|
|
|
0 N_FACT OUTPUT
|
|
|
|
Variables:
|
|
|
|
Number Name
|
|
|
|
-------------------------------------------
|
|
|
|
0 N_FACT
|
|
|
|
BLR to Source mapping:
|
|
|
|
BLR offset Line Column
|
|
|
|
--------------------------------
|
|
|
|
36 2 5
|
|
|
|
38 3 9
|
|
|
|
73 5 9
|
|
|
|
92 6 9
|
|
|
|
94 7 11
|
|
|
|
116 8 11
|
|
|
|
142 10 9
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
|
|
|
@pytest.mark.version('>=3.0')
|
2022-01-22 21:59:15 +01:00
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.execute()
|
|
|
|
assert act.clean_stdout == act.clean_expected_stdout
|
2021-04-26 20:07:00 +02:00
|
|
|
|