On Thu, May 20, 2021 at 02:57:26PM +0100, Richard Purdie wrote:
> On Thu, 2021-05-20 at 12:27 +0100, Richard Purdie via lists.openembedded.org 
> wrote:
> > On Tue, 2021-05-18 at 06:05 -0700, Peter Morrow wrote:
> > > Add a simple build test for the golang toolchain which is produced into a 
> > > SDK.
> > > 
> > > Signed-off-by: Peter Morrow <pemor...@linux.microsoft.com>
> > > ---
> > >  meta/lib/oeqa/sdk/cases/go.py   | 34 ++++++++++++++++++++++++++++++++++
> > >  meta/lib/oeqa/sdk/files/test.go |  7 +++++++
> > >  2 files changed, 41 insertions(+)
> > >  create mode 100644 meta/lib/oeqa/sdk/cases/go.py
> > >  create mode 100644 meta/lib/oeqa/sdk/files/test.go
> > > 
> > > diff --git a/meta/lib/oeqa/sdk/cases/go.py b/meta/lib/oeqa/sdk/cases/go.py
> > > new file mode 100644
> > > index 0000000..1af5516
> > > --- /dev/null
> > > +++ b/meta/lib/oeqa/sdk/cases/go.py
> > > @@ -0,0 +1,34 @@
> > > +#
> > > +# SPDX-License-Identifier: MIT
> > > +#
> > > +
> > > +import os
> > > +import shutil
> > > +import unittest
> > > +
> > > +from oeqa.core.utils.path import remove_safe
> > > +from oeqa.sdk.case import OESDKTestCase
> > > +
> > > +from oeqa.utils.subprocesstweak import errors_have_output
> > > +errors_have_output()
> > > +
> > > +class GoCompileTest(OESDKTestCase):
> > > +    @classmethod
> > > +    def setUpClass(self):
> > > +        files = {'test.go' : self.tc.files_dir}
> > > +        for f in files:
> > > +            shutil.copyfile(os.path.join(files[f], f),
> > > +                    os.path.join(self.tc.sdk_dir, f))
> > > +
> > > +    def setUp(self):
> > > +        if not self.tc.hasHostPackage("^nativesdk-go", regex=True):
> > > +            raise unittest.SkipTest("GoCompileTest class: SDK doesn't 
> > > contain a golang toolchain")
> > > +
> > > +    def test_go_compile(self):
> > > +        self._run('go build -o %s/test %s/test.go' % (self.tc.sdk_dir, 
> > > self.tc.sdk_dir))
> > > +
> > > +    @classmethod
> > > +    def tearDownClass(self):
> > > +        files = [os.path.join(self.tc.sdk_dir, f) for f in ['test.go', 
> > > 'test']]
> > > +        for f in files:
> > > +            remove_safe(f)
> > > diff --git a/meta/lib/oeqa/sdk/files/test.go 
> > > b/meta/lib/oeqa/sdk/files/test.go
> > > new file mode 100644
> > > index 0000000..089f721
> > > --- /dev/null
> > > +++ b/meta/lib/oeqa/sdk/files/test.go
> > > @@ -0,0 +1,7 @@
> > > +package main
> > > +
> > > +import "fmt"
> > > +
> > > +func main() {
> > > +    fmt.Println("hello world!")
> > > +}
> > 
> > I'd love to add something like this but adding it triggered a lot of errors
> > in our automated QA:
> > 
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/2169
> > 
> 
> The autobuilder output isn't helpful to debug. I looked in and grabbed some 
> of a logfile:
> 
> NOTE: ======================================================================
> NOTE: ERROR: setUpClass (go.GoCompileTest)
> NOTE: ----------------------------------------------------------------------
> NOTE: Traceback (most recent call last):
>   File 
> "/home/pokybuild/yocto-worker/genericx86-64/build/meta/lib/oeqa/core/case.py",
>  line 39, in _oeSetUpClass
>     clss.setUpClassMethod()
>   File 
> "/home/pokybuild/yocto-worker/genericx86-64/build/meta/lib/oeqa/sdk/cases/go.py",
>  line 20, in setUpClass
>     shutil.copyfile(os.path.join(files[f], f),
>   File "/usr/lib64/python3.8/shutil.py", line 264, in copyfile
>     with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
> FileNotFoundError: [Errno 2] No such file or directory: 
> '/home/pokybuild/yocto-worker/genericx86-64/build/meta/lib/oeqa/files/test.go'
> 
> NOTE: ----------------------------------------------------------------------

Hi Richard,

I can't seem to recreate this problem locally, I've built both
core-image-sato and core-image-minimal and both seem to pass the sdktest
suite with no problems such as above.

SDK testing environment: core2-64-poky-linux
GoCompileTest class: SDK doesn't contain a golang toolchain
No python package in the SDK
RESULTS:
RESULTS - assimp.BuildAssimp.test_assimp: PASSED (275.54s)
RESULTS - buildcpio.BuildCpioTest.test_cpio: PASSED (27.66s)
RESULTS - buildepoxy.EpoxyTest.test_epoxy: PASSED (15.31s)
RESULTS - buildgalculator.GalculatorTest.test_galculator: PASSED
(12.24s)
RESULTS - buildlzip.BuildLzipTest.test_lzip: PASSED (4.95s)
RESULTS - gcc.GccCompileTest.test_gcc_compile: PASSED (0.06s)
RESULTS - gcc.GccCompileTest.test_gpp2_compile: PASSED (0.08s)
RESULTS - gcc.GccCompileTest.test_gpp_compile: PASSED (0.24s)
RESULTS - gcc.GccCompileTest.test_make: PASSED (0.06s)
RESULTS - perl.PerlTest.test_perl: PASSED (0.01s)
RESULTS - python.Python3Test.test_python3: PASSED (0.02s)
RESULTS - go.GoCompileTest.test_go_compile: SKIPPED (0.01s)
RESULTS - python.Python2Test.test_python2: SKIPPED (0.00s)
SUMMARY:
core-image-sato sdk
(poky-glibc-x86_64-core-image-sato-core2-64-qemux86-64-toolchain-3.3+snapshot.sh:environment-setup-core2-64-poky-linux)
- Ran 13 tests in 336.209s
core-image-sato sdk - OK - All required tests passed (successes=11,
skipped=2, failures=0, errors=0)
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
rerun and all succeeded.
peter@p52s:~/git/poky/build$


Any ideas where I am going wrong with testing this change?

Cheers,
Peter.

> 
> 
> Cheers,
> 
> Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#152634): 
https://lists.openembedded.org/g/openembedded-core/message/152634
Mute This Topic: https://lists.openembedded.org/mt/82910985/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to