Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: Khem Raj <raj.khem@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v2 2/9] testimage.bbclass: detect slirp from TEST_RUNQEMUPARAMS
Date: Wed, 23 Aug 2023 09:48:12 +0300	[thread overview]
Message-ID: <ZOWrrK+woCwxhu0W@nuoska> (raw)
In-Reply-To: <CAMKF1spz74E1N6tf=FzwrWwnHr0Gddo2J4pY8NdxW6h127=oSA@mail.gmail.com>

Hi,

On Tue, Aug 22, 2023 at 11:25:58PM -0700, Khem Raj wrote:
> On Tue, Aug 22, 2023 at 11:10 PM Mikko Rapeli <mikko.rapeli@linaro.org> wrote:
> >
> > Also set target and server IP addresses correctly to 127.0.0.1
> > so that TEST_TARGET_IP and TEST_SERVER_IP don't
> > need to be set manually with slirp.
> >
> > Users run qemu images with slirp networking like this:
> >
> > $ bitbake core-image-minimal
> > $ ../poky/scripts/runqemu slirp
> >
> > slirp networking means that only one TCP port is forwarded from host
> > system to the qemu machine so that ssh into the machine works. ping
> > and other low level networking from host to target machine do not work,
> > but networking from target via host does work. This is much more easy to
> > setup than the bridge networking used by default, which I've never
> > managed to get running on various host machines.
> >
> > To use slirp networking wita qemu and core-image-minimal to run testimage.bbclass tests, add
> > these to local.conf:
> >
> > IMAGE_CLASSES += "testimage"
> > IMAGE_FEATURES += "ssh-server-dropbear"
> > TEST_RUNQEMUPARAMS += "slirp"
> >
> > Then image can be compiled and tested with:
> >
> > $ bitbake core-image-minimal
> > $ bitbake -c testimage core-image-minimal
> >
> > Note that only few of the current oeqa runtime tests work against
> > core-image-minimal, but test results look like:
> >
> > RESULTS:
> > RESULTS - date.DateTest.test_date: PASSED (3.64s)
> > RESULTS - df.DfTest.test_df: PASSED (0.55s)
> > RESULTS - oe_syslog.SyslogTest.test_syslog_running: PASSED (0.56s)
> > RESULTS - oe_syslog.SyslogTestConfig.test_syslog_logger: PASSED (1.88s)
> > RESULTS - oe_syslog.SyslogTestConfig.test_syslog_restart: PASSED (0.93s)
> > RESULTS - pam.PamBasicTest.test_pam: PASSED (2.20s)
> > RESULTS - parselogs.ParseLogsTest.test_parselogs: PASSED (4.98s)
> > RESULTS - ping.PingTest.test_ping: PASSED (0.05s)
> > RESULTS - ssh.SSHTest.test_ssh: PASSED (1.28s)
> > RESULTS - systemd.SystemdBasicTests.test_systemd_basic: PASSED (0.56s)
> > RESULTS - systemd.SystemdBasicTests.test_systemd_failed: PASSED (1.10s)
> > RESULTS - systemd.SystemdBasicTests.test_systemd_list: PASSED (0.92s)
> > RESULTS - systemd.SystemdJournalTests.test_systemd_boot_time: PASSED (0.56s)
> > RESULTS - systemd.SystemdJournalTests.test_systemd_journal: PASSED (0.54s)
> > RESULTS - apt.AptRepoTest.test_apt_install_from_repo: SKIPPED (0.00s)
> > RESULTS - buildcpio.BuildCpioTest.test_cpio: SKIPPED (0.00s)
> > RESULTS - buildgalculator.GalculatorTest.test_galculator: SKIPPED (0.00s)
> > RESULTS - buildlzip.BuildLzipTest.test_lzip: SKIPPED (0.00s)
> > RESULTS - connman.ConnmanTest.test_connmand_help: SKIPPED (0.00s)
> > RESULTS - connman.ConnmanTest.test_connmand_running: SKIPPED (0.00s)
> > RESULTS - dnf.DnfBasicTest.test_dnf_help: SKIPPED (0.00s)
> > RESULTS - dnf.DnfBasicTest.test_dnf_history: SKIPPED (0.00s)
> > RESULTS - dnf.DnfBasicTest.test_dnf_info: SKIPPED (0.00s)
> > RESULTS - dnf.DnfBasicTest.test_dnf_search: SKIPPED (0.00s)
> > RESULTS - dnf.DnfBasicTest.test_dnf_version: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_exclude: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_install: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_install_dependency: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_install_from_disk: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_install_from_http: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_installroot: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_installroot_usrmerge: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_makecache: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_reinstall: SKIPPED (0.00s)
> > RESULTS - dnf.DnfRepoTest.test_dnf_repoinfo: SKIPPED (0.00s)
> > RESULTS - gcc.GccCompileTest.test_gcc_compile: SKIPPED (0.00s)
> > RESULTS - gcc.GccCompileTest.test_gpp2_compile: SKIPPED (0.00s)
> > RESULTS - gcc.GccCompileTest.test_gpp_compile: SKIPPED (0.00s)
> > RESULTS - gcc.GccCompileTest.test_make: SKIPPED (0.00s)
> > RESULTS - gi.GObjectIntrospectionTest.test_python: SKIPPED (0.00s)
> > RESULTS - go.GoHelloworldTest.test_gohelloworld: SKIPPED (0.00s)
> > RESULTS - kernelmodule.KernelModuleTest.test_kernel_module: SKIPPED (0.00s)
> > RESULTS - ldd.LddTest.test_ldd: SKIPPED (0.00s)
> > RESULTS - logrotate.LogrotateTest.test_logrotate_newlog: SKIPPED (0.00s)
> > RESULTS - logrotate.LogrotateTest.test_logrotate_wtmp: SKIPPED (0.00s)
> > RESULTS - oe_syslog.SyslogTestConfig.test_syslog_startup_config: SKIPPED (0.00s)
> > RESULTS - opkg.OpkgRepoTest.test_opkg_install_from_repo: SKIPPED (0.00s)
> > RESULTS - perl.PerlTest.test_perl_works: SKIPPED (0.00s)
> > RESULTS - ptest.PtestRunnerTest.test_ptestrunner_expectfail: SKIPPED (0.00s)
> > RESULTS - ptest.PtestRunnerTest.test_ptestrunner_expectsuccess: SKIPPED (0.00s)
> > RESULTS - python.PythonTest.test_python3: SKIPPED (0.00s)
> > RESULTS - rpm.RpmBasicTest.test_rpm_help: SKIPPED (0.00s)
> > RESULTS - rpm.RpmBasicTest.test_rpm_query: SKIPPED (0.00s)
> > RESULTS - rpm.RpmBasicTest.test_rpm_query_nonroot: SKIPPED (0.00s)
> > RESULTS - rpm.RpmInstallRemoveTest.test_check_rpm_install_removal_log_file_size: SKIPPED (0.00s)
> > RESULTS - rpm.RpmInstallRemoveTest.test_rpm_install: SKIPPED (0.00s)
> > RESULTS - rpm.RpmInstallRemoveTest.test_rpm_remove: SKIPPED (0.00s)
> > RESULTS - rust.RustCompileTest.test_cargo_compile: SKIPPED (0.00s)
> > RESULTS - rust.RustCompileTest.test_rust_compile: SKIPPED (0.00s)
> > RESULTS - scp.ScpTest.test_scp_file: SKIPPED (0.00s)
> > RESULTS - stap.StapTest.test_stap: SKIPPED (0.00s)
> > RESULTS - systemd.SystemdServiceTests.test_systemd_disable_enable: SKIPPED (0.00s)
> > RESULTS - systemd.SystemdServiceTests.test_systemd_disable_enable_ro: SKIPPED (0.00s)
> > RESULTS - systemd.SystemdServiceTests.test_systemd_status: SKIPPED (0.00s)
> > RESULTS - systemd.SystemdServiceTests.test_systemd_stop_start: SKIPPED (0.00s)
> > RESULTS - weston.WestonTest.test_wayland_info: SKIPPED (0.00s)
> > RESULTS - weston.WestonTest.test_weston_can_initialize_new_wayland_compositor: SKIPPED (0.00s)
> > RESULTS - weston.WestonTest.test_weston_running: SKIPPED (0.00s)
> > RESULTS - weston.WestonTest.test_weston_supports_xwayland: SKIPPED (0.00s)
> > RESULTS - xorg.XorgTest.test_xorg_running: SKIPPED (0.00s)
> > SUMMARY:
> > core-image-minimal () - Ran 70 tests in 22.173s
> > core-image-minimal - OK - All required tests passed (successes=14, skipped=56, failures=0, errors=0)
> > NOTE: recipe core-image-minimal-1.0-r0: task do_testimage: Succeeded
> > NOTE: Tasks Summary: Attempted 1305 tasks of which 1304 didn't need to be rerun and all succeeded.
> >
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
> > ---
> >  meta/classes-recipe/testimage.bbclass | 14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> >
> > v2: set TEST_SERVER_IP correctly to default qemu dhcp server IP 10.0.2.2
> > so that testimage selftests pass
> >
> > v1: https://lists.openembedded.org/g/openembedded-core/message/186424
> >
> > diff --git a/meta/classes-recipe/testimage.bbclass b/meta/classes-recipe/testimage.bbclass
> > index e3068348ff..7340996788 100644
> > --- a/meta/classes-recipe/testimage.bbclass
> > +++ b/meta/classes-recipe/testimage.bbclass
> > @@ -322,7 +322,7 @@ def testimage_main(d):
> >      ovmf = d.getVar("QEMU_USE_OVMF")
> >
> >      slirp = False
> > -    if d.getVar("QEMU_USE_SLIRP"):
> > +    if d.getVar("QEMU_USE_SLIRP") or bb.utils.contains('TEST_RUNQEMUPARAMS', 'slirp', True, False, d):
> >          slirp = True
> >
> >      # TODO: We use the current implementation of qemu runner because of
> > @@ -369,10 +369,18 @@ def testimage_main(d):
> >      # runtime use network for download projects for build
> >      export_proxies(d)
> >
> > +    if slirp:
> > +        target_ip = "127.0.0.1"
> 
> will this work when running multiple instances of qemu ?
> e.g.  try bitbake core-image-ptest-all

The port forwarding settings are same for each of the qemu virtual machine instances
currently.

So one instance reserves the 127.0.0.1 and TCP port 2222, by default.
Another instance will fail to reserve the port 2222 and qemu startup fails.

So I don't think "slirp" works with multiple qemu instances on a single machine.

This could be changed if the hostfwd port number selection was changed to be dynamic.
runqemu currently hard codes this as:

ostfwd = ",hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:2323-:23"

A retry with different, increasing port numbers could be added.

Then qemurunner.py could be changed to detect the effective port from qemu startup logs,
as it already now partially does as a fallback, or maybe the current code would even work
with dynamic port numbers.

Cheers,

-Mikko

> 
> > +        # from qemu target to host with default DHCP server
> > +        server_ip = "10.0.2.2"
> > +    else:
> > +        target_ip = d.getVar("TEST_TARGET_IP")
> > +        server_ip = d.getVar("TEST_SERVER_IP")
> > +
> >      # the robot dance
> >      target = OERuntimeTestContextExecutor.getTarget(
> > -        d.getVar("TEST_TARGET"), logger, d.getVar("TEST_TARGET_IP"),
> > -        d.getVar("TEST_SERVER_IP"), **target_kwargs)
> > +        d.getVar("TEST_TARGET"), logger, target_ip,
> > +        server_ip, **target_kwargs)
> >
> >      # test context
> >      tc = OERuntimeTestContext(td, logger, target, image_packages, extract_dir)
> > --
> > 2.34.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#186547): https://lists.openembedded.org/g/openembedded-core/message/186547
> > Mute This Topic: https://lists.openembedded.org/mt/100910036/1997914
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >


  reply	other threads:[~2023-08-23  6:48 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  6:10 [PATCH v2 1/9] core-image-minimal: increase extra space to pass df.py oeqa runtime test Mikko Rapeli
2023-08-23  6:10 ` [PATCH v2 2/9] testimage.bbclass: detect slirp from TEST_RUNQEMUPARAMS Mikko Rapeli
2023-08-23  6:25   ` [OE-core] " Khem Raj
2023-08-23  6:48     ` Mikko Rapeli [this message]
2023-08-23  7:31     ` Mikko Rapeli
2023-08-23  9:06       ` Richard Purdie
2023-08-23  9:47         ` Mikko Rapeli
2023-08-23  9:57           ` Alexander Kanavin
2023-08-23 10:49             ` Mikko Rapeli
     [not found]             ` <177DFD85A9F91D1D.28529@lists.openembedded.org>
2023-08-23 13:01               ` openssh ptest banner failure (was Re: [OE-core] [PATCH v2 2/9] testimage.bbclass: detect slirp from TEST_RUNQEMUPARAMS ) Mikko Rapeli
2023-08-23 13:24                 ` Alexander Kanavin
2023-08-23 13:28                   ` Mikko Rapeli
2023-08-23 13:26                 ` Richard Purdie
2023-08-23 10:49           ` [OE-core] [PATCH v2 2/9] testimage.bbclass: detect slirp from TEST_RUNQEMUPARAMS Richard Purdie
2023-08-23 11:47             ` Mikko Rapeli
2023-08-23 13:17               ` Richard Purdie
2023-09-12 11:25   ` Ross Burton
2023-09-12 11:29     ` Mikko Rapeli
2023-09-12 11:30       ` Ross Burton
2023-09-12 11:37         ` Mikko Rapeli
2023-08-23  6:10 ` [PATCH v2 3/9] selftest runtime_test.py: add testimage.bbclass slirp test Mikko Rapeli
2023-08-23 18:45   ` [OE-core] " Alexander Kanavin
2023-08-24  6:41     ` Mikko Rapeli
2023-08-24  6:58       ` Alexander Kanavin
2023-08-23  6:10 ` [PATCH v2 4/9] oeqa dnf_runtime.py: fix HTTP server IP address and port Mikko Rapeli
2023-08-23  6:10 ` [PATCH v2 5/9] oeqa selftest context.py: whitespace fix Mikko Rapeli
2023-08-23  6:10 ` [PATCH v2 6/9] oeqa selftest context.py: remove warning from missing meta-selftest Mikko Rapeli
2023-08-23  6:10 ` [PATCH v2 7/9] oeqa selftest context.py: fix git commands and set branch name Mikko Rapeli
2023-09-05 13:46   ` [OE-core] " Ross Burton
2023-08-23  6:10 ` [PATCH v2 8/9] oeqa selftest runtime_test.py: append to TEST_RUNQEMUPARAMS Mikko Rapeli
2023-08-23  6:10 ` [PATCH v2 9/9] oeqa selftest runtime_test.py: skip virgl_headless test if /dev/dri/renderD128 access fails Mikko Rapeli
2023-08-23 18:37   ` [OE-core] " Alexander Kanavin
2023-08-23 18:38     ` Alexander Kanavin
2023-08-23 18:39       ` Alexander Kanavin
     [not found]       ` <177E172FFEF11691.18238@lists.openembedded.org>
2023-08-23 18:42         ` Alexander Kanavin
2023-08-24  6:45     ` Mikko Rapeli
2023-08-24  6:56       ` Alexander Kanavin
     [not found]       ` <177E3F68E6CB83D4.13053@lists.openembedded.org>
2023-09-07  8:59         ` Alexander Kanavin
2023-09-07 10:54           ` Richard Purdie
2023-08-23 18:44 ` [OE-core] [PATCH v2 1/9] core-image-minimal: increase extra space to pass df.py oeqa runtime test Alexander Kanavin
2023-08-24  6:38   ` Mikko Rapeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZOWrrK+woCwxhu0W@nuoska \
    --to=mikko.rapeli@linaro.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox