diff options
Diffstat (limited to 'meta/lib/oeqa/sdk')
-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 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-docs-cases/README | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/buildtools-docs-cases/build.py | 19 | ||||
-rw-r--r-- | meta/lib/oeqa/sdk/testsdk.py | 24 |
8 files changed, 23 insertions, 133 deletions
diff --git a/meta/lib/oeqa/sdk/buildtools-cases/README b/meta/lib/oeqa/sdk/buildtools-cases/README deleted file mode 100644 index d4f20faa9f..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-cases/README +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
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 deleted file mode 100644 index c85c32496b..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-cases/build.py +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
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 deleted file mode 100644 index a62c4d0bc4..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-cases/gcc.py +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
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 deleted file mode 100644 index 4525e3d758..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-cases/https.py +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
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 deleted file mode 100644 index a55d456656..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-cases/sanity.py +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
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) | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/README b/meta/lib/oeqa/sdk/buildtools-docs-cases/README deleted file mode 100644 index f8edbc7dad..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-docs-cases/README +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | These test cases are used by build-docs-tarball, and are not used by the testsdk | ||
2 | class. | ||
diff --git a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py b/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py deleted file mode 100644 index 6e3ee94292..0000000000 --- a/meta/lib/oeqa/sdk/buildtools-docs-cases/build.py +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | import tempfile | ||
8 | from oeqa.sdk.case import OESDKTestCase | ||
9 | from oeqa.utils.subprocesstweak import errors_have_output | ||
10 | errors_have_output() | ||
11 | |||
12 | class BuildTests(OESDKTestCase): | ||
13 | """ | ||
14 | Verify that our docs can build using our docs tools tarball. | ||
15 | """ | ||
16 | def test_docs_build(self): | ||
17 | with tempfile.TemporaryDirectory(prefix='docs-tarball-build-', dir=self.tc.sdk_dir) as testdir: | ||
18 | self._run('git clone git://git.yoctoproject.org/yocto-docs %s' % testdir) | ||
19 | self._run('cd %s/documentation && make html' % testdir) | ||
diff --git a/meta/lib/oeqa/sdk/testsdk.py b/meta/lib/oeqa/sdk/testsdk.py index 52b702b6a2..cffcf9f49a 100644 --- a/meta/lib/oeqa/sdk/testsdk.py +++ b/meta/lib/oeqa/sdk/testsdk.py | |||
@@ -31,6 +31,28 @@ class TestSDK(TestSDKBase): | |||
31 | context_class = OESDKTestContext | 31 | context_class = OESDKTestContext |
32 | test_type = 'sdk' | 32 | test_type = 'sdk' |
33 | 33 | ||
34 | def sdk_dir_names(self, d): | ||
35 | """Return list from TESTSDK_CASE_DIRS.""" | ||
36 | testdirs = d.getVar("TESTSDK_CASE_DIRS") | ||
37 | if testdirs: | ||
38 | return testdirs.split() | ||
39 | |||
40 | bb.fatal("TESTSDK_CASE_DIRS unset, can't find SDK test directories.") | ||
41 | |||
42 | def get_sdk_paths(self, d): | ||
43 | """ | ||
44 | Return a list of paths where SDK test cases reside. | ||
45 | |||
46 | SDK tests are expected in <LAYER_DIR>/lib/oeqa/<dirname>/cases | ||
47 | """ | ||
48 | paths = [] | ||
49 | for layer in d.getVar("BBLAYERS").split(): | ||
50 | for dirname in self.sdk_dir_names(d): | ||
51 | case_path = os.path.join(layer, "lib", "oeqa", dirname, "cases") | ||
52 | if os.path.isdir(case_path): | ||
53 | paths.append(case_path) | ||
54 | return paths | ||
55 | |||
34 | def get_tcname(self, d): | 56 | def get_tcname(self, d): |
35 | """ | 57 | """ |
36 | Get the name of the SDK file | 58 | Get the name of the SDK file |
@@ -115,7 +137,7 @@ class TestSDK(TestSDKBase): | |||
115 | 137 | ||
116 | try: | 138 | try: |
117 | modules = (d.getVar("TESTSDK_SUITES") or "").split() | 139 | modules = (d.getVar("TESTSDK_SUITES") or "").split() |
118 | tc.loadTests(self.context_executor_class.default_cases, modules) | 140 | tc.loadTests(self.get_sdk_paths(d), modules) |
119 | except Exception as e: | 141 | except Exception as e: |
120 | import traceback | 142 | import traceback |
121 | bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) | 143 | bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) |