diff mbox series

oeqa/selftest: automatically unset SANITY_TESTED_DISTROS

Message ID 20241003213726.2518832-1-chris.laplante@agilent.com
State New
Headers show
Series oeqa/selftest: automatically unset SANITY_TESTED_DISTROS | expand

Commit Message

chris.laplante@agilent.com Oct. 3, 2024, 9:37 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

It always has to be done, so just do it.

[YOCTO #11933]

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 meta/lib/oeqa/selftest/context.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Richard Purdie Oct. 3, 2024, 9:46 p.m. UTC | #1
On Thu, 2024-10-03 at 17:37 -0400, Chris Laplante via lists.openembedded.org wrote:
> From: Chris Laplante <chris.laplante@agilent.com>
> 
> It always has to be done, so just do it.
> 
> [YOCTO #11933]
> 
> Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
> ---
>  meta/lib/oeqa/selftest/context.py | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
> index acc3b073bd..3b507d747e 100644
> --- a/meta/lib/oeqa/selftest/context.py
> +++ b/meta/lib/oeqa/selftest/context.py
> @@ -129,6 +129,9 @@ class OESelftestTestContext(OETestContext):
>          # Set SSTATE_DIR to match the parent SSTATE_DIR
>          subprocess.check_output("echo 'SSTATE_DIR ?= \"%s\"' >> %s/conf/local.conf" % (sstatedir, newbuilddir), cwd=newbuilddir, shell=True)
>  
> +        # Unset SANITY_TESTED_DISTROS
> +        subprocess.check_output(f"echo 'SANITY_TESTED_DISTROS = \"\"' >> {newbuilddir}/conf/local.conf", cwd=newbuilddir, shell=True)
> +
>          os.chdir(newbuilddir)
>  
>          def patch_test(t):
> @@ -337,10 +340,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
>              self.tc.logger.error("Please unset PRSERV_HOST in order to run oe-selftest")
>              raise OEQAPreRun
>  
> -        if "SANITY_TESTED_DISTROS" in self.tc.td:
> -            self.tc.logger.error("Please unset SANITY_TESTED_DISTROS in order to run oe-selftest")
> -            raise OEQAPreRun
> -
>          _add_layer_libs()
>  
>          self.tc.logger.info("Checking base configuration is valid/parsable")
> 

You might want to leave the test since there are ways you could set
this which will make it hard to disable :(

A simple example would be:

SANITY_TESTES_DISTROS:poky = "x y z"

which is why this wasn't automated.

Cheers,

Richard
Peter Kjellerstedt Oct. 3, 2024, 10:14 p.m. UTC | #2
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 3 oktober 2024 23:46
> To: chris.laplante@agilent.com; openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH] oeqa/selftest: automatically unset SANITY_TESTED_DISTROS
> 
> On Thu, 2024-10-03 at 17:37 -0400, Chris Laplante via lists.openembedded.org wrote:
> > From: Chris Laplante <chris.laplante@agilent.com>
> >
> > It always has to be done, so just do it.
> >
> > [YOCTO #11933]
> >
> > Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
> > ---
> >  meta/lib/oeqa/selftest/context.py | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
> > index acc3b073bd..3b507d747e 100644
> > --- a/meta/lib/oeqa/selftest/context.py
> > +++ b/meta/lib/oeqa/selftest/context.py
> > @@ -129,6 +129,9 @@ class OESelftestTestContext(OETestContext):
> >          # Set SSTATE_DIR to match the parent SSTATE_DIR
> >          subprocess.check_output("echo 'SSTATE_DIR ?= \"%s\"' >> %s/conf/local.conf" % (sstatedir, newbuilddir), cwd=newbuilddir, shell=True)
> >
> > +        # Unset SANITY_TESTED_DISTROS
> > +        subprocess.check_output(f"echo 'SANITY_TESTED_DISTROS = \"\"' >> {newbuilddir}/conf/local.conf", cwd=newbuilddir, shell=True)
> > +
> >          os.chdir(newbuilddir)
> >
> >          def patch_test(t):
> > @@ -337,10 +340,6 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
> >              self.tc.logger.error("Please unset PRSERV_HOST in order to run oe-selftest")
> >              raise OEQAPreRun
> >
> > -        if "SANITY_TESTED_DISTROS" in self.tc.td:
> > -            self.tc.logger.error("Please unset SANITY_TESTED_DISTROS in order to run oe-selftest")
> > -            raise OEQAPreRun
> > -
> >          _add_layer_libs()
> >
> >          self.tc.logger.info("Checking base configuration is valid/parsable")
> >
> 
> You might want to leave the test since there are ways you could set
> this which will make it hard to disable :(
> 
> A simple example would be:
> 
> SANITY_TESTES_DISTROS:poky = "x y z"
> 
> which is why this wasn't automated.
> 
> Cheers,
> 
> Richard

Wouldn't

SANITY_TESTED_DISTROS:forcevariable = ""

get you close to always work for all practical purposes? 
Though I guess if you really want you can circumvent that as well.

//Peter
chris.laplante@agilent.com Oct. 4, 2024, 1:02 a.m. UTC | #3
Hi Richard, Peter,

> > You might want to leave the test since there are ways you could set
> > this which will make it hard to disable :(
> >
> > A simple example would be:
> >
> > SANITY_TESTES_DISTROS:poky = "x y z"
> >
> > which is why this wasn't automated.
> >
> > Cheers,
> >
> > Richard
> 
> Wouldn't
> 
> SANITY_TESTED_DISTROS:forcevariable = ""
> 
> get you close to always work for all practical purposes?
> Though I guess if you really want you can circumvent that as well.
> 
> //Peter

I did initially leave the test in place, but the problem is that (as part of _pre_run) it runs before the setup_builddir code. I like the idea of using :forcevariable though. Would you accept a v2 patch that used it?

Thanks,
Chris
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py
index acc3b073bd..3b507d747e 100644
--- a/meta/lib/oeqa/selftest/context.py
+++ b/meta/lib/oeqa/selftest/context.py
@@ -129,6 +129,9 @@  class OESelftestTestContext(OETestContext):
         # Set SSTATE_DIR to match the parent SSTATE_DIR
         subprocess.check_output("echo 'SSTATE_DIR ?= \"%s\"' >> %s/conf/local.conf" % (sstatedir, newbuilddir), cwd=newbuilddir, shell=True)
 
+        # Unset SANITY_TESTED_DISTROS
+        subprocess.check_output(f"echo 'SANITY_TESTED_DISTROS = \"\"' >> {newbuilddir}/conf/local.conf", cwd=newbuilddir, shell=True)
+
         os.chdir(newbuilddir)
 
         def patch_test(t):
@@ -337,10 +340,6 @@  class OESelftestTestContextExecutor(OETestContextExecutor):
             self.tc.logger.error("Please unset PRSERV_HOST in order to run oe-selftest")
             raise OEQAPreRun
 
-        if "SANITY_TESTED_DISTROS" in self.tc.td:
-            self.tc.logger.error("Please unset SANITY_TESTED_DISTROS in order to run oe-selftest")
-            raise OEQAPreRun
-
         _add_layer_libs()
 
         self.tc.logger.info("Checking base configuration is valid/parsable")