testgres-pg-probackup2 0.9.1__tar.gz → 0.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (15) hide show
  1. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/PKG-INFO +1 -1
  2. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/pg_probackup2/app.py +28 -26
  3. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/pg_probackup2/gdb.py +29 -3
  4. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/pg_probackup2/init_helpers.py +1 -1
  5. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/setup.py +1 -1
  6. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/testgres_pg_probackup2.egg-info/PKG-INFO +1 -1
  7. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/README.md +0 -0
  8. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/pg_probackup2/__init__.py +0 -0
  9. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/pg_probackup2/storage/__init__.py +0 -0
  10. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/pg_probackup2/storage/fs_backup.py +0 -0
  11. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/setup.cfg +0 -0
  12. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/testgres_pg_probackup2.egg-info/SOURCES.txt +0 -0
  13. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/testgres_pg_probackup2.egg-info/dependency_links.txt +0 -0
  14. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/testgres_pg_probackup2.egg-info/requires.txt +0 -0
  15. {testgres_pg_probackup2-0.9.1 → testgres_pg_probackup2-0.9.2}/testgres_pg_probackup2.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres_pg_probackup2
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: Plugin for testgres that manages pg_probackup2
5
5
  Home-page: https://github.com/postgrespro/testgres
6
6
  Author: Postgres Professional
@@ -126,7 +126,7 @@ class ProbackupApp:
126
126
  if self.verbose:
127
127
  print(self.test_class.cmd)
128
128
 
129
- cmdline = self._form_cmdline(binary_path, command)
129
+ cmdline = self._form_cmdline(binary_path, command, use_valgrind=gdb is False)
130
130
 
131
131
  if gdb is True:
132
132
  # general test flow for using GDBObj
@@ -168,35 +168,37 @@ class ProbackupApp:
168
168
 
169
169
  return command, strcommand
170
170
 
171
- def _form_cmdline(self, binary_path, command):
171
+ def _form_cmdline(self, binary_path, command, use_valgrind=True):
172
172
  cmdline = [binary_path, *command]
173
173
 
174
- if (self.valgrind == 'y' or self.valgrind_sup_path) and command[0] != "--version":
175
- os.makedirs(self.pb_log_path, exist_ok=True)
176
- valgrind_cmd = [
177
- "valgrind",
178
- "--gen-suppressions=all",
179
- "--leak-check=full",
180
- "--show-reachable=yes",
181
- "--error-limit=no",
182
- "--show-leak-kinds=all",
183
- "--errors-for-leak-kinds=all",
184
- "--error-exitcode=0",
185
- f"--log-file={os.path.join(self.pb_log_path, f'valgrind-{command[0]}-%p.log')}"
186
- ]
187
- if self.valgrind_sup_path:
188
- if os.path.isfile(self.valgrind_sup_path):
189
- valgrind_cmd += [f"--suppressions={self.valgrind_sup_path}"]
190
- else:
191
- raise FileNotFoundError(f"PG_PROBACKUP_VALGRIND_SUP must be the path to a valgrind suppression file, "
192
- f"but found: {self.valgrind_sup_path}")
174
+ if not use_valgrind or command[0] == "--version":
175
+ return cmdline
176
+ if self.valgrind != 'y' and not self.valgrind_sup_path:
177
+ return cmdline
178
+
179
+ os.makedirs(self.pb_log_path, exist_ok=True)
180
+ valgrind_cmd = [
181
+ "valgrind",
182
+ "--gen-suppressions=all",
183
+ "--leak-check=full",
184
+ "--show-reachable=yes",
185
+ "--error-limit=no",
186
+ "--show-leak-kinds=all",
187
+ "--errors-for-leak-kinds=all",
188
+ "--error-exitcode=0",
189
+ f"--log-file={os.path.join(self.pb_log_path, f'valgrind-{command[0]}-%p.log')}"
190
+ ]
191
+ if self.valgrind_sup_path:
192
+ if os.path.isfile(self.valgrind_sup_path):
193
+ valgrind_cmd += [f"--suppressions={self.valgrind_sup_path}"]
193
194
  else:
194
- # Assume the tests are started from the root of pg_probackup repository
195
- valgrind_cmd += [f"--suppressions=.valgrind.supp"]
196
-
197
- cmdline = valgrind_cmd + cmdline
195
+ raise FileNotFoundError(f"PG_PROBACKUP_VALGRIND_SUP must be the path to a valgrind suppression file, "
196
+ f"but found: {self.valgrind_sup_path}")
197
+ else:
198
+ # Assume the tests are started from the root of pg_probackup repository
199
+ valgrind_cmd += [f"--suppressions=.valgrind.supp"]
198
200
 
199
- return cmdline
201
+ return valgrind_cmd + cmdline
200
202
 
201
203
  def _execute_command(self, cmdline, env, command, gdb, expect_error, return_id, daemonize):
202
204
  try:
@@ -134,6 +134,8 @@ class GDBobj:
134
134
  )
135
135
 
136
136
  def remove_all_breakpoints(self):
137
+ if self._did_quit:
138
+ return
137
139
  if not self.has_breakpoint:
138
140
  return
139
141
 
@@ -149,6 +151,8 @@ class GDBobj:
149
151
  )
150
152
 
151
153
  def run_until_break(self):
154
+ if self._did_quit:
155
+ return
152
156
  result = self._execute('run', False)
153
157
  for line in result:
154
158
  if line.startswith('*stopped,reason="breakpoint-hit"'):
@@ -158,6 +162,8 @@ class GDBobj:
158
162
  )
159
163
 
160
164
  def continue_execution_until_running(self):
165
+ if self._did_quit:
166
+ return
161
167
  result = self._execute('continue')
162
168
 
163
169
  for line in result:
@@ -175,9 +181,23 @@ class GDBobj:
175
181
  def signal(self, sig):
176
182
  if 'KILL' in sig:
177
183
  self.remove_all_breakpoints()
184
+ # Avoid GDB 15.x SIGABRT: kill inferior directly, not via `signal`.
185
+ try:
186
+ pids = subprocess.check_output(
187
+ ['pgrep', '-P', str(self.gdb_pid)],
188
+ text=True
189
+ ).strip().split()
190
+ for pid in pids:
191
+ os.kill(int(pid), 9)
192
+ except (subprocess.CalledProcessError, ValueError, OSError):
193
+ pass
194
+ self.kill()
195
+ return
178
196
  self._execute(f'signal {sig}')
179
197
 
180
198
  def continue_execution_until_exit(self):
199
+ if self._did_quit:
200
+ return
181
201
  self.remove_all_breakpoints()
182
202
  result = self._execute('continue', False)
183
203
 
@@ -195,6 +215,8 @@ class GDBobj:
195
215
  )
196
216
 
197
217
  def continue_execution_until_error(self):
218
+ if self._did_quit:
219
+ return
198
220
  self.remove_all_breakpoints()
199
221
  result = self._execute('continue', False)
200
222
 
@@ -211,6 +233,8 @@ class GDBobj:
211
233
  'Failed to continue execution until error.\n')
212
234
 
213
235
  def continue_execution_until_break(self, ignore_count=0):
236
+ if self._did_quit:
237
+ return
214
238
  if ignore_count > 0:
215
239
  result = self._execute(
216
240
  'continue ' + str(ignore_count),
@@ -253,6 +277,8 @@ class GDBobj:
253
277
 
254
278
  # use for breakpoint, run, continue
255
279
  def _execute(self, cmd, running=True):
280
+ if self._did_quit:
281
+ return []
256
282
  output = []
257
283
  self.proc.stdin.flush()
258
284
  self.proc.stdin.write(cmd + '\n')
@@ -320,9 +346,9 @@ def needs_gdb(func):
320
346
  check = _check_gdb_flag_or_skip_test()
321
347
  if not check:
322
348
  @functools.wraps(func)
323
- def ok_wrapped(self):
349
+ def ok_wrapped(self, *args, **kwargs):
324
350
  self._gdb_decorated = True
325
- func(self)
351
+ return func(self, *args, **kwargs)
326
352
 
327
353
  return ok_wrapped
328
354
  reason = check[1]
@@ -330,7 +356,7 @@ def needs_gdb(func):
330
356
  return unittest.skip(reason)(func)
331
357
  elif check[0] == "fail":
332
358
  @functools.wraps(func)
333
- def fail_wrapper(self):
359
+ def fail_wrapper(self, *args, **kwargs):
334
360
  self.fail(reason)
335
361
 
336
362
  return fail_wrapper
@@ -211,7 +211,7 @@ class Init(object):
211
211
  self.probackup_path = probackup_path_tmp
212
212
 
213
213
  if not self.probackup_path:
214
- raise Exception('pg_probackup binary is not found')
214
+ raise Exception('pg_probackup binary is not found, add it to PATH or point PGPROBACKUPBIN')
215
215
 
216
216
  if os_name == 'posix':
217
217
  self.EXTERNAL_DIRECTORY_DELIMITER = ':'
@@ -4,7 +4,7 @@ except ImportError:
4
4
  from distutils.core import setup
5
5
 
6
6
  setup(
7
- version='0.9.1',
7
+ version='0.9.2',
8
8
  name='testgres_pg_probackup2',
9
9
  packages=['pg_probackup2', 'pg_probackup2.storage'],
10
10
  description='Plugin for testgres that manages pg_probackup2',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: testgres_pg_probackup2
3
- Version: 0.9.1
3
+ Version: 0.9.2
4
4
  Summary: Plugin for testgres that manages pg_probackup2
5
5
  Home-page: https://github.com/postgrespro/testgres
6
6
  Author: Postgres Professional