Compare commits
48 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee5cf26e92 | ||
|
|
a0f088ed18 | ||
|
|
e350a6d823 | ||
|
|
947ceab00c | ||
|
|
a12e378e73 | ||
|
|
71b50479dd | ||
|
|
54d20e2b89 | ||
|
|
d84ef63709 | ||
|
|
c84a1c5f93 | ||
|
|
a50932740b | ||
|
|
fbd8b0d95c | ||
|
|
6e6d0dac89 | ||
|
|
5e41ae22a8 | ||
|
|
42c94b1fec | ||
|
|
3c3eeac432 | ||
|
|
81494bf611 | ||
|
|
9e4eb91643 | ||
|
|
5bb1ce77be | ||
|
|
d9406a60f2 | ||
|
|
a4811c461c | ||
|
|
1a301b6268 | ||
|
|
92e1215793 | ||
|
|
af6d992792 | ||
|
|
04eafa9d9e | ||
|
|
85196ff998 | ||
|
|
a2cb6ab161 | ||
|
|
d6e052f5df | ||
|
|
45e0653cdc | ||
|
|
ca704ced8a | ||
|
|
f846228dfa | ||
|
|
eef3dc2740 | ||
|
|
144400fc2b | ||
|
|
d64a6360f5 | ||
|
|
0f28bcd9e1 | ||
|
|
ba99771825 | ||
|
|
c0e14dbafa | ||
|
|
ccb9faa20d | ||
|
|
e2511bfe75 | ||
|
|
a5ac1be67f | ||
|
|
89711448b3 | ||
|
|
5200b71adc | ||
|
|
b6a80deb28 | ||
|
|
9c79be072d | ||
|
|
1963b4bab3 | ||
|
|
814811a985 | ||
|
|
48c501c45f | ||
|
|
87dc683a36 | ||
|
|
c4a8d327c4 |
5 changed files with 474 additions and 1026 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
|
@ -16,5 +16,20 @@
|
|||
/avocado-67.0.tar.gz
|
||||
/avocado-68.0.tar.gz
|
||||
/avocado-69.0.tar.gz
|
||||
/avocado-69.1.tar.gz
|
||||
/avocado-69.2.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
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
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')
|
||||
1346
python-avocado.spec
1346
python-avocado.spec
File diff suppressed because it is too large
Load diff
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (avocado-69.2.tar.gz) = edf348ed083c72de511190e0c615861cd413a54c30082f1a345d689ce7990bd0ceebfc81893087e3bc015716c6ae7ef104a71658f4b2b7cc75ec657ebe4eff61
|
||||
SHA512 (avocado-112.0.tar.gz) = 1872eda730f5cd28f0562732464ce14b2c7731cedb298fcc4b093a04235d26cc5e3db7f92c3ae3edcd6104ad2db4fce66fa7a6148da754e4bdb8120fa12a75a3
|
||||
|
|
|
|||
122
tests/gdbtest.py
122
tests/gdbtest.py
|
|
@ -1,14 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
|
||||
from six.moves import xrange as range
|
||||
|
||||
from avocado import Test
|
||||
from avocado import main
|
||||
from avocado.utils import gdb
|
||||
from avocado.utils import genio
|
||||
from avocado.utils import process
|
||||
from avocado.utils import gdb, genio, process
|
||||
|
||||
|
||||
class GdbTest(Test):
|
||||
|
|
@ -32,17 +25,22 @@ class GdbTest(Test):
|
|||
"-auto-debug-it"]
|
||||
|
||||
def setUp(self):
|
||||
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))
|
||||
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):
|
||||
def is_process_alive(process): # pylint: disable=W0621
|
||||
"""
|
||||
Checks if a process is still alive
|
||||
|
||||
|
|
@ -73,14 +71,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 = "-info-gdb-mi-command %s" % cmd[1:]
|
||||
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 = "-info-gdb-mi-command %s" % cmd[1:]
|
||||
info_cmd = f"-info-gdb-mi-command {cmd[1:]}"
|
||||
r = g.cmd(info_cmd)
|
||||
self.assertEqual(r.result.result.command.exists, 'false')
|
||||
|
||||
|
|
@ -105,7 +103,7 @@ class GdbTest(Test):
|
|||
self.log.info("Testing that GDB loads a file and sets a breakpoint")
|
||||
g = gdb.GDB()
|
||||
|
||||
file_cmd = "-file-exec-and-symbols %s" % self.return99_binary_path
|
||||
file_cmd = f"-file-exec-and-symbols {self.return99_binary_path}"
|
||||
r = g.cmd(file_cmd)
|
||||
self.assertEqual(r.result.class_, 'done')
|
||||
|
||||
|
|
@ -145,7 +143,7 @@ class GdbTest(Test):
|
|||
self.log.info("Testing that a core dump will be generated")
|
||||
|
||||
g = gdb.GDB()
|
||||
file_cmd = "-file-exec-and-symbols %s" % self.segfault_binary_path
|
||||
file_cmd = f"-file-exec-and-symbols {self.segfault_binary_path}"
|
||||
r = g.cmd(file_cmd)
|
||||
self.assertEqual(r.result.class_, 'done')
|
||||
|
||||
|
|
@ -156,12 +154,12 @@ class GdbTest(Test):
|
|||
other_messages = g.read_until_break()
|
||||
core_path = None
|
||||
for msg in other_messages:
|
||||
parsed_msg = gdb.parse_mi(msg)
|
||||
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 = "%s.core" % self.segfault_binary_path
|
||||
gcore_cmd = 'gcore %s' % core_path
|
||||
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')
|
||||
|
|
@ -191,14 +189,14 @@ class GdbTest(Test):
|
|||
|
||||
# Do 100 cycle of target (kind of connects) and disconnects
|
||||
for _ in range(0, 100):
|
||||
cmd = '-target-select extended-remote :%s' % s.port
|
||||
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 = '-target-select extended-remote :%s' % s.port
|
||||
cmd = f'-target-select extended-remote :{s.port}'
|
||||
r = g.cmd(cmd)
|
||||
self.assertEqual(r.result.class_, 'connected')
|
||||
r = g.cli_cmd('monitor exit')
|
||||
|
|
@ -234,15 +232,15 @@ class GdbTest(Test):
|
|||
s = gdb.GDBServer()
|
||||
g = gdb.GDB()
|
||||
|
||||
cmd = '-file-exec-and-symbols %s' % self.return99_binary_path
|
||||
cmd = f'-file-exec-and-symbols {self.return99_binary_path}'
|
||||
r = g.cmd(cmd)
|
||||
self.assertEqual(r.result.class_, 'done')
|
||||
|
||||
cmd = 'set remote exec-file %s' % self.return99_binary_path
|
||||
cmd = f'set remote exec-file {self.return99_binary_path}'
|
||||
r = g.cmd(cmd)
|
||||
self.assertEqual(r.result.class_, 'done')
|
||||
|
||||
cmd = "-break-insert %s" % 'main'
|
||||
cmd = f"-break-insert {'main'}"
|
||||
r = g.cmd(cmd)
|
||||
self.assertEqual(r.result.class_, 'done')
|
||||
|
||||
|
|
@ -250,7 +248,7 @@ class GdbTest(Test):
|
|||
|
||||
other_messages = g.read_until_break()
|
||||
for msg in other_messages:
|
||||
parsed_msg = gdb.parse_mi(msg)
|
||||
parsed_msg = gdb.parse_mi(msg.decode())
|
||||
if (hasattr(parsed_msg, 'class_') and
|
||||
parsed_msg.class_ == 'stopped' and
|
||||
parsed_msg.result.reason == 'breakpoint-hit'):
|
||||
|
|
@ -278,7 +276,8 @@ class GdbTest(Test):
|
|||
c1 = gdb.GDB()
|
||||
c1.connect(s.port)
|
||||
c2 = gdb.GDB()
|
||||
self.assertRaises(ValueError, c2.connect, s.port)
|
||||
with self.assertRaises(gdb.UnexpectedResponseError):
|
||||
c2.connect(s.port)
|
||||
s.exit()
|
||||
|
||||
def test_server_exit(self):
|
||||
|
|
@ -310,43 +309,6 @@ 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()
|
||||
|
|
@ -354,7 +316,7 @@ class GdbTest(Test):
|
|||
self.assertTrue(os.path.exists(s.stderr_path))
|
||||
|
||||
stderr_lines = genio.read_all_lines(s.stderr_path)
|
||||
listening_line = "Listening on port %s" % s.port
|
||||
listening_line = f"Listening on port {s.port}"
|
||||
self.assertIn(listening_line, stderr_lines)
|
||||
|
||||
def test_server_stdout(self):
|
||||
|
|
@ -372,28 +334,14 @@ class GdbTest(Test):
|
|||
stdout_lines = genio.read_all_lines(s.stdout_path)
|
||||
self.assertIn("return 99", stdout_lines)
|
||||
|
||||
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):
|
||||
@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("qSupported")
|
||||
r.cmd("qfThreadInfo")
|
||||
r.cmd(b"qSupported")
|
||||
r.cmd(b"qfThreadInfo")
|
||||
s.exit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue