All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Belloni" <alexandre.belloni@bootlin.com>
To: Vyacheslav Yurkov <uvv.mail@gmail.com>
Cc: Openembedded-core@lists.openembedded.org,
	Alexander Kanavin <alex.kanavin@gmail.com>
Subject: Re: [OE-core] [PATCH v2 7/8] oeqa/selftest: overlayfs unit tests
Date: Sat, 10 Jul 2021 19:15:46 +0200	[thread overview]
Message-ID: <YOnVwpvuj3OFT5Ti@piout.net> (raw)
In-Reply-To: <cbaa979e-a0fc-7d3a-8789-4bb265abc759@gmail.com>

On 10/07/2021 14:47:01+0200, Vyacheslav Yurkov wrote:
> Hi Alexandre,
> Thanks for the build.
> Seems like I forgot a space in _append :/
> 
> I'd like to address Alex request too to include a run-time test. Is there a
> way to update only this patch without resending the whole series?
> 

If you send a v2, of this one, I can queue it with the other ones,
please use --in-reply-to

> Thanks,
> Vyacheslav
> 
> On 10.07.2021 11:41, Alexandre Belloni wrote:
> > Hello,
> > 
> > On 09/07/2021 13:31:45+0200, Vyacheslav Yurkov wrote:
> > > Unit tests for overlayfs.bbclass
> > > 
> > I believe I properly applied the series but it fails with:
> > 
> > Parsing recipes...ERROR: /home/pokybuild/yocto-worker/oe-selftest-centos/build/build-st-1517413/meta-selftest/recipes-test/overlayfs/overlayfs-user.bb: A recipe uses overlayfs class but there is no OVERLAYFS_MOUNT_POINT set in your MACHINE configuration
> > 
> > See https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/2290/steps/14/logs/stdio
> > 
> > > Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
> > > ---
> > >   meta/lib/oeqa/selftest/cases/overlayfs.py | 126 ++++++++++++++++++++++
> > >   1 file changed, 126 insertions(+)
> > >   create mode 100644 meta/lib/oeqa/selftest/cases/overlayfs.py
> > > 
> > > diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
> > > new file mode 100644
> > > index 0000000000..74bf1c4167
> > > --- /dev/null
> > > +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
> > > @@ -0,0 +1,126 @@
> > > +#
> > > +# SPDX-License-Identifier: MIT
> > > +#
> > > +
> > > +from oeqa.selftest.case import OESelftestTestCase
> > > +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
> > > +
> > > +class OverlayFSTests(OESelftestTestCase):
> > > +    """Overlayfs class usage tests"""
> > > +
> > > +    def getline(self, res, line):
> > > +        for l in res.output.split('\n'):
> > > +            if line in l:
> > > +                return l
> > > +
> > > +    def test_distro_features_missing(self):
> > > +        """
> > > +        Summary:   Check that required DISTRO_FEATURES are set
> > > +        Expected:  Fail when either systemd or overlayfs are not in DISTRO_FEATURES
> > > +        Author:    Vyacheslav Yurkov <uvv.mail@gmail.com>
> > > +        """
> > > +
> > > +        config = """
> > > +OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
> > > +IMAGE_INSTALL_append = "overlayfs-user"
> > > +"""
> > > +        self.write_config(config)
> > > +        res = bitbake('core-image-minimal', ignore_status=True)
> > > +        line = self.getline(res, "overlayfs-user was skipped: missing required distro features")
> > > +        self.assertTrue("overlayfs" in res.output, msg=res.output)
> > > +        self.assertTrue("systemd" in res.output, msg=res.output)
> > > +        self.assertTrue("ERROR: Required build target 'core-image-minimal' has no buildable providers." in res.output, msg=res.output)
> > > +
> > > +    def test_not_all_units_installed(self):
> > > +        """
> > > +        Summary:   Test QA check that we have required mount units in the image
> > > +        Expected:  Fail because mount unit for overlay partition is not installed
> > > +        Author:    Vyacheslav Yurkov <uvv.mail@gmail.com>
> > > +        """
> > > +
> > > +        config = """
> > > +OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
> > > +IMAGE_INSTALL_append = "overlayfs-user"
> > > +DISTRO_FEATURES += "systemd overlayfs"
> > > +"""
> > > +        self.write_config(config)
> > > +        res = bitbake('core-image-minimal', ignore_status=True)
> > > +        line = self.getline(res, "Unit name mnt-overlay.mount not found in systemd unit directories")
> > > +        self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
> > > +        line = self.getline(res, "Not all mount units are installed by the BSP")
> > > +        self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
> > > +
> > > +    def test_mount_unit_not_set(self):
> > > +        """
> > > +        Summary:   Test whether mount unit was set properly
> > > +        Expected:  Fail because mount unit was not set
> > > +        Author:    Vyacheslav Yurkov <uvv.mail@gmail.com>
> > > +        """
> > > +
> > > +        config = """
> > > +IMAGE_INSTALL_append = "overlayfs-user"
> > > +DISTRO_FEATURES += "systemd overlayfs"
> > > +"""
> > > +        self.write_config(config)
> > > +        res = bitbake('core-image-minimal', ignore_status=True)
> > > +        line = self.getline(res, "A recipe uses overlayfs class but there is no OVERLAYFS_MOUNT_POINT set in your MACHINE configuration")
> > > +        self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output)
> > > +
> > > +    def test_wrong_mount_unit_set(self):
> > > +        """
> > > +        Summary:   Test whether mount unit was set properly
> > > +        Expected:  Fail because not the correct flag used for mount unit
> > > +        Author:    Vyacheslav Yurkov <uvv.mail@gmail.com>
> > > +        """
> > > +
> > > +        config = """
> > > +OVERLAYFS_MOUNT_POINT[usr-share-overlay] = "/usr/share/overlay"
> > > +IMAGE_INSTALL_append = "overlayfs-user"
> > > +DISTRO_FEATURES += "systemd overlayfs"
> > > +"""
> > > +        self.write_config(config)
> > > +        res = bitbake('core-image-minimal', ignore_status=True)
> > > +        line = self.getline(res, "Missing required mount point for OVERLAYFS_MOUNT_POINT[mnt-overlay] in your MACHINE configuration")
> > > +        self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output)
> > > +
> > > +    def test_correct_image(self):
> > > +        """
> > > +        Summary:   Check that we can create an image when all parameters are
> > > +                   set correctly
> > > +        Expected:  Image is created successfully
> > > +        Author:    Vyacheslav Yurkov <uvv.mail@gmail.com>
> > > +        """
> > > +
> > > +        config = """
> > > +OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
> > > +IMAGE_INSTALL_append = "overlayfs-user systemd-machine-units"
> > > +DISTRO_FEATURES += "systemd overlayfs"
> > > +"""
> > > +
> > > +        systemd_machine_unit_append = """
> > > +SYSTEMD_SERVICE_${PN} += " \
> > > +    mnt-overlay.mount \
> > > +"
> > > +
> > > +do_install() {
> > > +    install -d ${D}${systemd_unitdir}/system
> > > +    cat <<EOT > ${D}${systemd_unitdir}/system/mnt-overlay.mount
> > > +[Unit]
> > > +Description=Tmpfs directory
> > > +DefaultDependencies=no
> > > +
> > > +[Mount]
> > > +What=tmpfs
> > > +Where=/mnt/overlay
> > > +Type=tmpfs
> > > +Options=mode=1777,strictatime,nosuid,nodev
> > > +
> > > +[Install]
> > > +WantedBy=multi-user.target
> > > +EOT
> > > +}
> > > +
> > > +"""
> > > +        self.write_config(config)
> > > +        self.write_recipeinc('systemd-machine-units', systemd_machine_unit_append)
> > > +        bitbake('core-image-minimal')
> > > -- 
> > > 2.28.0
> > > 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2021-07-10 17:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 11:31 [PATCH v2 1/8] overlayfs-qa: common functions for overlayfs Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 2/8] overlayfs.bbclass: generate overlayfs mount units Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 3/8] maintainers.inc: overlayfs bbclass maintainer Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 4/8] rootfs-postcommands: add QA check for overlayfs Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 5/8] systemd-machine-units: add bbappend for meta-selftest Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 6/8] overlayfs: meta-selftest recipe Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 7/8] oeqa/selftest: overlayfs unit tests Vyacheslav Yurkov
2021-07-10  9:01   ` [OE-core] " Alexander Kanavin
2021-07-10  9:41   ` Alexandre Belloni
2021-07-10 12:47     ` Vyacheslav Yurkov
2021-07-10 17:15       ` Alexandre Belloni [this message]
2021-07-11 15:16         ` Vyacheslav Yurkov
2021-07-12  9:14           ` Alexandre Belloni
2021-07-12  9:42             ` Vyacheslav Yurkov
2021-07-09 11:31 ` [PATCH v2 8/8] docs: add overlayfs class Vyacheslav Yurkov

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=YOnVwpvuj3OFT5Ti@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=Openembedded-core@lists.openembedded.org \
    --cc=alex.kanavin@gmail.com \
    --cc=uvv.mail@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.