Compare commits

..

5 commits

Author SHA1 Message Date
Merlin Mathesius
f28e4e9efc Bring branch 'epel7' in sync with '69lts'
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2021-02-11 15:35:41 -06:00
Merlin Mathesius
079897c6bd Sync with upstream release 69.2 (LTS series).
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-10-04 15:27:59 -05:00
Merlin Mathesius
c781f06f55 Update patch to always skip unreliable selftest.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-09-11 16:02:59 -05:00
Merlin Mathesius
c64e62364a Patch to skip selftest currently incompatible with Python 3.8.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-09-09 16:36:17 -05:00
Merlin Mathesius
0b2167ec1c Sync with upstream release 69.1 (LTS series).
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-06-18 13:27:40 -05:00
5 changed files with 1054 additions and 502 deletions

19
.gitignore vendored
View file

@ -16,20 +16,5 @@
/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
/avocado-69.1.tar.gz
/avocado-69.2.tar.gz

View file

@ -0,0 +1,11 @@
diff -ru ../avocado-69.1.ORIG/selftests/unit/test_loader.py ./selftests/unit/test_loader.py
--- ../avocado-69.1.ORIG/selftests/unit/test_loader.py 2019-06-12 13:39:15.000000000 -0500
+++ ./selftests/unit/test_loader.py 2019-09-11 15:56:24.289042537 -0500
@@ -449,6 +449,7 @@
('Test10', 'selftests/.data/loader_instrumented/imports.py:Test10.test')]
self._check_discovery(exps, tests)
+ @unittest.skip("Disabling unreliable test")
def test_dont_detect_non_avocado(self):
path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
'.data', 'loader_instrumented', 'dont_detect_non_avocado.py')

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
SHA512 (avocado-112.0.tar.gz) = 1872eda730f5cd28f0562732464ce14b2c7731cedb298fcc4b093a04235d26cc5e3db7f92c3ae3edcd6104ad2db4fce66fa7a6148da754e4bdb8120fa12a75a3
SHA512 (avocado-69.2.tar.gz) = edf348ed083c72de511190e0c615861cd413a54c30082f1a345d689ce7990bd0ceebfc81893087e3bc015716c6ae7ef104a71658f4b2b7cc75ec657ebe4eff61

View file

@ -1,7 +1,14 @@
#!/usr/bin/env python
import os
from six.moves import xrange as range
from avocado import Test
from avocado.utils import gdb, genio, process
from avocado import main
from avocado.utils import gdb
from avocado.utils import genio
from avocado.utils import process
class GdbTest(Test):
@ -25,22 +32,17 @@ class GdbTest(Test):
"-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}')
return99_source_path = os.path.join(self.datadir, 'return99.c')
segfault_source_path = os.path.join(self.datadir, 'segfault.c')
self.return99_binary_path = os.path.join(self.outputdir, 'return99')
process.system('gcc -O0 -g %s -o %s' % (return99_source_path,
self.return99_binary_path))
self.segfault_binary_path = os.path.join(self.outputdir, 'segfault')
process.system('gcc -O0 -g %s -o %s' % (segfault_source_path,
self.segfault_binary_path))
@staticmethod
def is_process_alive(process): # pylint: disable=W0621
def is_process_alive(process):
"""
Checks if a process is still alive
@ -71,14 +73,14 @@ class GdbTest(Test):
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:]}"
info_cmd = "-info-gdb-mi-command %s" % 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:]}"
info_cmd = "-info-gdb-mi-command %s" % cmd[1:]
r = g.cmd(info_cmd)
self.assertEqual(r.result.result.command.exists, 'false')
@ -103,7 +105,7 @@ class GdbTest(Test):
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}"
file_cmd = "-file-exec-and-symbols %s" % self.return99_binary_path
r = g.cmd(file_cmd)
self.assertEqual(r.result.class_, 'done')
@ -143,7 +145,7 @@ class GdbTest(Test):
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}"
file_cmd = "-file-exec-and-symbols %s" % self.segfault_binary_path
r = g.cmd(file_cmd)
self.assertEqual(r.result.class_, 'done')
@ -154,12 +156,12 @@ class GdbTest(Test):
other_messages = g.read_until_break()
core_path = None
for msg in other_messages:
parsed_msg = gdb.parse_mi(msg.decode())
parsed_msg = gdb.parse_mi(msg)
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}'
core_path = "%s.core" % self.segfault_binary_path
gcore_cmd = 'gcore %s' % core_path
gcore_cmd = gdb.encode_mi_cli(gcore_cmd)
r = g.cmd(gcore_cmd)
self.assertEqual(r.result.class_, 'done')
@ -189,14 +191,14 @@ class GdbTest(Test):
# Do 100 cycle of target (kind of connects) and disconnects
for _ in range(0, 100):
cmd = f'-target-select extended-remote :{s.port}'
cmd = '-target-select extended-remote :%s' % 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}'
cmd = '-target-select extended-remote :%s' % s.port
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'connected')
r = g.cli_cmd('monitor exit')
@ -232,15 +234,15 @@ class GdbTest(Test):
s = gdb.GDBServer()
g = gdb.GDB()
cmd = f'-file-exec-and-symbols {self.return99_binary_path}'
cmd = '-file-exec-and-symbols %s' % self.return99_binary_path
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
cmd = f'set remote exec-file {self.return99_binary_path}'
cmd = 'set remote exec-file %s' % self.return99_binary_path
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
cmd = f"-break-insert {'main'}"
cmd = "-break-insert %s" % 'main'
r = g.cmd(cmd)
self.assertEqual(r.result.class_, 'done')
@ -248,7 +250,7 @@ class GdbTest(Test):
other_messages = g.read_until_break()
for msg in other_messages:
parsed_msg = gdb.parse_mi(msg.decode())
parsed_msg = gdb.parse_mi(msg)
if (hasattr(parsed_msg, 'class_') and
parsed_msg.class_ == 'stopped' and
parsed_msg.result.reason == 'breakpoint-hit'):
@ -276,8 +278,7 @@ class GdbTest(Test):
c1 = gdb.GDB()
c1.connect(s.port)
c2 = gdb.GDB()
with self.assertRaises(gdb.UnexpectedResponseError):
c2.connect(s.port)
self.assertRaises(ValueError, c2.connect, s.port)
s.exit()
def test_server_exit(self):
@ -309,6 +310,43 @@ class GdbTest(Test):
server_instances[i].exit()
self.assertFalse(self.is_process_alive(server_instances[i].process))
def test_interactive(self):
"""
Tests avocado's GDB plugin features
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
"""
self.log.info('Testing GDB interactivity')
process.run(self.return99_binary_path, ignore_status=True)
def test_interactive_args(self):
"""
Tests avocado's GDB plugin features with an executable and args
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
This test uses `process.run()` without an `ignore_status` parameter
"""
self.log.info('Testing GDB interactivity with arguments')
result = process.run("%s 0" % self.return99_binary_path)
self.assertEqual(result.exit_status, 0)
def test_exit_status(self):
"""
Tests avocado's GDB plugin features
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
"""
self.log.info('Testing process exit statuses')
for arg, exp in [(-1, 255), (8, 8)]:
self.log.info('Expecting exit status "%s"', exp)
cmd = "%s %s" % (self.return99_binary_path, arg)
result = process.run(cmd, ignore_status=True)
self.assertEqual(result.exit_status, exp)
def test_server_stderr(self):
self.log.info('Testing server stderr collection')
s = gdb.GDBServer()
@ -316,7 +354,7 @@ class GdbTest(Test):
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}"
listening_line = "Listening on port %s" % s.port
self.assertIn(listening_line, stderr_lines)
def test_server_stdout(self):
@ -334,14 +372,28 @@ class GdbTest(Test):
stdout_lines = genio.read_all_lines(s.stdout_path)
self.assertIn("return 99", stdout_lines)
@staticmethod
def test_remote():
def test_interactive_stdout(self):
"""
Tests avocado's GDB plugin features
If GDB command line options are given, `--gdb-run-bin=return99` for
this particular test, the test will stop at binary main() function.
"""
self.log.info('Testing GDB interactivity')
result = process.run(self.return99_binary_path, ignore_status=True)
self.assertIn("return 99\n", result.stdout)
def test_remote(self):
"""
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")
r.cmd("qSupported")
r.cmd("qfThreadInfo")
s.exit()
if __name__ == '__main__':
main()