* [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test
@ 2022-12-19 14:18 Alex Kiernan
2022-12-19 14:28 ` Alex Kiernan
0 siblings, 1 reply; 5+ messages in thread
From: Alex Kiernan @ 2022-12-19 14:18 UTC (permalink / raw)
To: openembedded-core; +Cc: Alex Kiernan
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
meta/lib/oeqa/files/test.rs | 2 ++
meta/lib/oeqa/runtime/cases/rust.py | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 meta/lib/oeqa/files/test.rs
diff --git a/meta/lib/oeqa/files/test.rs b/meta/lib/oeqa/files/test.rs
new file mode 100644
index 000000000000..f79c691f0853
--- /dev/null
+++ b/meta/lib/oeqa/files/test.rs
@@ -0,0 +1,2 @@
+fn main() {
+}
diff --git a/meta/lib/oeqa/runtime/cases/rust.py b/meta/lib/oeqa/runtime/cases/rust.py
index 55b280d61d8a..186bb0d79e15 100644
--- a/meta/lib/oeqa/runtime/cases/rust.py
+++ b/meta/lib/oeqa/runtime/cases/rust.py
@@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.runtime.decorator.package import OEHasPackage
+class RustCompileTest(OERuntimeTestCase):
+
+ @classmethod
+ def setUp(cls):
+ dst = '/tmp/'
+ src = os.path.join(cls.tc.files_dir, 'test.rs')
+ cls.tc.target.copyTo(src, dst)
+
+ @classmethod
+ def tearDown(cls):
+ files = '/tmp/test.rs /tmp/test'
+ cls.tc.target.run('rm %s' % files)
+
+ @OETestDepends(['ssh.SSHTest.test_ssh'])
+ @OEHasPackage(['rust'])
+ def test_rust_compile(self):
+ status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test')
+ msg = 'rust compile failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+
+ status, output = self.target.run('/tmp/test')
+ msg = 'running compiled file failed, output: %s' % output
+ self.assertEqual(status, 0, msg=msg)
+
class RustHelloworldTest(OERuntimeTestCase):
@OETestDepends(['ssh.SSHTest.test_ssh'])
@OEHasPackage(['rust-hello-world'])
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test
2022-12-19 14:18 [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test Alex Kiernan
@ 2022-12-19 14:28 ` Alex Kiernan
2022-12-19 14:32 ` Richard Purdie
0 siblings, 1 reply; 5+ messages in thread
From: Alex Kiernan @ 2022-12-19 14:28 UTC (permalink / raw)
To: openembedded-core
On Mon, Dec 19, 2022 at 2:19 PM Alex Kiernan <alex.kiernan@gmail.com> wrote:
>
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
> meta/lib/oeqa/files/test.rs | 2 ++
> meta/lib/oeqa/runtime/cases/rust.py | 24 ++++++++++++++++++++++++
> 2 files changed, 26 insertions(+)
> create mode 100644 meta/lib/oeqa/files/test.rs
>
> diff --git a/meta/lib/oeqa/files/test.rs b/meta/lib/oeqa/files/test.rs
> new file mode 100644
> index 000000000000..f79c691f0853
> --- /dev/null
> +++ b/meta/lib/oeqa/files/test.rs
> @@ -0,0 +1,2 @@
> +fn main() {
> +}
> diff --git a/meta/lib/oeqa/runtime/cases/rust.py b/meta/lib/oeqa/runtime/cases/rust.py
> index 55b280d61d8a..186bb0d79e15 100644
> --- a/meta/lib/oeqa/runtime/cases/rust.py
> +++ b/meta/lib/oeqa/runtime/cases/rust.py
> @@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase
> from oeqa.core.decorator.depends import OETestDepends
> from oeqa.runtime.decorator.package import OEHasPackage
>
> +class RustCompileTest(OERuntimeTestCase):
> +
> + @classmethod
> + def setUp(cls):
> + dst = '/tmp/'
> + src = os.path.join(cls.tc.files_dir, 'test.rs')
> + cls.tc.target.copyTo(src, dst)
> +
> + @classmethod
> + def tearDown(cls):
> + files = '/tmp/test.rs /tmp/test'
> + cls.tc.target.run('rm %s' % files)
> +
> + @OETestDepends(['ssh.SSHTest.test_ssh'])
> + @OEHasPackage(['rust'])
> + def test_rust_compile(self):
> + status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test')
> + msg = 'rust compile failed, output: %s' % output
> + self.assertEqual(status, 0, msg=msg)
> +
> + status, output = self.target.run('/tmp/test')
> + msg = 'running compiled file failed, output: %s' % output
> + self.assertEqual(status, 0, msg=msg)
> +
> class RustHelloworldTest(OERuntimeTestCase):
> @OETestDepends(['ssh.SSHTest.test_ssh'])
> @OEHasPackage(['rust-hello-world'])
One thing I wasn't clear on with this, is how I ensure that rust is
actually installed on the test image during CI, so this test runs?
--
Alex Kiernan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test
2022-12-19 14:28 ` Alex Kiernan
@ 2022-12-19 14:32 ` Richard Purdie
2022-12-19 14:38 ` Alexander Kanavin
0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2022-12-19 14:32 UTC (permalink / raw)
To: Alex Kiernan, openembedded-core
On Mon, 2022-12-19 at 14:28 +0000, Alex Kiernan wrote:
> On Mon, Dec 19, 2022 at 2:19 PM Alex Kiernan <alex.kiernan@gmail.com> wrote:
> >
> > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > ---
> > meta/lib/oeqa/files/test.rs | 2 ++
> > meta/lib/oeqa/runtime/cases/rust.py | 24 ++++++++++++++++++++++++
> > 2 files changed, 26 insertions(+)
> > create mode 100644 meta/lib/oeqa/files/test.rs
> >
> > diff --git a/meta/lib/oeqa/files/test.rs b/meta/lib/oeqa/files/test.rs
> > new file mode 100644
> > index 000000000000..f79c691f0853
> > --- /dev/null
> > +++ b/meta/lib/oeqa/files/test.rs
> > @@ -0,0 +1,2 @@
> > +fn main() {
> > +}
> > diff --git a/meta/lib/oeqa/runtime/cases/rust.py b/meta/lib/oeqa/runtime/cases/rust.py
> > index 55b280d61d8a..186bb0d79e15 100644
> > --- a/meta/lib/oeqa/runtime/cases/rust.py
> > +++ b/meta/lib/oeqa/runtime/cases/rust.py
> > @@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase
> > from oeqa.core.decorator.depends import OETestDepends
> > from oeqa.runtime.decorator.package import OEHasPackage
> >
> > +class RustCompileTest(OERuntimeTestCase):
> > +
> > + @classmethod
> > + def setUp(cls):
> > + dst = '/tmp/'
> > + src = os.path.join(cls.tc.files_dir, 'test.rs')
> > + cls.tc.target.copyTo(src, dst)
> > +
> > + @classmethod
> > + def tearDown(cls):
> > + files = '/tmp/test.rs /tmp/test'
> > + cls.tc.target.run('rm %s' % files)
> > +
> > + @OETestDepends(['ssh.SSHTest.test_ssh'])
> > + @OEHasPackage(['rust'])
> > + def test_rust_compile(self):
> > + status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test')
> > + msg = 'rust compile failed, output: %s' % output
> > + self.assertEqual(status, 0, msg=msg)
> > +
> > + status, output = self.target.run('/tmp/test')
> > + msg = 'running compiled file failed, output: %s' % output
> > + self.assertEqual(status, 0, msg=msg)
> > +
> > class RustHelloworldTest(OERuntimeTestCase):
> > @OETestDepends(['ssh.SSHTest.test_ssh'])
> > @OEHasPackage(['rust-hello-world'])
>
> One thing I wasn't clear on with this, is how I ensure that rust is
> actually installed on the test image during CI, so this test runs?
Isn't that what you're doing with:
@OEHasPackage(['rust'])
?
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test
2022-12-19 14:32 ` Richard Purdie
@ 2022-12-19 14:38 ` Alexander Kanavin
2022-12-19 14:47 ` Richard Purdie
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Kanavin @ 2022-12-19 14:38 UTC (permalink / raw)
To: Richard Purdie; +Cc: Alex Kiernan, openembedded-core
But we need to add rust to core-image-sato-sdk then, if it's not there yet.
Alex
On Mon, 19 Dec 2022 at 15:32, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Mon, 2022-12-19 at 14:28 +0000, Alex Kiernan wrote:
> > On Mon, Dec 19, 2022 at 2:19 PM Alex Kiernan <alex.kiernan@gmail.com> wrote:
> > >
> > > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> > > ---
> > > meta/lib/oeqa/files/test.rs | 2 ++
> > > meta/lib/oeqa/runtime/cases/rust.py | 24 ++++++++++++++++++++++++
> > > 2 files changed, 26 insertions(+)
> > > create mode 100644 meta/lib/oeqa/files/test.rs
> > >
> > > diff --git a/meta/lib/oeqa/files/test.rs b/meta/lib/oeqa/files/test.rs
> > > new file mode 100644
> > > index 000000000000..f79c691f0853
> > > --- /dev/null
> > > +++ b/meta/lib/oeqa/files/test.rs
> > > @@ -0,0 +1,2 @@
> > > +fn main() {
> > > +}
> > > diff --git a/meta/lib/oeqa/runtime/cases/rust.py b/meta/lib/oeqa/runtime/cases/rust.py
> > > index 55b280d61d8a..186bb0d79e15 100644
> > > --- a/meta/lib/oeqa/runtime/cases/rust.py
> > > +++ b/meta/lib/oeqa/runtime/cases/rust.py
> > > @@ -8,6 +8,30 @@ from oeqa.runtime.case import OERuntimeTestCase
> > > from oeqa.core.decorator.depends import OETestDepends
> > > from oeqa.runtime.decorator.package import OEHasPackage
> > >
> > > +class RustCompileTest(OERuntimeTestCase):
> > > +
> > > + @classmethod
> > > + def setUp(cls):
> > > + dst = '/tmp/'
> > > + src = os.path.join(cls.tc.files_dir, 'test.rs')
> > > + cls.tc.target.copyTo(src, dst)
> > > +
> > > + @classmethod
> > > + def tearDown(cls):
> > > + files = '/tmp/test.rs /tmp/test'
> > > + cls.tc.target.run('rm %s' % files)
> > > +
> > > + @OETestDepends(['ssh.SSHTest.test_ssh'])
> > > + @OEHasPackage(['rust'])
> > > + def test_rust_compile(self):
> > > + status, output = self.target.run('rustc /tmp/test.rs -o /tmp/test')
> > > + msg = 'rust compile failed, output: %s' % output
> > > + self.assertEqual(status, 0, msg=msg)
> > > +
> > > + status, output = self.target.run('/tmp/test')
> > > + msg = 'running compiled file failed, output: %s' % output
> > > + self.assertEqual(status, 0, msg=msg)
> > > +
> > > class RustHelloworldTest(OERuntimeTestCase):
> > > @OETestDepends(['ssh.SSHTest.test_ssh'])
> > > @OEHasPackage(['rust-hello-world'])
> >
> > One thing I wasn't clear on with this, is how I ensure that rust is
> > actually installed on the test image during CI, so this test runs?
>
> Isn't that what you're doing with:
>
> @OEHasPackage(['rust'])
>
> ?
>
> Cheers,
>
> Richard
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#174816): https://lists.openembedded.org/g/openembedded-core/message/174816
> Mute This Topic: https://lists.openembedded.org/mt/95765437/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test
2022-12-19 14:38 ` Alexander Kanavin
@ 2022-12-19 14:47 ` Richard Purdie
0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2022-12-19 14:47 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: Alex Kiernan, openembedded-core
On Mon, 2022-12-19 at 15:38 +0100, Alexander Kanavin wrote:
> But we need to add rust to core-image-sato-sdk then, if it's not there yet.
Ah, I misunderstood you question. The sdk tooling comes from:
classes-recipe/core-image.bbclass:FEATURE_PACKAGES_tools-sdk = "packagegroup-core-sdk packagegroup-core-standalone-sdk-target"
so maybe making recipes-core/packagegroups/packagegroup-core-sdk.bb
have something a bit like SDK_TOOLCHAIN_LANGS in classes-
recipe/populate_sdk_base.bbclass?
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-19 14:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 14:18 [OE-Core][PATCH] oeqa/runtime/rust: Add basic compile/run test Alex Kiernan
2022-12-19 14:28 ` Alex Kiernan
2022-12-19 14:32 ` Richard Purdie
2022-12-19 14:38 ` Alexander Kanavin
2022-12-19 14:47 ` Richard Purdie
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.