File: clientenv.py

package info (click to toggle)
booth 1.0-283-g9d4029a-2%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 936 kB
  • sloc: ansic: 7,170; sh: 2,187; python: 471; makefile: 267; xml: 7
file content (27 lines) | stat: -rw-r--r-- 1,023 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from boothtestenv import BoothTestEnvironment
from boothrunner  import BoothRunner

class ClientTestEnvironment(BoothTestEnvironment):
    mode = 'client'

    def run_booth(self, config_text=None, config_file=None, lock_file=True,
                  args=(), expected_exitcode=0, debug=False):
        '''
        Runs boothd.

        Returns a (pid, return_code, stdout, stderr, runner) tuple,
        where return_code/stdout/stderr are None iff pid is still running.
        '''
        self.init_log()

        runner = BoothRunner(self.boothd_path, self.mode, args)
        runner.show_args()
        (pid, return_code, stdout, stderr) = runner.run(expected_exitcode)
        self.check_return_code(pid, return_code, expected_exitcode)

        return (pid, return_code, stdout, stderr, runner)

    def _test_buffer_overflow(self, expected_error, **args):
        (pid, ret, stdout, stderr, runner) = \
            self.run_booth(expected_exitcode=1, **args)
        self.assertRegexpMatches(stderr, expected_error)