mbox

[0/3] Create class for building rust unit test

Message ID cover.1682178812.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 22, 2023, 3:59 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               |  11 +-
 meta/classes-recipe/ptest-cargo.bbclass       | 108 ++++++++++++++++++
 .../python/python3-bcrypt_4.0.1.bb            |   4 +-
 3 files changed, 121 insertions(+), 2 deletions(-)
 create mode 100644 meta/classes-recipe/ptest-cargo.bbclass

Comments

Alexander Kanavin April 24, 2023, 7:50 a.m. UTC | #1
If you add ptests, please also add them to appropriate lists in
meta/conf/distro/include/ptest-packagelists.inc, so they will be
actually built and executed in yocto CI.

Can you include a sample output of the tests you added into commit messages?

Alex

On Sat, 22 Apr 2023 at 17:59, 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.
>
> 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               |  11 +-
>  meta/classes-recipe/ptest-cargo.bbclass       | 108 ++++++++++++++++++
>  .../python/python3-bcrypt_4.0.1.bb            |   4 +-
>  3 files changed, 121 insertions(+), 2 deletions(-)
>  create mode 100644 meta/classes-recipe/ptest-cargo.bbclass
>
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#180319): https://lists.openembedded.org/g/openembedded-core/message/180319
> Mute This Topic: https://lists.openembedded.org/mt/98436057/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Frédéric Martinsons April 24, 2023, 8:20 a.m. UTC | #2
On Mon, 24 Apr 2023 at 09:51, Alexander Kanavin <alex.kanavin@gmail.com>
wrote:

> If you add ptests, please also add them to appropriate lists in
> meta/conf/distro/include/ptest-packagelists.inc, so they will be
> actually built and executed in yocto CI.
>
> Can you include a sample output of the tests you added into commit
> messages?
>
> Alex
>

Ok I will issue a V2 with the modifications asked.


> On Sat, 22 Apr 2023 at 17:59, 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.
> >
> > 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               |  11 +-
> >  meta/classes-recipe/ptest-cargo.bbclass       | 108 ++++++++++++++++++
> >  .../python/python3-bcrypt_4.0.1.bb            |   4 +-
> >  3 files changed, 121 insertions(+), 2 deletions(-)
> >  create mode 100644 meta/classes-recipe/ptest-cargo.bbclass
> >
> > --
> > 2.34.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#180319):
> https://lists.openembedded.org/g/openembedded-core/message/180319
> > Mute This Topic: https://lists.openembedded.org/mt/98436057/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Frédéric Martinsons April 24, 2023, 9:44 a.m. UTC | #3
On Mon, 24 Apr 2023 at 10:20, Frederic Martinsons via lists.openembedded.org
<frederic.martinsons=gmail.com@lists.openembedded.org> wrote:

>
> On Mon, 24 Apr 2023 at 09:51, Alexander Kanavin <alex.kanavin@gmail.com>
> wrote:
>
>> If you add ptests, please also add them to appropriate lists in
>> meta/conf/distro/include/ptest-packagelists.inc, so they will be
>> actually built and executed in yocto CI.
>>
>> Can you include a sample output of the tests you added into commit
>> messages?
>>
>> Alex
>>
>
> Ok I will issue a V2 with the modifications asked.
>
>
I looked again and python3-bcrypt is already in PTESTS_FAST , for zvariant
, the recipe is in meta-selftest
so this layer is not always included, is this will be a problem to add
zvariant into PTESTS_FAST ?

On Sat, 22 Apr 2023 at 17:59, 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.
>> >
>> > 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               |  11 +-
>> >  meta/classes-recipe/ptest-cargo.bbclass       | 108 ++++++++++++++++++
>> >  .../python/python3-bcrypt_4.0.1.bb            |   4 +-
>> >  3 files changed, 121 insertions(+), 2 deletions(-)
>> >  create mode 100644 meta/classes-recipe/ptest-cargo.bbclass
>> >
>> > --
>> > 2.34.1
>> >
>> >
>> >
>> >
>>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#180341):
> https://lists.openembedded.org/g/openembedded-core/message/180341
> Mute This Topic: https://lists.openembedded.org/mt/98436057/6213388
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> frederic.martinsons@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Alexander Kanavin April 24, 2023, 9:53 a.m. UTC | #4
On Mon, 24 Apr 2023 at 11:44, Frédéric Martinsons
<frederic.martinsons@gmail.com> wrote:
> I looked again and python3-bcrypt is already in PTESTS_FAST , for zvariant , the recipe is in meta-selftest
> so this layer is not always included, is this will be a problem to add zvariant into PTESTS_FAST ?

zvariant could be skipped for now then. Are the newly expanded bcrypt
tests still quick (under kvm)?

Alex
Frédéric Martinsons April 24, 2023, 10:16 a.m. UTC | #5
Le lun. 24 avr. 2023, 11:53, Alexander Kanavin <alex.kanavin@gmail.com> a
écrit :

> On Mon, 24 Apr 2023 at 11:44, Frédéric Martinsons
> <frederic.martinsons@gmail.com> wrote:
> > I looked again and python3-bcrypt is already in PTESTS_FAST , for
> zvariant , the recipe is in meta-selftest
> > so this layer is not always included, is this will be a problem to add
> zvariant into PTESTS_FAST ?
>
> zvariant could be skipped for now then. Are the newly expanded bcrypt
> tests still quick (under kvm)?
>
> Alex
>

Really quick since there are 0 test in the rust code ;)
But a test binary is guaranteed to be generated anyway.
I'll take another look to see if why python3-bcrypt was already in the test
suite and if I didn't overwrite something there.