test_gdb.py 1.1 KB
Newer Older
1 2 3
import os
import sys
import unittest
4 5
import shutil
import tempfile
6 7

# simple magic for using scripts within a source tree
8
basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')
9 10
basedir = os.path.abspath(basedir)
if os.path.isdir(os.path.join(basedir, 'avocado')):
11
    sys.path.insert(0, basedir)
12 13 14 15 16 17

from avocado.utils import process


class GDBPluginTest(unittest.TestCase):

18 19 20
    def setUp(self):
        self.tmpdir = tempfile.mkdtemp()

21 22
    def test_gdb_prerun_commands(self):
        os.chdir(basedir)
23 24
        cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '
                    '--gdb-prerun-commands=/dev/null passtest' % self.tmpdir)
25 26 27 28
        process.run(cmd_line)

    def test_gdb_multiple_prerun_commands(self):
        os.chdir(basedir)
29 30
        cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off --gdb-prerun-commands=/dev/null '
                    '--gdb-prerun-commands=foo:/dev/null passtest' % self.tmpdir)
31 32
        process.run(cmd_line)

33 34 35
    def tearDown(self):
        shutil.rmtree(self.tmpdir)

36 37
if __name__ == '__main__':
    unittest.main()