File: t266_patchable_dynamic4.py

package info (click to toggle)
uftrace 0.18.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,356 kB
  • sloc: ansic: 49,770; python: 11,181; asm: 837; makefile: 769; sh: 637; cpp: 627; javascript: 191
file content (39 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download | duplicates (2)
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
39
#!/usr/bin/env python3

from runtest import TestBase

class TestCase(TestBase):
    def __init__(self):
        TestBase.__init__(self, 'lib', """
# DURATION     TID     FUNCTION
            [  9519] | main() {
            [  9519] |   foo() {
            [  9519] |     lib_a() {
   0.625 us [  9519] |       lib_c();
   1.455 us [  9519] |     } /* lib_a */
   2.125 us [  9519] |   } /* foo */
   3.114 us [  9519] | } /* main */
""", sort='simple')

    def prerun(self, timeout):
        if not TestBase.check_arch_full_dynamic_support(self):
            return TestBase.TEST_SKIP
        return TestBase.TEST_SUCCESS

    def build(self, name, cflags='', ldflags=''):
        cflags = self.strip_tracing_flags(cflags)

        # add patchable function entry option
        machine = TestBase.get_machine(self)
        if machine == 'x86_64':
            cflags += ' -fpatchable-function-entry=5'
        elif machine == 'aarch64':
            cflags += ' -fpatchable-function-entry=2'

        if TestBase.build_libabc(self, cflags, ldflags) != 0:
            return TestBase.TEST_BUILD_FAIL
        return TestBase.build_libmain(self, name, 's-libmain.c',
                                      ['libabc_test_lib.so'], cflags)

    def setup(self):
        self.option = '-P . -P .@libabc_test_lib.so -U lib_b@libabc_test_lib.so --no-libcall'