oeqa: sdk: basic go toolchain test support
PATCH 1/1 oeqa: sdk: basic go toolchain test support
Add a simple build test for the golang toolchain which is produced into a SDK.
--- 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
meta/lib/oeqa/sdk/cases/go.py new file +34 -0
@@ -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)
meta/lib/oeqa/sdk/files/test.go new file +7 -0
@@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("hello world!") +}
Signature · 1 line
1.8.3.1
Quoted 56 lines · Peter Morrow
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.pycreate mode 100644 meta/lib/oeqa/sdk/files/test.gometa/lib/oeqa/sdk/cases/go.py new file +34
-0@@ -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)meta/lib/oeqa/sdk/files/test.go new file +0
-0
meta/lib/oeqa/sdk/files/test.go line 7
Quoted 7 lines
meta/lib/oeqa/sdk/files/test.go new file +7
-0@@ -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
Cheers,
Richard
Quoted 68 lines · Richard Purdie via lists.openembedded.org
Quoted 56 lines · Peter Morrow
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.pycreate mode 100644 meta/lib/oeqa/sdk/files/test.gometa/lib/oeqa/sdk/cases/go.py new file +34
-0@@ -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)meta/lib/oeqa/sdk/files/test.go new file +0
-0meta/lib/oeqa/sdk/files/test.go line 7
Quoted 7 lines
meta/lib/oeqa/sdk/files/test.go new file +7
-0@@ -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:
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
Quoted 86 lines · Richard Purdie
Quoted 68 lines · Richard Purdie via lists.openembedded.org
Quoted 56 lines · Peter Morrow
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.pycreate mode 100644 meta/lib/oeqa/sdk/files/test.gometa/lib/oeqa/sdk/cases/go.py new file +34
-0@@ -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)meta/lib/oeqa/sdk/files/test.go new file +0
-0meta/lib/oeqa/sdk/files/test.go line 7
Quoted 7 lines
meta/lib/oeqa/sdk/files/test.go new file +7
-0@@ -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:
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
withopen(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'
Quoted 1 line
NOTE: ----------------------------------------------------------------------
Thanks Richard,
I'll take a look into these failures (which I didn't see when testing locally) and will hopefully come back with a V2 shortly.
Peter.
Quoted 5 lines
Cheers,
Richard
Quoted 86 lines · Richard Purdie
Quoted 68 lines · Richard Purdie via lists.openembedded.org
Quoted 56 lines · Peter Morrow
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.pycreate mode 100644 meta/lib/oeqa/sdk/files/test.gometa/lib/oeqa/sdk/cases/go.py new file +34
-0@@ -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)meta/lib/oeqa/sdk/files/test.go new file +0
-0meta/lib/oeqa/sdk/files/test.go line 7
Quoted 7 lines
meta/lib/oeqa/sdk/files/test.go new file +7
-0@@ -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:
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
withopen(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'
Quoted 1 line
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.
Quoted 5 lines
Cheers,
Richard