On Mon, Dec 19, 2022 at 2:19 PM Alex Kiernan <[email protected]> wrote:
>
> Signed-off-by: Alex Kiernan <[email protected]>
> ---
>  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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#174815): 
https://lists.openembedded.org/g/openembedded-core/message/174815
Mute This Topic: https://lists.openembedded.org/mt/95765437/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to