Skip to content

Commit 85b4add

Browse files
committed
Added/Updated tests\bugs\gh_7992_test.py: Checked on 5.0.1.1330, 6.0.0.247.
1 parent ea3e47e commit 85b4add

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/bugs/gh_7992_test.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#coding:utf-8
2+
3+
"""
4+
ID: issue-7992
5+
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7992
6+
TITLE: Assertion (space > 0) failure during restore
7+
DESCRIPTION:
8+
NOTES:
9+
[03.02.2024] pzotov
10+
Confirmed problem on 5.0.1.1328, 6.0.0.244 (common builds): restore terminates prematurely, firebird crashes.
11+
Checked on 5.0.1.1330, 6.0.0.247.
12+
"""
13+
import subprocess
14+
from pathlib import Path
15+
import zipfile
16+
import locale
17+
import re
18+
import pytest
19+
from firebird.qa import *
20+
from firebird.driver import SrvRestoreFlag
21+
22+
db = db_factory()
23+
act = python_act('db')
24+
fbk_file = temp_file('gh_7992.tmp.fbk')
25+
26+
expected_stdout = """
27+
gbak:finishing, closing, and going home
28+
gbak:adjusting the ONLINE and FORCED WRITES flags
29+
"""
30+
31+
@pytest.mark.version('>=5.0.1')
32+
def test_1(act: Action, fbk_file: Path, capsys):
33+
zipped_fbk_file = zipfile.Path(act.files_dir / 'gh_7992.zip', at = 'gh_7992.fbk')
34+
fbk_file.write_bytes(zipped_fbk_file.read_bytes())
35+
36+
allowed_patterns = \
37+
(
38+
'gbak:finishing, closing, and going home'
39+
,'gbak:adjusting the ONLINE and FORCED WRITES flags'
40+
)
41+
allowed_patterns = [ re.compile(p, re.IGNORECASE) for p in allowed_patterns ]
42+
43+
with act.connect_server(encoding=locale.getpreferredencoding()) as srv:
44+
srv.database.restore(database=act.db.db_path, backup=fbk_file, flags=SrvRestoreFlag.REPLACE, verbose=True)
45+
restore_log = srv.readlines()
46+
for line in restore_log:
47+
if act.match_any(line.strip(), allowed_patterns):
48+
print(line)
49+
50+
act.expected_stdout = expected_stdout
51+
act.stdout = capsys.readouterr().out
52+
assert act.clean_stdout == act.clean_expected_stdout

0 commit comments

Comments
 (0)