Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc34a79f

Browse files
authored
Merge pull request#502 from postgrespro/PBCKP-220
[PBCKP-220] fix PGPROBAKUP_GDB=ON check
2 parents7e16642 +3724401 commitc34a79f

16 files changed

+142
-75
lines changed

‎.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
/docker-compose.yml
5151
/Dockerfile
5252
/Dockerfile.in
53-
/run_tests.sh
5453
/make_dockerfile.sh
5554
/backup_restore.sh
5655

‎tests/Readme.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,19 @@ Usage:
5151
python -m unittest [-v] tests[.specific_module][.class.test]
5252
```
5353

54-
###Troubleshooting FAQ
54+
#Troubleshooting FAQ
5555

56-
####python test failures
57-
1.Test failure reason like
56+
##Python tests failure
57+
###1.Could not open extension "..."
5858
```
59-
testgres.exceptions.QueryException ERROR: could not open extension control file "/home/avaness/postgres/postgres.build/share/extension/amcheck.control": No such file or directory
59+
testgres.exceptions.QueryException ERROR: could not open extension control file "<postgres_build_dir>/share/extension/amcheck.control": No such file or directory
6060
```
6161

62-
*Solution*: you have no`<postgres_src_root>/contrib/` extensions installed
62+
####Solution:
6363

64-
```commandline
65-
cd <postgres_src_root>
66-
make world install
67-
```
68-
69-
2. Test failure
70-
71-
```
72-
FAIL: test_help_6 (tests.option.OptionTest)
73-
```
74-
75-
*Solution*: you didn't configure postgres build with`--enable-nls`
64+
You have no`<postgres_src_root>/contrib/...` extension installed, please do
7665

7766
```commandline
7867
cd <postgres_src_root>
79-
make distclean
80-
<your-./configure-cmdline> --enable-nls
68+
make install-world
8169
```

‎tests/archive.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ def test_pgpro434_3(self):
228228
Check pg_stop_backup_timeout, needed backup_timeout
229229
Fixed in commit d84d79668b0c139 and assert fixed by ptrack 1.7
230230
"""
231+
self._check_gdb_flag_or_skip_test()
232+
231233
fname=self.id().split('.')[3]
232234
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
233235
node=self.make_simple_node(
@@ -290,6 +292,8 @@ def test_pgpro434_4(self):
290292
Check pg_stop_backup_timeout, libpq-timeout requested.
291293
Fixed in commit d84d79668b0c139 and assert fixed by ptrack 1.7
292294
"""
295+
self._check_gdb_flag_or_skip_test()
296+
293297
fname=self.id().split('.')[3]
294298
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
295299
node=self.make_simple_node(

‎tests/backup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,8 @@ def test_tablespace_handling_2(self):
10951095
# @unittest.skip("skip")
10961096
deftest_drop_rel_during_full_backup(self):
10971097
""""""
1098+
self._check_gdb_flag_or_skip_test()
1099+
10981100
fname=self.id().split('.')[3]
10991101
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
11001102
node=self.make_simple_node(
@@ -1244,6 +1246,8 @@ def test_drop_db_during_full_backup(self):
12441246
# @unittest.skip("skip")
12451247
deftest_drop_rel_during_backup_delta(self):
12461248
""""""
1249+
self._check_gdb_flag_or_skip_test()
1250+
12471251
fname=self.id().split('.')[3]
12481252
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
12491253
node=self.make_simple_node(
@@ -1313,6 +1317,8 @@ def test_drop_rel_during_backup_delta(self):
13131317
# @unittest.skip("skip")
13141318
deftest_drop_rel_during_backup_page(self):
13151319
""""""
1320+
self._check_gdb_flag_or_skip_test()
1321+
13161322
fname=self.id().split('.')[3]
13171323
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
13181324
node=self.make_simple_node(
@@ -1445,6 +1451,8 @@ def test_basic_temp_slot_for_stream_backup(self):
14451451
# @unittest.skip("skip")
14461452
deftest_backup_concurrent_drop_table(self):
14471453
""""""
1454+
self._check_gdb_flag_or_skip_test()
1455+
14481456
fname=self.id().split('.')[3]
14491457
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
14501458
node=self.make_simple_node(
@@ -1579,6 +1587,8 @@ def test_pg_11_adjusted_wal_segment_size(self):
15791587
# @unittest.skip("skip")
15801588
deftest_sigint_handling(self):
15811589
""""""
1590+
self._check_gdb_flag_or_skip_test()
1591+
15821592
fname=self.id().split('.')[3]
15831593
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
15841594
node=self.make_simple_node(
@@ -1618,6 +1628,8 @@ def test_sigint_handling(self):
16181628
# @unittest.skip("skip")
16191629
deftest_sigterm_handling(self):
16201630
""""""
1631+
self._check_gdb_flag_or_skip_test()
1632+
16211633
fname=self.id().split('.')[3]
16221634
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
16231635
node=self.make_simple_node(
@@ -1656,6 +1668,8 @@ def test_sigterm_handling(self):
16561668
# @unittest.skip("skip")
16571669
deftest_sigquit_handling(self):
16581670
""""""
1671+
self._check_gdb_flag_or_skip_test()
1672+
16591673
fname=self.id().split('.')[3]
16601674
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
16611675
node=self.make_simple_node(
@@ -2906,6 +2920,8 @@ def test_incr_backup_filenode_map(self):
29062920
# @unittest.skip("skip")
29072921
deftest_missing_wal_segment(self):
29082922
""""""
2923+
self._check_gdb_flag_or_skip_test()
2924+
29092925
fname=self.id().split('.')[3]
29102926
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
29112927
node=self.make_simple_node(
@@ -3292,6 +3308,8 @@ def test_basic_backup_default_transaction_read_only(self):
32923308
# @unittest.skip("skip")
32933309
deftest_backup_atexit(self):
32943310
""""""
3311+
self._check_gdb_flag_or_skip_test()
3312+
32953313
fname=self.id().split('.')[3]
32963314
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
32973315
node=self.make_simple_node(

‎tests/checkdb.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class CheckdbTest(ProbackupTest, unittest.TestCase):
1717
# @unittest.skip("skip")
1818
deftest_checkdb_amcheck_only_sanity(self):
1919
""""""
20+
self._check_gdb_flag_or_skip_test()
21+
2022
fname=self.id().split('.')[3]
2123
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
2224
node=self.make_simple_node(
@@ -544,11 +546,8 @@ def test_checkdb_checkunique(self):
544546
# @unittest.skip("skip")
545547
deftest_checkdb_sigint_handling(self):
546548
""""""
547-
ifnotself.gdb:
548-
self.skipTest(
549-
"Specify PGPROBACKUP_GDB and build without "
550-
"optimizations for run this test"
551-
)
549+
self._check_gdb_flag_or_skip_test()
550+
552551
fname=self.id().split('.')[3]
553552
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
554553
node=self.make_simple_node(

‎tests/delta.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,8 @@ def test_delta_vacuum_full(self):
472472
make node, make full and delta stream backups,
473473
restore them and check data correctness
474474
"""
475-
ifnotself.gdb:
476-
self.skipTest(
477-
"Specify PGPROBACKUP_GDB and build without "
478-
"optimizations for run this test"
479-
)
475+
self._check_gdb_flag_or_skip_test()
476+
480477
fname=self.id().split('.')[3]
481478
backup_dir=os.path.join(self.tmp_path,module_name,fname,'backup')
482479
node=self.make_simple_node(

‎tests/helpers/ptrack_helpers.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def __init__(self, *args, **kwargs):
180180
self.test_env['LC_MESSAGES']='C'
181181
self.test_env['LC_TIME']='C'
182182

183-
self.gdb='PGPROBACKUP_GDB'inos.environand \
184-
os.environ['PGPROBACKUP_GDB']=='ON'
183+
self.gdb='PGPROBACKUP_GDB'inself.test_envand \
184+
self.test_env['PGPROBACKUP_GDB']=='ON'
185185

186186
self.paranoia='PG_PROBACKUP_PARANOIA'inself.test_envand \
187187
self.test_env['PG_PROBACKUP_PARANOIA']=='ON'
@@ -810,7 +810,7 @@ def run_pb(self, command, asynchronous=False, gdb=False, old_binary=False, retur
810810
ifself.verbose:
811811
print(self.cmd)
812812
ifgdb:
813-
returnGDBobj([binary_path]+command,self.verbose)
813+
returnGDBobj([binary_path]+command,self)
814814
ifasynchronous:
815815
returnsubprocess.Popen(
816816
[binary_path]+command,
@@ -1861,22 +1861,34 @@ def compare_pgdata(self, original_pgdata, restored_pgdata, exclusion_dict = dict
18611861
self.assertFalse(fail,error_message)
18621862

18631863
defgdb_attach(self,pid):
1864-
returnGDBobj([str(pid)],self.verbose,attach=True)
1864+
returnGDBobj([str(pid)],self,attach=True)
1865+
1866+
def_check_gdb_flag_or_skip_test(self):
1867+
ifnotself.gdb:
1868+
self.skipTest(
1869+
"Specify PGPROBACKUP_GDB and build without "
1870+
"optimizations for run this test"
1871+
)
18651872

18661873

18671874
classGdbException(Exception):
1868-
def__init__(self,message=False):
1875+
def__init__(self,message="False"):
18691876
self.message=message
18701877

18711878
def__str__(self):
18721879
return'\n ERROR: {0}\n'.format(repr(self.message))
18731880

18741881

1875-
classGDBobj(ProbackupTest):
1876-
def__init__(self,cmd,verbose,attach=False):
1877-
self.verbose=verbose
1882+
classGDBobj:
1883+
def__init__(self,cmd,env:ProbackupTest,attach=False):
1884+
self.verbose=env.verbose
18781885
self.output=''
18791886

1887+
# Check gdb flag is set up
1888+
ifnotenv.gdb:
1889+
raiseGdbException("No `PGPROBACKUP_GDB=on` is set, "
1890+
"test should call ProbackupTest::check_gdb_flag_or_skip_test() on its start "
1891+
"and be skipped")
18801892
# Check gdb presense
18811893
try:
18821894
gdb_version,_=subprocess.Popen(

‎tests/locking.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def test_locking_running_validate_1(self):
1717
run validate, expect it to successfully executed,
1818
concurrent RUNNING backup with pid file and active process is legal
1919
"""
20+
self._check_gdb_flag_or_skip_test()
21+
2022
fname=self.id().split('.')[3]
2123
node=self.make_simple_node(
2224
base_dir=os.path.join(module_name,fname,'node'),
@@ -72,6 +74,8 @@ def test_locking_running_validate_2(self):
7274
RUNNING backup with pid file AND without active pid is legal,
7375
but his status must be changed to ERROR and pid file is deleted
7476
"""
77+
self._check_gdb_flag_or_skip_test()
78+
7579
fname=self.id().split('.')[3]
7680
node=self.make_simple_node(
7781
base_dir=os.path.join(module_name,fname,'node'),
@@ -142,6 +146,8 @@ def test_locking_running_validate_2_specific_id(self):
142146
RUNNING backup with pid file AND without active pid is legal,
143147
but his status must be changed to ERROR and pid file is deleted
144148
"""
149+
self._check_gdb_flag_or_skip_test()
150+
145151
fname=self.id().split('.')[3]
146152
node=self.make_simple_node(
147153
base_dir=os.path.join(module_name,fname,'node'),
@@ -240,6 +246,8 @@ def test_locking_running_3(self):
240246
RUNNING backup without pid file AND without active pid is legal,
241247
his status must be changed to ERROR
242248
"""
249+
self._check_gdb_flag_or_skip_test()
250+
243251
fname=self.id().split('.')[3]
244252
node=self.make_simple_node(
245253
base_dir=os.path.join(module_name,fname,'node'),
@@ -310,6 +318,8 @@ def test_locking_restore_locked(self):
310318
Expect restore to sucseed because read-only locks
311319
do not conflict
312320
"""
321+
self._check_gdb_flag_or_skip_test()
322+
313323
fname=self.id().split('.')[3]
314324
node=self.make_simple_node(
315325
base_dir=os.path.join(module_name,fname,'node'),
@@ -352,6 +362,8 @@ def test_concurrent_delete_and_restore(self):
352362
Expect restore to fail because validation of
353363
intermediate backup is impossible
354364
"""
365+
self._check_gdb_flag_or_skip_test()
366+
355367
fname=self.id().split('.')[3]
356368
node=self.make_simple_node(
357369
base_dir=os.path.join(module_name,fname,'node'),
@@ -443,6 +455,8 @@ def test_locking_concurren_restore_and_delete(self):
443455
and stop it in the middle, delete full backup.
444456
Expect it to fail.
445457
"""
458+
self._check_gdb_flag_or_skip_test()
459+
446460
fname=self.id().split('.')[3]
447461
node=self.make_simple_node(
448462
base_dir=os.path.join(module_name,fname,'node'),
@@ -585,6 +599,8 @@ def test_shared_lock(self):
585599
"""
586600
Make sure that shared lock leaves no files with pids
587601
"""
602+
self._check_gdb_flag_or_skip_test()
603+
588604
fname=self.id().split('.')[3]
589605
node=self.make_simple_node(
590606
base_dir=os.path.join(module_name,fname,'node'),

‎tests/logging.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class LogTest(ProbackupTest, unittest.TestCase):
1212
# @unittest.expectedFailure
1313
# PGPRO-2154
1414
deftest_log_rotation(self):
15+
"""
16+
"""
17+
self._check_gdb_flag_or_skip_test()
18+
1519
fname=self.id().split('.')[3]
1620
node=self.make_simple_node(
1721
base_dir=os.path.join(module_name,fname,'node'),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp