xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/runtime/cases/ldd.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#
2# SPDX-License-Identifier: MIT
3#
4
5from oeqa.runtime.case import OERuntimeTestCase
6from oeqa.core.decorator.depends import OETestDepends
7from oeqa.core.decorator.data import skipIfNotFeature
8from oeqa.runtime.decorator.package import OEHasPackage
9
10class LddTest(OERuntimeTestCase):
11
12    @OEHasPackage(["ldd"])
13    @OETestDepends(['ssh.SSHTest.test_ssh'])
14    def test_ldd(self):
15        status, output = self.target.run('which ldd')
16        msg = 'ldd does not exist in PATH: which ldd: %s' % output
17        self.assertEqual(status, 0, msg=msg)
18
19        cmd = ('for i in $(which ldd | xargs cat | grep "^RTLDLIST"| '
20              'cut -d\'=\' -f2|tr -d \'"\'); '
21              'do test -f $i && echo $i && break; done')
22        status, output = self.target.run(cmd)
23        self.assertEqual(status, 0, msg="ldd path not correct or RTLDLIST files don't exist.")
24
25        status, output = self.target.run("ldd /bin/true")
26        self.assertEqual(status, 0, msg="ldd failed to execute: %s" % output)
27