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