Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c93da4c769 | ||
|
|
566364403d |
6 changed files with 542 additions and 715 deletions
26
.gitignore
vendored
26
.gitignore
vendored
|
|
@ -7,29 +7,3 @@
|
|||
/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
|
||||
|
|
|
|||
11
avocado-selftest-doublefree-disable.patch
Normal file
11
avocado-selftest-doublefree-disable.patch
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
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):
|
||||
15
avocado-selftest-fix-cmdline-check.patch
Normal file
15
avocado-selftest-fix-cmdline-check.patch
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
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):
|
||||
1081
python-avocado.spec
1081
python-avocado.spec
File diff suppressed because it is too large
Load diff
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (avocado-112.0.tar.gz) = 1872eda730f5cd28f0562732464ce14b2c7731cedb298fcc4b093a04235d26cc5e3db7f92c3ae3edcd6104ad2db4fce66fa7a6148da754e4bdb8120fa12a75a3
|
||||
SHA512 (avocado-52.1.tar.gz) = fb97ea6056700f57f34e8e4ce0c27774c386d646aaffc7da2abb8d0a797cff4448934789ffaf81da1592fceae1bb464da2b5dde000730c4f417b03552a432c6c
|
||||
|
|
|
|||
122
tests/gdbtest.py
122
tests/gdbtest.py
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue