mbox

[PATCHV2,0/3] Create class for building and installing rust tests

Message ID cover.1682341336.git.frederic.martinsons@gmail.com
State Not Applicable, archived
Headers show

Pull-request

https://gitlab.com/fmartinsons/openembedded-core cargo-add-ptest

Message

Frédéric Martinsons April 24, 2023, 1:04 p.m. UTC
From: Frederic Martinsons <frederic.martinsons@gmail.com>

This brings the possibility to use this class to build and ship
unit tests of rust projects, the class also create (or modified)
standard run-ptest script to run the generated rust test suite.

It has been tested successfully with core-image-sato under qemu
for zvariant-ptest and python3-bcrypt-ptest (though the last one
didn't define any unit tests).

Note that I tried to do the same with python3-cryptography but fail
to build the test suite and I don't know how to do it with the rust
extension module build by python setuptools. There must be some kind
of way for doing that so maybe someone will put some work in it (
because python3-cryptography rust extension do have unit tests).

Moreover, in the class, I didn't manage to share data between
do_compile_ptest_base and do_install_ptest_base cleanly (I tried
to d.setVar in compile and d.getVar in install but it seems that
the data store doens't recognize my new variable) so I used a file
for that. I'm sure there is a clever way for doing that, so feel
free to tell me.

The following changes since commit 45a8bb6e4676899d40525e7d5ad1c1ddefee3185:

  apt-util: Fix ptest on musl (2023-04-20 11:56:03 +0100)

are available in the Git repository at:

  https://gitlab.com/fmartinsons/openembedded-core cargo-add-ptest

Frederic Martinsons (3):
  ptest-cargo.bbclass: create class
  python3-bcrypt: enable build of unit tests
  zvariant: add ptest feature for zvariant test suite

 .../zvariant/zvariant_3.12.0.bb               |   9 +-
 meta/classes-recipe/ptest-cargo.bbclass       | 129 ++++++++++++++++++
 .../python/python3-bcrypt_4.0.1.bb            |   4 +-
 3 files changed, 140 insertions(+), 2 deletions(-)
 create mode 100644 meta/classes-recipe/ptest-cargo.bbclass

Comments

Luca Ceresoli April 26, 2023, 9:10 p.m. UTC | #1
Hello Frederic,

On Mon, 24 Apr 2023 15:04:10 +0200
"Frederic Martinsons" <frederic.martinsons@gmail.com> wrote:

> From: Frederic Martinsons <frederic.martinsons@gmail.com>
> 
> This brings the possibility to use this class to build and ship
> unit tests of rust projects, the class also create (or modified)
> standard run-ptest script to run the generated rust test suite.
> 
> It has been tested successfully with core-image-sato under qemu
> for zvariant-ptest and python3-bcrypt-ptest (though the last one
> didn't define any unit tests).
> 
> Note that I tried to do the same with python3-cryptography but fail
> to build the test suite and I don't know how to do it with the rust
> extension module build by python setuptools. There must be some kind
> of way for doing that so maybe someone will put some work in it (
> because python3-cryptography rust extension do have unit tests).
> 
> Moreover, in the class, I didn't manage to share data between
> do_compile_ptest_base and do_install_ptest_base cleanly (I tried
> to d.setVar in compile and d.getVar in install but it seems that
> the data store doens't recognize my new variable) so I used a file
> for that. I'm sure there is a clever way for doing that, so feel
> free to tell me.

A build error appeared on the autobuilders with these patches applied:

  File "/home/pokybuild/yocto-worker/oe-selftest-armhost/build/meta/lib/oeqa/selftest/cases/devtool.py", line 879, in test_devtool_modify_git_crates_subpath
    self._test_recipe_contents(recipefile, {}, ['cargo'])
  File "/home/pokybuild/yocto-worker/oe-selftest-armhost/build/meta/lib/oeqa/selftest/cases/devtool.py", line 169, in _test_recipe_contents
    self.assertIn(inherit, inherits, 'Missing inherit of %s' % inherit)
  File "/usr/lib/python3.8/unittest/case.py", line 1179, in assertIn
    self.fail(self._formatMessage(msg, standardMsg))
  File "/usr/lib/python3.8/unittest/case.py", line 753, in fail
    raise self.failureException(msg)
AssertionError: 'cargo' not found in {'pkgconfig', 'cargo-update-recipe-crates', 'ptest-cargo'} : Missing inherit of cargo

Log:
https://autobuilder.yoctoproject.org/typhoon/#/builders/127/builds/1321/steps/14/logs/stdio

Best regards,
Luca
Frédéric Martinsons April 27, 2023, 4:42 a.m. UTC | #2
Le mer. 26 avr. 2023, 23:10, Luca Ceresoli <luca.ceresoli@bootlin.com> a
écrit :

> Hello Frederic,
>
> On Mon, 24 Apr 2023 15:04:10 +0200
> "Frederic Martinsons" <frederic.martinsons@gmail.com> wrote:
>
> > From: Frederic Martinsons <frederic.martinsons@gmail.com>
> >
> > This brings the possibility to use this class to build and ship
> > unit tests of rust projects, the class also create (or modified)
> > standard run-ptest script to run the generated rust test suite.
> >
> > It has been tested successfully with core-image-sato under qemu
> > for zvariant-ptest and python3-bcrypt-ptest (though the last one
> > didn't define any unit tests).
> >
> > Note that I tried to do the same with python3-cryptography but fail
> > to build the test suite and I don't know how to do it with the rust
> > extension module build by python setuptools. There must be some kind
> > of way for doing that so maybe someone will put some work in it (
> > because python3-cryptography rust extension do have unit tests).
> >
> > Moreover, in the class, I didn't manage to share data between
> > do_compile_ptest_base and do_install_ptest_base cleanly (I tried
> > to d.setVar in compile and d.getVar in install but it seems that
> > the data store doens't recognize my new variable) so I used a file
> > for that. I'm sure there is a clever way for doing that, so feel
> > free to tell me.
>
> A build error appeared on the autobuilders with these patches applied:
>
>   File
> "/home/pokybuild/yocto-worker/oe-selftest-armhost/build/meta/lib/oeqa/selftest/cases/devtool.py",
> line 879, in test_devtool_modify_git_crates_subpath
>     self._test_recipe_contents(recipefile, {}, ['cargo'])
>   File
> "/home/pokybuild/yocto-worker/oe-selftest-armhost/build/meta/lib/oeqa/selftest/cases/devtool.py",
> line 169, in _test_recipe_contents
>     self.assertIn(inherit, inherits, 'Missing inherit of %s' % inherit)
>   File "/usr/lib/python3.8/unittest/case.py", line 1179, in assertIn
>     self.fail(self._formatMessage(msg, standardMsg))
>   File "/usr/lib/python3.8/unittest/case.py", line 753, in fail
>     raise self.failureException(msg)
> AssertionError: 'cargo' not found in {'pkgconfig',
> 'cargo-update-recipe-crates', 'ptest-cargo'} : Missing inherit of cargo
>
> Log:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/127/builds/1321/steps/14/logs/stdio
>
> Best regards,
> Luca
>
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Ndnd


Hello Luca, thanks for the report.

I should have ran selftests before submitting, I plead guilty considering
that I also created this test case in a first place.

Anyway, I'll push a v3 soon to correct this.