[go: up one dir, main page]

File: t200_lib_dlopen2.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 (33 lines) | stat: -rw-r--r-- 1,319 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
#!/usr/bin/env python

from runtest import TestBase

class TestCase(TestBase):
    """This tests when dlopen() loads multiple libraries (libbar and libbaz)
       at once.  The Parent code is in libbar while Child is in libbaz."""
    def __init__(self):
        TestBase.__init__(self, 'dlopen2', lang="C++", result="""
# DURATION     TID     FUNCTION
            [ 29510] | main() {
 398.509 us [ 29510] |   dlopen();
   2.324 us [ 29510] |   dlsym();
            [ 29510] |   creat() {
            [ 29510] |     Child::Child() {
   0.290 us [ 29510] |       Parent::Parent();
   1.703 us [ 29510] |     } /* Child::Child */
   6.090 us [ 29510] |   } /* creat */
   0.133 us [ 29510] |   Child::func();
  48.519 us [ 29510] |   dlclose();
 465.432 us [ 29510] | } /* main */
""")

    def build(self, name, cflags='', ldflags=''):
        if TestBase.build_libfoo(self, 'bar', cflags, ldflags) != 0:
            return TestBase.TEST_BUILD_FAIL
        if TestBase.build_libfoo(self, 'baz', cflags, ldflags + ' -L. -lbar') != 0:
            return TestBase.TEST_BUILD_FAIL
        return TestBase.build_libmain(self, name, 's-dlopen2.cpp', ['libdl.so'],
                                      cflags, ldflags)

    def runcmd(self):
        return 'LD_LIBRARY_PATH=. %s -F a %s' % (TestBase.uftrace_cmd, 't-dlopen2')