Compare commits

..

72 commits

Author SHA1 Message Date
Cleber Rosa
ee5cf26e92 Sync with upstream release 112.0
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2025-10-14 14:03:53 -04:00
Fedora Release Engineering
a0f088ed18 Unretirement request: pagure.io/releng/issue/13001
Revert "Retired: Fails to install: https://pagure.io/releng/issue/12969"

This reverts commit e350a6d823.

Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2025-10-09 12:01:58 +00:00
Miro Hrončok
e350a6d823 Retired: Fails to install: https://pagure.io/releng/issue/12969 2025-09-30 20:59:45 +02:00
Fedora Release Engineering
947ceab00c Unretirement request: pagure.io/releng/issue/12907
Revert "Retired: Fails to install: https://pagure.io/releng/issue/12871"

This reverts commit a12e378e73.

Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2025-08-28 06:18:04 +00:00
Miro Hrončok
a12e378e73 Retired: Fails to install: https://pagure.io/releng/issue/12871 2025-08-19 11:56:28 +02:00
Fedora Release Engineering
71b50479dd Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-25 06:46:47 +00:00
Python Maint
54d20e2b89 Rebuilt for Python 3.14 2025-06-03 15:32:47 +02:00
Miro Hrončok
d84ef63709 Loosen the PyYAML version requirement in python3-avocado-plugins-varianter-yaml-to-mux
Upstream has pinned this for Debian reasons:

f130c763be

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2025-01-20 18:55:27 -05:00
Miroslav Suchý
c84a1c5f93 migrate license to SPDX
This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2025-01-20 17:07:25 -05:00
Fedora Release Engineering
a50932740b Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-18 12:05:43 +00:00
Miroslav Suchý
fbd8b0d95c Migrate to SPDX license
This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4

If there will be no comments in two weeks, I will merge this.
2024-10-07 10:28:42 +00:00
Cleber Rosa
6e6d0dac89 Update to version 92.3
This update to a minor release on the 92LTS series, allowing
for building and running under F42.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2024-08-19 10:24:09 -04:00
Miroslav Suchý
5e41ae22a8 convert GPLv2+ license to SPDX
This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4
2024-07-26 02:15:51 +02:00
Fedora Release Engineering
42c94b1fec Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-19 09:39:48 +00:00
Python Maint
3c3eeac432 Rebuilt for Python 3.13 2024-06-07 18:57:17 +02:00
Fedora Release Engineering
81494bf611 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-29 11:09:26 +00:00
Fedora Release Engineering
9e4eb91643 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-26 01:30:07 +00:00
Fedora Release Engineering
5bb1ce77be Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 23:29:41 +00:00
Fedora Release Engineering
d9406a60f2 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-21 07:31:24 +00:00
Cleber Rosa
a4811c461c Update to version 92.1
This also enables the build/usage under Python 3.12, making it
suitable for Fedora 39.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=2220126
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=2155457
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2023-07-17 13:44:25 -04:00
Python Maint
1a301b6268 Rebuilt for Python 3.12 2023-06-14 20:21:36 +02:00
Fedora Release Engineering
92e1215793 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-20 11:24:35 +00:00
Cleber Rosa
af6d992792 Update to version 92.0
The current packaged version from upstream matches the Long Term
Stability (LTS) release 82.0, which is about to be EOLed upstream.
This updates the pacakge to track the latest and current LTS release.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2022-08-10 09:00:25 -04:00
Cleber Rosa
04eafa9d9e Sync gdbtest.py with latest upstream
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2022-08-10 09:00:25 -04:00
Fedora Release Engineering
85196ff998 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-22 16:32:26 +00:00
Python Maint
a2cb6ab161 Rebuilt for Python 3.11 2022-06-21 10:14:20 +02:00
Fedora Release Engineering
d6e052f5df - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-21 10:30:48 +00:00
Merlin Mathesius
45e0653cdc Loosen jinja2 version requirement to fix FTBFS in Rawhide
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2021-07-28 11:48:40 -05:00
Fedora Release Engineering
ca704ced8a - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 05:08:18 +00:00
Merlin Mathesius
f846228dfa Eliminate build dependency on make.
Additional minor SPEC cleanup.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2021-06-04 15:31:40 -05:00
Merlin Mathesius
eef3dc2740 Spec file cleanup following package review.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2021-03-18 16:51:26 -05:00
Merlin Mathesius
144400fc2b Fix up BuildRequires: add 'make', drop obsolete packages
Adjust PATH to make sure self-tests find internal modules

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2021-02-19 09:45:25 -06:00
Merlin Mathesius
d64a6360f5 Bring back non-modular package 2021-02-18 13:20:58 -06:00
Cleber Rosa
0f28bcd9e1 Sync with upstream release 82.0.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2020-09-14 19:04:05 -04:00
Cleber Rosa
ba99771825 Sync with upstream release 80.0.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2020-06-08 20:26:22 -04:00
Cleber Rosa
c0e14dbafa Sync with upstream release 79.0.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2020-05-11 21:53:15 -04:00
Merlin Mathesius
ccb9faa20d Sync with upstream release 78.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2020-04-15 11:30:21 -05:00
Merlin Mathesius
e2511bfe75 Sync with upstream release 77.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2020-03-17 15:55:08 -05:00
Merlin Mathesius
a5ac1be67f Sync with upstream release 76.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2020-03-09 17:16:58 -05:00
Merlin Mathesius
89711448b3 Sync with upstream release 75.1.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2020-01-21 13:21:07 -06:00
Merlin Mathesius
5200b71adc Sync with upstream release 74.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-12-23 13:34:42 -06:00
Merlin Mathesius
b6a80deb28 Sync with upstream release 73.0.
Adjustments to build for RHEL 8.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-11-27 13:23:18 -06:00
Merlin Mathesius
9c79be072d Sync with upstream release 72.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-10-02 14:13:46 -05:00
Merlin Mathesius
1963b4bab3 Sync with upstream release 71.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-08-28 08:39:27 -05:00
Merlin Mathesius
814811a985 Sync with upstream release 70.0.
Drop all Python 2 support from SPEC file.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-06-27 15:53:49 -05:00
Merlin Mathesius
19e497cb57 pyliblzma is Python 2-only and no longer available as of F31.
Unversioned executables should now be Python 3.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-05-23 10:39:56 -05:00
Merlin Mathesius
7921d86395 Disable components dependent upon Fiber in Fedora 31 and later,
since avocado is currently incompatible with the new Fiber API.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-05-20 11:17:51 -05:00
Merlin Mathesius
f1479feec0 Drop Python 2 support from F31 and RHEL8 onward.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-05-17 11:23:18 -05:00
Merlin Mathesius
0780ad3c4a python2-sphinx is no longer available or needed as of F31
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-19 16:37:24 -05:00
Merlin Mathesius
c8e4617f2f Sync with upstream release 69.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-02-27 22:10:26 -06:00
Merlin Mathesius
fc19652d5e Sync with upstream release 68.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-02-24 14:44:06 -06:00
Merlin Mathesius
b678a5f2c1 Sync with upstream release 67.0.
genisoimage, libcdio, and psmisc added as build deps so iso9660 tests run.
Replace pystache requirement with jinja2.
glibc-all-langpacks added as build dep for F30+ so vmimage tests run.
python2-resultsdb_api package has been removed in F30 so
  python2-avocado-plugins-resultsdb was also disabled.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-01-31 13:37:05 -06:00
Merlin Mathesius
48c501c45f Non-modular package is obsoleted by avocado:stable 2019-01-16 15:53:54 -06:00
Merlin Mathesius
04abfe7b49 python2-pycdlib package has been removed in F30 as part of
https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

Disabled an additional self-test causing build failures with upstream
release 66.0.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2018-11-28 11:42:46 -06:00
Merlin Mathesius
ca0081ee31 Sync with upstream release 66.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2018-11-21 11:41:12 -06:00
Merlin Mathesius
2b15941a13 Sync with upstream release 65.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2018-10-04 11:05:12 -05:00
Merlin Mathesius
f0e9dccf5c Sync with upstream release 64.0.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2018-08-28 13:37:22 -05:00
Merlin Mathesius
1454277ea9 Added missing python[2]-enum34 requirement. 2018-07-26 11:45:24 -05:00
Merlin Mathesius
549ac485c4 Sync with upstream release 63.0. (BZ#1602175)
Include upstream patches needed to build for Rawhide.
2018-07-23 13:08:47 -05:00
Zbigniew Jędrzejewski-Szmek
87dc683a36 Fix rst2man reference and python shebangs
Also remove obsolete Group tag.
2018-07-21 23:17:41 +02:00
Fedora Release Engineering
c4a8d327c4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 23:32:38 +00:00
Merlin Mathesius
ad2fd25084 Sync with upstream release 62.0. (BZ#1590572)
Correct libvirt dependency for EPEL7/RHEL7
2018-06-13 16:58:48 -05:00
Merlin Mathesius
ed6d05362f Correct libvirt dependency for EPEL7/RHEL7 2018-06-08 09:32:13 -05:00
Merlin Mathesius
c7c0dc0db6 Unify git branches that inadvertently diverged 2018-06-05 08:31:18 -05:00
Merlin Mathesius
1087f35c47 Conditionalize python2 dependencies for cross-release compatibility of SPEC 2018-06-05 08:26:58 -05:00
Merlin Mathesius
c1a2b865bd Sync with upstream release 61.0.
Packaging updates for Python 3.
Reorganize SPEC file.
2018-05-18 12:42:48 -05:00
Merlin Mathesius
384b8eaf64 Dependency fabric has been renamed to python2-fabric3 2018-05-14 17:09:04 -05:00
Merlin Mathesius
56cf4c4682 correct python_provide argument typo for varianter-yaml-to-mux plugin 2018-05-14 14:10:36 -05:00
Cleber Rosa
db1d9447e6 Enable initial set of Fedora CI tests
The goal of the Fedora CI is to run "basic functionality" and
"integration" tests.  Avocado's gdbtest.py does both, as it exercises
the Avocado test and utils APIs, and also communicates with GDB, thus
ensuring some integration validation with those packages.

Reference: https://fedoraproject.org/wiki/CI
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2018-04-09 11:40:03 -04:00
Merlin Mathesius
84b857f387 Sync with upstream release 52.1 (LTS series).
Correct deprecated use of unversioned python.
Remove obsolete CI test directory.
2018-04-03 15:26:58 -05:00
Iryna Shcherbina
19cd06ed09 Update Python 2 dependency declarations to new packaging standards 2018-03-26 23:55:30 +02:00
Fedora Release Engineering
c17d4daf83 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 06:46:00 +00:00
9 changed files with 1137 additions and 381 deletions

26
.gitignore vendored
View file

@ -7,3 +7,29 @@
/avocado-51.0.tar.gz
/avocado-52.0.tar.gz
/avocado-52.1.tar.gz
/avocado-61.0.tar.gz
/avocado-62.0.tar.gz
/avocado-63.0.tar.gz
/avocado-64.0.tar.gz
/avocado-65.0.tar.gz
/avocado-66.0.tar.gz
/avocado-67.0.tar.gz
/avocado-68.0.tar.gz
/avocado-69.0.tar.gz
/avocado-70.0.tar.gz
/avocado-71.0.tar.gz
/avocado-72.0.tar.gz
/avocado-73.0.tar.gz
/avocado-74.0.tar.gz
/avocado-75.1.tar.gz
/avocado-76.0.tar.gz
/avocado-77.0.tar.gz
/avocado-78.0.tar.gz
/avocado-79.0.tar.gz
/avocado-80.0.tar.gz
/avocado-82.0.tar.gz
/avocado-92.0.tar.gz
/avocado-92.1.tar.gz
/avocado-92.1-python312.patch
/avocado-92.3.tar.gz
/avocado-112.0.tar.gz

View file

@ -1,11 +0,0 @@
diff -r -u avocado-52.0.orig/selftests/functional/test_output.py avocado-52.0/selftests/functional/test_output.py
--- avocado-52.0.orig/selftests/functional/test_output.py 2017-06-26 19:26:48.000000000 -0500
+++ avocado-52.0/selftests/functional/test_output.py 2017-08-09 07:40:41.636928188 -0500
@@ -67,6 +67,7 @@
def setUp(self):
self.tmpdir = tempfile.mkdtemp(prefix='avocado_' + __name__)
+ @unittest.skip("Test is producing a false failure due to platform/compiler changes")
@unittest.skipIf(missing_binary('cc'),
"C compiler is required by the underlying doublefree.py test")
def test_output_doublefree(self):

View file

@ -1,15 +0,0 @@
diff -ru ../avocado-52.1.orig/selftests/functional/test_plugin_diff.py ./selftests/functional/test_plugin_diff.py
--- ../avocado-52.1.orig/selftests/functional/test_plugin_diff.py 2018-03-01 12:05:02.000000000 -0600
+++ ./selftests/functional/test_plugin_diff.py 2018-03-13 16:50:33.662490323 -0500
@@ -52,9 +52,9 @@
result = self.run_and_check(cmd_line, expected_rc)
msg = "# COMMAND LINE"
self.assertIn(msg, result.stdout)
- msg = "-./scripts/avocado run"
+ msg = "-%s run" % AVOCADO
self.assertIn(msg, result.stdout)
- msg = "+./scripts/avocado run"
+ msg = "+%s run" % AVOCADO
self.assertIn(msg, result.stdout)
def test_diff_nocmdline(self):

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
SHA512 (avocado-52.1.tar.gz) = fb97ea6056700f57f34e8e4ce0c27774c386d646aaffc7da2abb8d0a797cff4448934789ffaf81da1592fceae1bb464da2b5dde000730c4f417b03552a432c6c
SHA512 (avocado-112.0.tar.gz) = 1872eda730f5cd28f0562732464ce14b2c7731cedb298fcc4b093a04235d26cc5e3db7f92c3ae3edcd6104ad2db4fce66fa7a6148da754e4bdb8120fa12a75a3

347
tests/gdbtest.py Executable file
View file

@ -0,0 +1,347 @@
import os
from avocado import Test
from avocado.utils import gdb, genio, process
class GdbTest(Test):
"""
Execute the gdb test
:avocado: tags=requires_c_compiler
"""
VALID_CMDS = ["-list-target-features",
"-break-info",
"-break-list",
"-thread-info",
"-stack-info-frame",
"-stack-info-depth"]
INVALID_CMDS = ["-foobar",
"-magic8ball",
"-find-me-the-bug",
"-auto-debug-it"]
def setUp(self):
self.return99_binary_path = os.path.join(self.teststmpdir, 'return99')
if not os.path.exists(self.return99_binary_path):
return99_source_path = self.get_data('return99.c')
if return99_source_path is None:
self.cancel('Test is missing data file "return99.c"')
process.system(f'gcc -O0 -g {return99_source_path} -o {self.return99_binary_path}')
self.segfault_binary_path = os.path.join(self.teststmpdir, 'segfault')
if not os.path.exists(self.segfault_binary_path):
segfault_source_path = self.get_data('segfault.c')
if segfault_source_path is None:
self.cancel('Test is missing data file "segfault.c"')
process.system(f'gcc -O0 -g {segfault_source_path} -o {self.segfault_binary_path}')
@staticmethod
def is_process_alive(process): # pylint: disable=W0621
"""
Checks if a process is still alive
:param process: a :class:`subprocess.POpen` instance
:type process: :class:`subprocess.POpen`
:returns: True or False
:rtype: bool
"""
return process.poll() is None
def test_start_exit(self):
"""
Tests execution of multiple GDB instances without any blocking or race
"""
self.log.info("Testing execution of multiple GDB instances")
process_count = 10
gdb_instances = []
for i in range(0, process_count):
gdb_instances.append(gdb.GDB())
for i in range(0, process_count):
self.assertEqual(gdb_instances[i].exit(), 0)
def test_existing_commands_raw(self):
"""
Tests the GDB response to commands that exist and to those that do not
"""
g = gdb.GDB()
self.log.info("Testing existing (valid) GDB commands using raw commands")
for cmd in self.VALID_CMDS:
info_cmd = f"-info-gdb-mi-command {cmd[1:]}"
r = g.cmd(info_cmd)
self.assertEqual(r.result.result.command.exists, 'true')
self.log.info("Testing non-existing (invalid) GDB commands using raw "
"commands")
for cmd in self.INVALID_CMDS:
info_cmd = f"-info-gdb-mi-command {cmd[1:]}"
r = g.cmd(info_cmd)
self.assertEqual(r.result.result.command.exists, 'false')
def test_existing_commands(self):
g = gdb.GDB()
self.log.info("Testing existing (valid) GDB commands using utility "
"methods")
for cmd in self.VALID_CMDS:
self.assertTrue(g.cmd_exists(cmd))
g.cmd(cmd)
self.log.info("Testing non-existing (invalid) GDB commands using "
"utility methods")
for cmd in self.INVALID_CMDS:
self.assertFalse(g.cmd_exists(cmd))
def test_load_set_breakpoint_run_exit_raw(self):
"""
Test a common GDB cycle using raw commands: load, set break, run, exit
"""
self.log.info("Testing that GDB loads a file and sets a breakpoint")
g = gdb.GDB()
file_cmd = f"-file-exec-and-symbols {self.return99_binary_path}"
r = g.cmd(file_cmd)
self.assertEqual(r.result.class_, 'done')
break_cmd = "-break-insert 5"
r = g.cmd(break_cmd)
self.assertEqual(r.result.class_, 'done')
self.assertEqual(r.result.result.bkpt.number, '1')
self.assertEqual(r.result.result.bkpt.enabled, 'y')
break_del_cmd = "-break-delete 1"
r = g.cmd(break_del_cmd)
self.assertEqual(r.result.class_, 'done')
run_cmd = "-exec-run"
r = g.cmd(run_cmd)
self.assertEqual(r.result.class_, 'running')
g.cmd("-gdb-exit")
self.assertEqual(g.process.wait(), 0)
def test_load_set_breakpoint_run_exit(self):
"""
Test a common GDB cycle: load, set break, delete break, run, exit
"""
self.log.info("Testing a common GDB cycle")
g = gdb.GDB()
g.set_file(self.return99_binary_path)
g.set_break("5")
g.del_break(1)
g.run()
g.exit()
def test_generate_core(self):
"""
Load a file that will cause a segfault and produce a core dump
"""
self.log.info("Testing that a core dump will be generated")
g = gdb.GDB()
file_cmd = f"-file-exec-and-symbols {self.segfault_binary_path}"
r = g.cmd(file_cmd)
self.assertEqual(r.result.class_, 'done')
run_cmd = "-exec-run"
r = g.cmd(run_cmd)
self.assertEqual(r.result.class_, 'running')
other_messages = g.read_until_break()
core_path = None
for msg in other_messages:
parsed_msg = gdb.parse_mi(msg.decode())
if (hasattr(parsed_msg, 'class_') and
(parsed_msg.class_ == 'stopped') and
(parsed_msg.result.signal_name == 'SIGSEGV')):
core_path = f"{self.segfault_binary_path}.core"
gcore_cmd = f'gcore {core_path}'
gcore_cmd = gdb.encode_mi_cli(gcore_cmd)
r = g.cmd(gcore_cmd)
self.assertEqual(r.result.class_, 'done')
self.assertTrue(os.path.exists(core_path))
g.exit()
def test_set_multiple_break(self):
"""
Tests that multiple breakpoints do not interfere with each other
"""
self.log.info("Testing setting multiple breakpoints")
g = gdb.GDB()
g.set_file(self.return99_binary_path)
g.set_break('empty')
g.set_break('7')
g.exit()
def test_disconnect_raw(self):
"""
Connect/disconnect repeatedly from a remote debugger using raw commands
"""
self.log.info("Testing connecting and disconnecting repeatedly using "
"raw commands")
s = gdb.GDBServer()
g = gdb.GDB()
# Do 100 cycle of target (kind of connects) and disconnects
for _ in range(0, 100):
cmd = f'-target-select extended-remote :{s.port}'
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'connected')
r = g.cmd('-target-disconnect')
self.assertEqual(r.result.class_, 'done')
# manual server shutdown
cmd = f'-target-select extended-remote :{s.port}'
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'connected')
r = g.cli_cmd('monitor exit')
self.assertEqual(r.result.class_, 'done')
g.exit()
s.exit()
def test_disconnect(self):
"""
Connect/disconnect repeatedly from a remote debugger using utilities
"""
self.log.info("Testing connecting and disconnecting repeatedly")
s = gdb.GDBServer()
g = gdb.GDB()
for _ in range(0, 100):
r = g.connect(s.port)
self.assertEqual(r.result.class_, 'connected')
r = g.disconnect()
self.assertEqual(r.result.class_, 'done')
g.exit()
s.exit()
def test_remote_exec(self):
"""
Tests execution on a remote target
"""
self.log.info("Testing execution on a remote target")
hit_breakpoint = False
s = gdb.GDBServer()
g = gdb.GDB()
cmd = f'-file-exec-and-symbols {self.return99_binary_path}'
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
cmd = f'set remote exec-file {self.return99_binary_path}'
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
cmd = f"-break-insert {'main'}"
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
r = g.cmd('-exec-run')
other_messages = g.read_until_break()
for msg in other_messages:
parsed_msg = gdb.parse_mi(msg.decode())
if (hasattr(parsed_msg, 'class_') and
parsed_msg.class_ == 'stopped' and
parsed_msg.result.reason == 'breakpoint-hit'):
hit_breakpoint = True
self.assertTrue(hit_breakpoint)
g.exit()
s.exit()
def test_stream_messages(self):
"""
Tests if the expected response appears in the result stream messages
"""
self.log.info("Testing that messages appears in the result stream")
g = gdb.GDB()
r = g.cmd("-gdb-version")
self.assertIn("GNU GPL version", r.get_stream_messages_text())
def test_connect_multiple_clients(self):
"""
Tests two or more connections to the same server raise an exception
"""
self.log.info("Testing that multiple clients cannot connect at once")
s = gdb.GDBServer()
c1 = gdb.GDB()
c1.connect(s.port)
c2 = gdb.GDB()
with self.assertRaises(gdb.UnexpectedResponseError):
c2.connect(s.port)
s.exit()
def test_server_exit(self):
"""
Tests that the server is shutdown by using a monitor exit command
"""
self.log.info("Testing that a single server exits cleanly")
s = gdb.GDBServer()
s.exit()
self.assertFalse(self.is_process_alive(s.process))
def test_multiple_servers(self):
"""
Tests multiple server instances without any blocking or race condition
"""
self.log.info("Testing execution of multiple GDB server instances")
process_count = 10
server_instances = []
for i in range(0, process_count):
s = gdb.GDBServer()
c = gdb.GDB()
c.connect(s.port)
c.cmd('show-version')
c.disconnect()
server_instances.append(s)
for i in range(0, process_count):
self.assertTrue(self.is_process_alive(server_instances[i].process))
server_instances[i].exit()
self.assertFalse(self.is_process_alive(server_instances[i].process))
def test_server_stderr(self):
self.log.info('Testing server stderr collection')
s = gdb.GDBServer()
s.exit()
self.assertTrue(os.path.exists(s.stderr_path))
stderr_lines = genio.read_all_lines(s.stderr_path)
listening_line = f"Listening on port {s.port}"
self.assertIn(listening_line, stderr_lines)
def test_server_stdout(self):
self.log.info('Testing server stdout/stderr collection')
s = gdb.GDBServer()
c = gdb.GDB()
c.connect(s.port)
c.set_file(self.return99_binary_path)
c.run()
s.exit()
self.assertTrue(os.path.exists(s.stdout_path))
self.assertTrue(os.path.exists(s.stderr_path))
stdout_lines = genio.read_all_lines(s.stdout_path)
self.assertIn("return 99", stdout_lines)
@staticmethod
def test_remote():
"""
Tests GDBRemote interaction with a GDBServer
"""
s = gdb.GDBServer()
r = gdb.GDBRemote('127.0.0.1', s.port)
r.connect()
r.cmd(b"qSupported")
r.cmd(b"qfThreadInfo")
s.exit()

View file

@ -0,0 +1,47 @@
#include <stdio.h>
#include <stdlib.h>
void empty()
{
}
void write_stdout()
{
fprintf(stdout, "testing output to stdout\n");
}
void write_stderr()
{
fprintf(stderr, "testing output to stderr\n");
}
int forkme()
{
int pid;
pid = fork();
if (pid != 0)
pid = fork();
if (pid != 0)
pid = fork();
return pid;
}
int main(int argc, char *argv[])
{
int exit_status = 99;
if (argc > 1)
exit_status = atoi(argv[1]);
empty();
write_stdout();
write_stderr();
if (forkme()) {
fprintf(stdout, "return %i\n", exit_status);
}
return exit_status;
}

View file

@ -0,0 +1,9 @@
#include <stdio.h>
int main()
{
int *p = NULL;
*p = 0xdead;
return 0;
}

29
tests/tests.yml Normal file
View file

@ -0,0 +1,29 @@
- hosts: localhost
roles:
- role: standard-test-avocado
tests:
- gdbtest.py:GdbTest.test_start_exit
- gdbtest.py:GdbTest.test_existing_commands
- gdbtest.py:GdbTest.test_existing_commands_raw
- gdbtest.py:GdbTest.test_load_set_breakpoint_run_exit_raw
- gdbtest.py:GdbTest.test_load_set_breakpoint_run_exit
- gdbtest.py:GdbTest.test_generate_core
- gdbtest.py:GdbTest.test_set_multiple_break
- gdbtest.py:GdbTest.test_disconnect_raw
- gdbtest.py:GdbTest.test_disconnect
- gdbtest.py:GdbTest.test_remote_exec
- gdbtest.py:GdbTest.test_stream_messages
- gdbtest.py:GdbTest.test_connect_multiple_clients
- gdbtest.py:GdbTest.test_server_exit
- gdbtest.py:GdbTest.test_server_stdout
- gdbtest.py:GdbTest.test_server_stderr
- gdbtest.py:GdbTest.test_multiple_servers
- gdbtest.py:GdbTest.test_interactive
- gdbtest.py:GdbTest.test_interactive_args
- gdbtest.py:GdbTest.test_exit_status
- gdbtest.py:GdbTest.test_interactive_stdout
- gdbtest.py:GdbTest.test_remote
required_packages:
- gcc
- gdb
- gdb-gdbserver