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 <[email protected]>
> > ---
> > 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: ----------------------------------------------------------------------
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#152066):
https://lists.openembedded.org/g/openembedded-core/message/152066
Mute This Topic: https://lists.openembedded.org/mt/82910985/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-