diff mbox series

[meta-oe] pegtl: add ptest support

Message ID 20240829162046.49426-1-alexandre.truong@smile.fr
State Accepted
Headers show
Series [meta-oe] pegtl: add ptest support | expand

Commit Message

Alexandre TRUONG Aug. 29, 2024, 4:20 p.m. UTC
From: Alexandre Truong <alexandre.truong@smile.fr>

Test added to the fast-list.

Result of ptest-runner:

root@qemux86-64:~# ptest-runner pegtl
START: ptest-runner
2024-08-29T13:57
BEGIN: /usr/lib/pegtl/ptest
PASS: src/test/pegtl/pegtl-test-action_enable
PASS: src/test/pegtl/pegtl-test-action_match
PASS: src/test/pegtl/pegtl-test-actions_one
[...]
PASS: src/test/pegtl/pegtl-test-utf8_general
PASS: src/test/pegtl/pegtl-test-visit
PASS: All 128 tests passed
DURATION: 4
END: /usr/lib/pegtl/ptest
2024-08-29T13:57
STOP: ptest-runner
TOTAL: 1 FAIL: 0

NB: two tests are being skipped with a exception raised as support is disabled

Exception support disabled, skipping test...
PASS: src/test/pegtl/pegtl-test-internal_file_mapper
Exception support disabled, skipping test...
PASS: src/test/pegtl/pegtl-test-internal_file_opener

Signed-off-by: Alexandre Truong <alexandre.truong@smile.fr>
Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
---
 .../include/ptest-packagelists-meta-oe.inc    |  1 +
 .../recipes-extended/pegtl/pegtl/run-ptest    | 23 +++++++++++++++++++
 meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb | 15 ++++++++++--
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-extended/pegtl/pegtl/run-ptest

Comments

Khem Raj Aug. 29, 2024, 4:36 p.m. UTC | #1
Thanks for adding to ptests, it's quite an important part of the project
Its not clear if the test was run on recipe specific ptest image or
part of some larger general purpose image.

e.g. for MACHINE=qemux86-64

bitbake meta-oe-image-ptest-pegtl

would build it and

bitbake meta-oe-image-ptest-pegtl -ctestimage

would run it.

This is to ensure that recipe includes all the needed rdeps for ptests to run

On Thu, Aug 29, 2024 at 9:21 AM Alexandre Truong via
lists.openembedded.org
<alexandre.truong=smile.fr@lists.openembedded.org> wrote:
>
> From: Alexandre Truong <alexandre.truong@smile.fr>
>
> Test added to the fast-list.
>
> Result of ptest-runner:
>
> root@qemux86-64:~# ptest-runner pegtl
> START: ptest-runner
> 2024-08-29T13:57
> BEGIN: /usr/lib/pegtl/ptest
> PASS: src/test/pegtl/pegtl-test-action_enable
> PASS: src/test/pegtl/pegtl-test-action_match
> PASS: src/test/pegtl/pegtl-test-actions_one
> [...]
> PASS: src/test/pegtl/pegtl-test-utf8_general
> PASS: src/test/pegtl/pegtl-test-visit
> PASS: All 128 tests passed
> DURATION: 4
> END: /usr/lib/pegtl/ptest
> 2024-08-29T13:57
> STOP: ptest-runner
> TOTAL: 1 FAIL: 0
>
> NB: two tests are being skipped with a exception raised as support is disabled
>
> Exception support disabled, skipping test...
> PASS: src/test/pegtl/pegtl-test-internal_file_mapper
> Exception support disabled, skipping test...
> PASS: src/test/pegtl/pegtl-test-internal_file_opener
>
> Signed-off-by: Alexandre Truong <alexandre.truong@smile.fr>
> Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  .../include/ptest-packagelists-meta-oe.inc    |  1 +
>  .../recipes-extended/pegtl/pegtl/run-ptest    | 23 +++++++++++++++++++
>  meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb | 15 ++++++++++--
>  3 files changed, 37 insertions(+), 2 deletions(-)
>  create mode 100644 meta-oe/recipes-extended/pegtl/pegtl/run-ptest
>
> diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> index 01bf975a15..0ea43f5972 100644
> --- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> +++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> @@ -33,6 +33,7 @@ PTESTS_FAST_META_OE = "\
>      nodejs \
>      onig \
>      oprofile \
> +    pegtl \
>      protobuf \
>      pv \
>      python3-pefile \
> diff --git a/meta-oe/recipes-extended/pegtl/pegtl/run-ptest b/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
> new file mode 100644
> index 0000000000..e819628c9f
> --- /dev/null
> +++ b/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
> @@ -0,0 +1,23 @@
> +#!/bin/sh
> +
> +fail_count=0
> +all_count=0
> +
> +for test_suite in src/test/pegtl/pegtl-test-*
> +do
> +    if "./$test_suite"
> +    then
> +        echo "PASS: $test_suite"
> +    else
> +        echo "FAIL: $test_suite"
> +        fail_count=$((fail_count + 1))
> +    fi
> +    all_count=$((all_count + 1))
> +done
> +
> +if [ $fail_count -eq 0 ]
> +then
> +    echo "PASS: All $all_count tests passed"
> +else
> +    echo "FAIL: $fail_count of $all_count tests failed"
> +fi
> diff --git a/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb b/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> index 237828dbfc..2e32e3e788 100644
> --- a/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> +++ b/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> @@ -3,11 +3,22 @@ HOMEPAGE="https://github.com/taocpp/PEGTL"
>  LICENSE="MIT"
>  LIC_FILES_CHKSUM = "file://LICENSE;md5=dccf35ef30bf912bb07b01d469965293"
>
> -SRC_URI = "git://github.com/taocpp/PEGTL.git;protocol=https;branch=3.x"
> +SRC_URI = " \
> +       git://github.com/taocpp/PEGTL.git;protocol=https;branch=3.x \
> +       file://run-ptest \
> +"
> +
>  SRCREV = "cf639f7f4ee125f68e1ccfba8d99ebc0de57b9fe"
>
> -inherit cmake
> +inherit cmake ptest
>
>  S = "${WORKDIR}/git"
>
> +do_install_ptest () {
> +    install -d ${D}${PTEST_PATH}/src/test/pegtl/data
> +    install -m 0755 ${B}/src/test/pegtl/pegtl-test-* ${D}${PTEST_PATH}/src/test/pegtl
> +    install ${S}/src/test/pegtl/file_*.txt ${D}${PTEST_PATH}/src/test/pegtl
> +    install ${S}/src/test/pegtl/data/*.json ${D}${PTEST_PATH}/src/test/pegtl/data
> +}
> +
>  CXXFLAGS += " -Wno-error=type-limits"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#112035): https://lists.openembedded.org/g/openembedded-devel/message/112035
> Mute This Topic: https://lists.openembedded.org/mt/108164523/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexandre TRUONG Sept. 2, 2024, 9:20 a.m. UTC | #2
Thanks for your reply, here is how I'm running it:

I'm running the test on meta-oe-image-ptest-pegtl.

I'm doing
runqemu nographic slirp
./tmp/deploy/images/qemux86-64/meta-oe-image-ptest-pegtl-qemux86-64.rootfs.qemuboot.conf

then ptest-runner pegtl

Alexandre Truong

Le jeu. 29 août 2024 à 18:36, Khem Raj <raj.khem@gmail.com> a écrit :

> Thanks for adding to ptests, it's quite an important part of the project
> Its not clear if the test was run on recipe specific ptest image or
> part of some larger general purpose image.
>
> e.g. for MACHINE=qemux86-64
>
> bitbake meta-oe-image-ptest-pegtl
>
> would build it and
>
> bitbake meta-oe-image-ptest-pegtl -ctestimage
>
> would run it.
>
> This is to ensure that recipe includes all the needed rdeps for ptests to
> run
>
> On Thu, Aug 29, 2024 at 9:21 AM Alexandre Truong via
> lists.openembedded.org
> <alexandre.truong=smile.fr@lists.openembedded.org> wrote:
> >
> > From: Alexandre Truong <alexandre.truong@smile.fr>
> >
> > Test added to the fast-list.
> >
> > Result of ptest-runner:
> >
> > root@qemux86-64:~# ptest-runner pegtl
> > START: ptest-runner
> > 2024-08-29T13:57
> > BEGIN: /usr/lib/pegtl/ptest
> > PASS: src/test/pegtl/pegtl-test-action_enable
> > PASS: src/test/pegtl/pegtl-test-action_match
> > PASS: src/test/pegtl/pegtl-test-actions_one
> > [...]
> > PASS: src/test/pegtl/pegtl-test-utf8_general
> > PASS: src/test/pegtl/pegtl-test-visit
> > PASS: All 128 tests passed
> > DURATION: 4
> > END: /usr/lib/pegtl/ptest
> > 2024-08-29T13:57
> > STOP: ptest-runner
> > TOTAL: 1 FAIL: 0
> >
> > NB: two tests are being skipped with a exception raised as support is
> disabled
> >
> > Exception support disabled, skipping test...
> > PASS: src/test/pegtl/pegtl-test-internal_file_mapper
> > Exception support disabled, skipping test...
> > PASS: src/test/pegtl/pegtl-test-internal_file_opener
> >
> > Signed-off-by: Alexandre Truong <alexandre.truong@smile.fr>
> > Reviewed-by: Yoann Congal <yoann.congal@smile.fr>
> > ---
> >  .../include/ptest-packagelists-meta-oe.inc    |  1 +
> >  .../recipes-extended/pegtl/pegtl/run-ptest    | 23 +++++++++++++++++++
> >  meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb | 15 ++++++++++--
> >  3 files changed, 37 insertions(+), 2 deletions(-)
> >  create mode 100644 meta-oe/recipes-extended/pegtl/pegtl/run-ptest
> >
> > diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> > index 01bf975a15..0ea43f5972 100644
> > --- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> > +++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
> > @@ -33,6 +33,7 @@ PTESTS_FAST_META_OE = "\
> >      nodejs \
> >      onig \
> >      oprofile \
> > +    pegtl \
> >      protobuf \
> >      pv \
> >      python3-pefile \
> > diff --git a/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
> b/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
> > new file mode 100644
> > index 0000000000..e819628c9f
> > --- /dev/null
> > +++ b/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
> > @@ -0,0 +1,23 @@
> > +#!/bin/sh
> > +
> > +fail_count=0
> > +all_count=0
> > +
> > +for test_suite in src/test/pegtl/pegtl-test-*
> > +do
> > +    if "./$test_suite"
> > +    then
> > +        echo "PASS: $test_suite"
> > +    else
> > +        echo "FAIL: $test_suite"
> > +        fail_count=$((fail_count + 1))
> > +    fi
> > +    all_count=$((all_count + 1))
> > +done
> > +
> > +if [ $fail_count -eq 0 ]
> > +then
> > +    echo "PASS: All $all_count tests passed"
> > +else
> > +    echo "FAIL: $fail_count of $all_count tests failed"
> > +fi
> > diff --git a/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> b/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> > index 237828dbfc..2e32e3e788 100644
> > --- a/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> > +++ b/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
> > @@ -3,11 +3,22 @@ HOMEPAGE="https://github.com/taocpp/PEGTL"
> >  LICENSE="MIT"
> >  LIC_FILES_CHKSUM = "file://LICENSE;md5=dccf35ef30bf912bb07b01d469965293"
> >
> > -SRC_URI = "git://github.com/taocpp/PEGTL.git;protocol=https;branch=3.x"
> > +SRC_URI = " \
> > +       git://github.com/taocpp/PEGTL.git;protocol=https;branch=3.x \
> > +       file://run-ptest \
> > +"
> > +
> >  SRCREV = "cf639f7f4ee125f68e1ccfba8d99ebc0de57b9fe"
> >
> > -inherit cmake
> > +inherit cmake ptest
> >
> >  S = "${WORKDIR}/git"
> >
> > +do_install_ptest () {
> > +    install -d ${D}${PTEST_PATH}/src/test/pegtl/data
> > +    install -m 0755 ${B}/src/test/pegtl/pegtl-test-*
> ${D}${PTEST_PATH}/src/test/pegtl
> > +    install ${S}/src/test/pegtl/file_*.txt
> ${D}${PTEST_PATH}/src/test/pegtl
> > +    install ${S}/src/test/pegtl/data/*.json
> ${D}${PTEST_PATH}/src/test/pegtl/data
> > +}
> > +
> >  CXXFLAGS += " -Wno-error=type-limits"
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#112035):
> https://lists.openembedded.org/g/openembedded-devel/message/112035
> > Mute This Topic: https://lists.openembedded.org/mt/108164523/1997914
> > Group Owner: openembedded-devel+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
diff mbox series

Patch

diff --git a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
index 01bf975a15..0ea43f5972 100644
--- a/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
+++ b/meta-oe/conf/include/ptest-packagelists-meta-oe.inc
@@ -33,6 +33,7 @@  PTESTS_FAST_META_OE = "\
     nodejs \
     onig \
     oprofile \
+    pegtl \
     protobuf \
     pv \
     python3-pefile \
diff --git a/meta-oe/recipes-extended/pegtl/pegtl/run-ptest b/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
new file mode 100644
index 0000000000..e819628c9f
--- /dev/null
+++ b/meta-oe/recipes-extended/pegtl/pegtl/run-ptest
@@ -0,0 +1,23 @@ 
+#!/bin/sh
+
+fail_count=0
+all_count=0
+
+for test_suite in src/test/pegtl/pegtl-test-*
+do
+    if "./$test_suite"
+    then
+        echo "PASS: $test_suite"
+    else
+        echo "FAIL: $test_suite"
+        fail_count=$((fail_count + 1))
+    fi
+    all_count=$((all_count + 1))
+done
+
+if [ $fail_count -eq 0 ]
+then
+    echo "PASS: All $all_count tests passed"
+else
+    echo "FAIL: $fail_count of $all_count tests failed"
+fi
diff --git a/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb b/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
index 237828dbfc..2e32e3e788 100644
--- a/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
+++ b/meta-oe/recipes-extended/pegtl/pegtl_3.2.7.bb
@@ -3,11 +3,22 @@  HOMEPAGE="https://github.com/taocpp/PEGTL"
 LICENSE="MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=dccf35ef30bf912bb07b01d469965293"
 
-SRC_URI = "git://github.com/taocpp/PEGTL.git;protocol=https;branch=3.x"
+SRC_URI = " \
+	git://github.com/taocpp/PEGTL.git;protocol=https;branch=3.x \
+	file://run-ptest \
+"
+
 SRCREV = "cf639f7f4ee125f68e1ccfba8d99ebc0de57b9fe"
 
-inherit cmake
+inherit cmake ptest
 
 S = "${WORKDIR}/git"
 
+do_install_ptest () {
+    install -d ${D}${PTEST_PATH}/src/test/pegtl/data
+    install -m 0755 ${B}/src/test/pegtl/pegtl-test-* ${D}${PTEST_PATH}/src/test/pegtl
+    install ${S}/src/test/pegtl/file_*.txt ${D}${PTEST_PATH}/src/test/pegtl
+    install ${S}/src/test/pegtl/data/*.json ${D}${PTEST_PATH}/src/test/pegtl/data
+}
+
 CXXFLAGS += " -Wno-error=type-limits"