diff options
Diffstat (limited to 'meta/lib/oeqa/sdk/buildtools-cases')
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-cases/README | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-cases/build.py | 32 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-cases/gcc.py | 31 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-cases/https.py | 22 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-cases/sanity.py | 24 |
5 files changed, 111 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/README b/meta/lib/oeqa/sdk/buildtools-cases/README new file mode 100644 index 0000000000..d4f20faa9f --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/README | |||
@@ -0,0 +1,2 @@ | |||
1 | These test cases are used by buildtools-tarball, and are not used by the testsdk | ||
2 | class. | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/build.py b/meta/lib/oeqa/sdk/buildtools-cases/build.py new file mode 100644 index 0000000000..c85c32496b --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/build.py | |||
@@ -0,0 +1,32 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os, tempfile | ||
8 | import time | ||
9 | from oeqa.sdk.case import OESDKTestCase | ||
10 | from oeqa.utils.subprocesstweak import errors_have_output | ||
11 | errors_have_output() | ||
12 | |||
13 | class BuildTests(OESDKTestCase): | ||
14 | """ | ||
15 | Verify that bitbake can build virtual/libc inside the buildtools. | ||
16 | """ | ||
17 | def test_libc(self): | ||
18 | with tempfile.TemporaryDirectory(prefix='bitbake-build-', dir=self.tc.sdk_dir) as testdir: | ||
19 | corebase = self.td['COREBASE'] | ||
20 | |||
21 | self._run('. %s/oe-init-build-env %s' % (corebase, testdir)) | ||
22 | with open(os.path.join(testdir, 'conf', 'local.conf'), 'ta') as conf: | ||
23 | conf.write('\n') | ||
24 | conf.write('DL_DIR = "%s"\n' % self.td['DL_DIR']) | ||
25 | |||
26 | try: | ||
27 | self._run('. %s/oe-init-build-env %s && bitbake virtual/libc' % (corebase, testdir)) | ||
28 | finally: | ||
29 | delay = 10 | ||
30 | while delay and (os.path.exists(testdir + "/bitbake.lock") or os.path.exists(testdir + "/cache/hashserv.db-wal")): | ||
31 | time.sleep(1) | ||
32 | delay = delay - 1 | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/gcc.py b/meta/lib/oeqa/sdk/buildtools-cases/gcc.py new file mode 100644 index 0000000000..a62c4d0bc4 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/gcc.py | |||
@@ -0,0 +1,31 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import os.path | ||
8 | from oeqa.sdk.case import OESDKTestCase | ||
9 | |||
10 | class GccTests(OESDKTestCase): | ||
11 | def test_verify_specs(self): | ||
12 | """ | ||
13 | Verify that the compiler has been relocated successfully and isn't | ||
14 | looking in the hard-coded prefix. | ||
15 | """ | ||
16 | # Canonicalise the SDK root | ||
17 | sdk_base = os.path.realpath(self.tc.sdk_dir) | ||
18 | # Canonicalise the location of GCC | ||
19 | gcc_path = os.path.realpath(self._run("command -v gcc").strip()) | ||
20 | # Skip the test if the GCC didn't come from the buildtools, as it only | ||
21 | # comes with buildtools-extended-tarball. | ||
22 | if os.path.commonprefix((sdk_base, gcc_path)) != sdk_base: | ||
23 | self.skipTest("Buildtools does not provide GCC") | ||
24 | |||
25 | # This is the prefix that GCC is build with, and should be replaced at | ||
26 | # installation time. | ||
27 | sdkpath = self.td.get("SDKPATH") | ||
28 | self.assertTrue(sdkpath) | ||
29 | |||
30 | for line in self._run('gcc -dumpspecs').splitlines(): | ||
31 | self.assertNotIn(sdkpath, line) | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/https.py b/meta/lib/oeqa/sdk/buildtools-cases/https.py new file mode 100644 index 0000000000..4525e3d758 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/https.py | |||
@@ -0,0 +1,22 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | from oeqa.sdk.case import OESDKTestCase | ||
8 | from oeqa.utils.subprocesstweak import errors_have_output | ||
9 | errors_have_output() | ||
10 | |||
11 | class HTTPTests(OESDKTestCase): | ||
12 | """ | ||
13 | Verify that HTTPS certificates are working correctly, as this depends on | ||
14 | environment variables being set correctly. | ||
15 | """ | ||
16 | |||
17 | def test_wget(self): | ||
18 | self._run('env -i wget --debug --output-document /dev/null https://yoctoproject.org/connectivity.html') | ||
19 | |||
20 | def test_python(self): | ||
21 | # urlopen() returns a file-like object on success and throws an exception otherwise | ||
22 | self._run('python3 -c \'import urllib.request; urllib.request.urlopen("https://yoctoproject.org/connectivity.html")\'') | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/sanity.py b/meta/lib/oeqa/sdk/buildtools-cases/sanity.py new file mode 100644 index 0000000000..a55d456656 --- /dev/null +++ b/meta/lib/oeqa/sdk/buildtools-cases/sanity.py | |||
@@ -0,0 +1,24 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import shutil | ||
8 | import os.path | ||
9 | from oeqa.sdk.case import OESDKTestCase | ||
10 | |||
11 | class SanityTests(OESDKTestCase): | ||
12 | def test_tools(self): | ||
13 | """ | ||
14 | Test that wget and tar come from the buildtools, not the host. This | ||
15 | verifies that the buildtools have installed correctly. We can't check | ||
16 | for gcc as that is only installed by buildtools-extended. | ||
17 | """ | ||
18 | for command in ("tar", "wget"): | ||
19 | # Canonicalise the SDK root | ||
20 | sdk_base = os.path.realpath(self.tc.sdk_dir) | ||
21 | # Canonicalise the location of this command | ||
22 | tool_path = os.path.realpath(self._run("command -v %s" % command).strip()) | ||
23 | # Assert that the tool was found inside the SDK root | ||
24 | self.assertEqual(os.path.commonprefix((sdk_base, tool_path)), sdk_base) | ||