diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/glibc.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/glibc.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/meta/lib/oeqa/selftest/cases/glibc.py b/meta/lib/oeqa/selftest/cases/glibc.py index c687f6ef93..bd56b2f6e7 100644 --- a/meta/lib/oeqa/selftest/cases/glibc.py +++ b/meta/lib/oeqa/selftest/cases/glibc.py | |||
@@ -1,10 +1,15 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
1 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
5 | # | ||
2 | import os | 6 | import os |
7 | import time | ||
3 | import contextlib | 8 | import contextlib |
4 | from oeqa.core.decorator import OETestTag | 9 | from oeqa.core.decorator import OETestTag |
5 | from oeqa.core.case import OEPTestResultTestCase | 10 | from oeqa.core.case import OEPTestResultTestCase |
6 | from oeqa.selftest.case import OESelftestTestCase | 11 | from oeqa.selftest.case import OESelftestTestCase |
7 | from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runqemu, Command | 12 | from oeqa.utils.commands import bitbake, get_bb_var, runqemu |
8 | from oeqa.utils.nfs import unfs_server | 13 | from oeqa.utils.nfs import unfs_server |
9 | 14 | ||
10 | def parse_values(content): | 15 | def parse_values(content): |
@@ -24,16 +29,20 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): | |||
24 | features.append('TOOLCHAIN_TEST_HOST_USER = "root"') | 29 | features.append('TOOLCHAIN_TEST_HOST_USER = "root"') |
25 | features.append('TOOLCHAIN_TEST_HOST_PORT = "22"') | 30 | features.append('TOOLCHAIN_TEST_HOST_PORT = "22"') |
26 | # force single threaded test execution | 31 | # force single threaded test execution |
27 | features.append('EGLIBCPARALLELISM_task-check_pn-glibc-testsuite = "PARALLELMFLAGS="-j1""') | 32 | features.append('EGLIBCPARALLELISM:task-check:pn-glibc-testsuite = "PARALLELMFLAGS="-j1""') |
28 | self.write_config("\n".join(features)) | 33 | self.write_config("\n".join(features)) |
29 | 34 | ||
35 | start_time = time.time() | ||
36 | |||
30 | bitbake("glibc-testsuite -c check") | 37 | bitbake("glibc-testsuite -c check") |
31 | 38 | ||
39 | end_time = time.time() | ||
40 | |||
32 | builddir = get_bb_var("B", "glibc-testsuite") | 41 | builddir = get_bb_var("B", "glibc-testsuite") |
33 | 42 | ||
34 | ptestsuite = "glibc-user" if ssh is None else "glibc" | 43 | ptestsuite = "glibc-user" if ssh is None else "glibc" |
35 | self.ptest_section(ptestsuite) | 44 | self.ptest_section(ptestsuite, duration = int(end_time - start_time)) |
36 | with open(os.path.join(builddir, "tests.sum"), "r") as f: | 45 | with open(os.path.join(builddir, "tests.sum"), "r", errors='replace') as f: |
37 | for test, result in parse_values(f): | 46 | for test, result in parse_values(f): |
38 | self.ptest_result(ptestsuite, test, result) | 47 | self.ptest_result(ptestsuite, test, result) |
39 | 48 | ||
@@ -41,7 +50,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): | |||
41 | with contextlib.ExitStack() as s: | 50 | with contextlib.ExitStack() as s: |
42 | # use the base work dir, as the nfs mount, since the recipe directory may not exist | 51 | # use the base work dir, as the nfs mount, since the recipe directory may not exist |
43 | tmpdir = get_bb_var("BASE_WORKDIR") | 52 | tmpdir = get_bb_var("BASE_WORKDIR") |
44 | nfsport, mountport = s.enter_context(unfs_server(tmpdir)) | 53 | nfsport, mountport = s.enter_context(unfs_server(tmpdir, udp = False)) |
45 | 54 | ||
46 | # build core-image-minimal with required packages | 55 | # build core-image-minimal with required packages |
47 | default_installed_packages = [ | 56 | default_installed_packages = [ |
@@ -61,7 +70,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): | |||
61 | bitbake("core-image-minimal") | 70 | bitbake("core-image-minimal") |
62 | 71 | ||
63 | # start runqemu | 72 | # start runqemu |
64 | qemu = s.enter_context(runqemu("core-image-minimal", runqemuparams = "nographic")) | 73 | qemu = s.enter_context(runqemu("core-image-minimal", runqemuparams = "nographic", qemuparams = "-m 1024")) |
65 | 74 | ||
66 | # validate that SSH is working | 75 | # validate that SSH is working |
67 | status, _ = qemu.run("uname") | 76 | status, _ = qemu.run("uname") |
@@ -70,7 +79,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase): | |||
70 | # setup nfs mount | 79 | # setup nfs mount |
71 | if qemu.run("mkdir -p \"{0}\"".format(tmpdir))[0] != 0: | 80 | if qemu.run("mkdir -p \"{0}\"".format(tmpdir))[0] != 0: |
72 | raise Exception("Failed to setup NFS mount directory on target") | 81 | raise Exception("Failed to setup NFS mount directory on target") |
73 | mountcmd = "mount -o noac,nfsvers=3,port={0},udp,mountport={1} \"{2}:{3}\" \"{3}\"".format(nfsport, mountport, qemu.server_ip, tmpdir) | 82 | mountcmd = "mount -o noac,nfsvers=3,port={0},mountport={1} \"{2}:{3}\" \"{3}\"".format(nfsport, mountport, qemu.server_ip, tmpdir) |
74 | status, output = qemu.run(mountcmd) | 83 | status, output = qemu.run(mountcmd) |
75 | if status != 0: | 84 | if status != 0: |
76 | raise Exception("Failed to setup NFS mount on target ({})".format(repr(output))) | 85 | raise Exception("Failed to setup NFS mount on target ({})".format(repr(output))) |
@@ -83,6 +92,7 @@ class GlibcSelfTest(GlibcSelfTestBase): | |||
83 | self.run_check() | 92 | self.run_check() |
84 | 93 | ||
85 | @OETestTag("toolchain-system") | 94 | @OETestTag("toolchain-system") |
95 | @OETestTag("runqemu") | ||
86 | class GlibcSelfTestSystemEmulated(GlibcSelfTestBase): | 96 | class GlibcSelfTestSystemEmulated(GlibcSelfTestBase): |
87 | def test_glibc(self): | 97 | def test_glibc(self): |
88 | self.run_check_emulated() | 98 | self.run_check_emulated() |