xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/sdk/buildtools-cases/sanity.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# SPDX-License-Identifier: MIT
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunimport shutil
6*4882a593Smuzhiyunimport os.path
7*4882a593Smuzhiyunfrom oeqa.sdk.case import OESDKTestCase
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunclass SanityTests(OESDKTestCase):
10*4882a593Smuzhiyun    def test_tools(self):
11*4882a593Smuzhiyun        """
12*4882a593Smuzhiyun        Test that wget and tar come from the buildtools, not the host. This
13*4882a593Smuzhiyun        verifies that the buildtools have installed correctly. We can't check
14*4882a593Smuzhiyun        for gcc as that is only installed by buildtools-extended.
15*4882a593Smuzhiyun        """
16*4882a593Smuzhiyun        for command in ("tar", "wget"):
17*4882a593Smuzhiyun            # Canonicalise the SDK root
18*4882a593Smuzhiyun            sdk_base = os.path.realpath(self.tc.sdk_dir)
19*4882a593Smuzhiyun            # Canonicalise the location of this command
20*4882a593Smuzhiyun            tool_path = os.path.realpath(self._run("command -v %s" % command).strip())
21*4882a593Smuzhiyun            # Assert that the tool was found inside the SDK root
22*4882a593Smuzhiyun            self.assertEquals(os.path.commonprefix((sdk_base, tool_path)), sdk_base)
23