]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bc: Add ptest.
authorYan Xinkuan <yanxk.fnst@fujitsu.com>
Mon, 31 Oct 2022 23:55:11 +0000 (07:55 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 2 Nov 2022 09:20:53 +0000 (09:20 +0000)
Add ptest for OSS 'bc' by using 'bc' in the system to do calculation jobs according to the .b files from the source file.

Test example as below:
......
.00673400673400673400
“PASS: bc/div.b”
99836408603283573660347145562829683495827909199408566065153345558783\
9427595471.89114392327665123852
“PASS: bc/exp.b”
length(b)= 1406
“PASS: bc/fact.b”
......

If bc runs the .b files and does not crash, it would 'PASS', otherwise 'FAIL'.

Tested in qemux86-64, with kvm enabled, test cost 12 secs, so it should be a fast test.

Thanks to Ross Burton and Alexander Kanavin for the professional guidance.

Signed-off-by: Yan Xinkuan <yanxk.fnst@fujitsu.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/distro/include/ptest-packagelists.inc
meta/recipes-extended/bc/bc/run-ptest [new file with mode: 0644]
meta/recipes-extended/bc/bc_1.07.1.bb

index 56088e4e66fdceeae7e2163c3f57bc25bfafa8d5..32b0e5297a0b118bcc247cbd4a8dece4fdfd003e 100644 (file)
@@ -8,6 +8,7 @@ PTESTS_FAST = "\
     apr-ptest \
     apr-util-ptest \
     attr-ptest \
+    bc-ptest \
     bluez5-ptest \
     bzip2-ptest \
     diffstat-ptest \
diff --git a/meta/recipes-extended/bc/bc/run-ptest b/meta/recipes-extended/bc/bc/run-ptest
new file mode 100644 (file)
index 0000000..66a1b9d
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+for TEST in *.b; do
+       if bc -l $TEST </dev/null; then
+               echo “PASS: bc/$TEST”
+       else
+               echo “FAIL: bc/$TEST”
+       fi
+done
index 1bec76bb2aaeb2dbcf9d1387f82bc2bfdec146be..178588f11bf764b424321d8f6541524444be9ec8 100644 (file)
@@ -15,11 +15,12 @@ DEPENDS = "flex-native"
 SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
            file://no-gen-libmath.patch \
            file://libmath.h \
-           file://0001-dc-fix-exit-code-of-q-command.patch"
+           file://0001-dc-fix-exit-code-of-q-command.patch \
+           file://run-ptest"
 SRC_URI[md5sum] = "cda93857418655ea43590736fc3ca9fc"
 SRC_URI[sha256sum] = "62adfca89b0a1c0164c2cdca59ca210c1d44c3ffc46daf9931cf4942664cb02a"
 
-inherit autotools texinfo update-alternatives
+inherit autotools texinfo update-alternatives ptest
 
 PACKAGECONFIG ??= "readline"
 PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
@@ -29,6 +30,10 @@ do_compile:prepend() {
     cp -f ${WORKDIR}/libmath.h ${B}/bc/libmath.h
 }
 
+do_install_ptest() {
+        install ${S}/Test/*.b ${D}${PTEST_PATH}
+}
+
 ALTERNATIVE:${PN} = "bc dc"
 ALTERNATIVE_PRIORITY = "100"