[go: up one dir, main page]

File: t199_script_info.py

package info (click to toggle)
uftrace 0.9.0-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 3,896 kB
  • sloc: ansic: 41,425; python: 7,369; makefile: 698; asm: 488; cpp: 461; sh: 349
file content (38 lines) | stat: -rw-r--r-- 1,087 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python

from runtest import TestBase
import subprocess as sp

TDIR='xxx'

class TestCase(TestBase):
    def __init__(self):
        TestBase.__init__(self, 'abc', """
False
v0.8.3-10/gfbfac3
('foo', 'bar')
""")

    def pre(self):
        script_cmd = '%s script' % (TestBase.uftrace_cmd)
        p = sp.Popen(script_cmd.split(), stdout=sp.PIPE, stderr=sp.PIPE)
        if p.communicate()[1].decode(errors='ignore').startswith('WARN:'):
            return TestBase.TEST_SKIP

        record_cmd = '%s record -d %s %s' % (TestBase.uftrace_cmd, TDIR, 't-abc')
        sp.call(record_cmd.split())
        return TestBase.TEST_SUCCESS

    def runcmd(self):
        uftrace = TestBase.uftrace_cmd
        options = '-F main -S ../scripts/info.py foo bar'
        return '%s script -d %s %s' % (uftrace, TDIR, options)

    def sort(self, output):
        result = output.strip().split('\n')
        result[1] = 'uftrace version'  # overwrite the version number
        return '\n'.join(result)

    def post(self, ret):
        sp.call(['rm', '-rf', TDIR])
        return ret