diff options
author | Nikhil R <nikhil.r@kpit.com> | 2022-05-25 17:05:54 +0530 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-05-26 18:54:39 -0700 |
commit | 3277a81937bee01437a7ca8634e0f056e318f21b (patch) | |
tree | a7ef9762704d529c92881b64340cc59c0bfb1edd /meta-oe/recipes-extended | |
parent | dda4a40fcfdf2bcd8f95c49a2741f2e1df8f0102 (diff) | |
download | meta-openembedded-3277a81937bee01437a7ca8634e0f056e318f21b.tar.gz |
duktape: Add ptest
The Ptest for duktape executes below tests:
1. hello - a helloworld example is basic compilation test
that test the APIs - duk_get_top(), duk_push_c_function(),
duk_eval_string()
2. eval - a very simple for evaluating expressions from
command line which test the APIs - duk_push_string(),
duk_insert(), duk_join(), duk_pop()
3. evloop - a basic eventloop implementation test
that test the APIs - duk_is_object(), duk_compile()
duk_push_c_function(), duk_safe_call()
Test Summary:
Execution time = 46 sec
Signed-off-by: Nikhil R <nikhil.r@kpit.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended')
-rw-r--r-- | meta-oe/recipes-extended/duktape/duktape_2.7.0.bb | 22 | ||||
-rw-r--r-- | meta-oe/recipes-extended/duktape/files/run-ptest | 32 |
2 files changed, 53 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/duktape/duktape_2.7.0.bb b/meta-oe/recipes-extended/duktape/duktape_2.7.0.bb index 767478543..583e8337e 100644 --- a/meta-oe/recipes-extended/duktape/duktape_2.7.0.bb +++ b/meta-oe/recipes-extended/duktape/duktape_2.7.0.bb | |||
@@ -4,7 +4,11 @@ HOMEPAGE = "https://duktape.org" | |||
4 | LICENSE = "MIT" | 4 | LICENSE = "MIT" |
5 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b7825df97b52f926fc71300f7880408" | 5 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b7825df97b52f926fc71300f7880408" |
6 | 6 | ||
7 | SRC_URI = "https://duktape.org/duktape-${PV}.tar.xz" | 7 | SRC_URI = "https://duktape.org/duktape-${PV}.tar.xz \ |
8 | file://run-ptest \ | ||
9 | " | ||
10 | inherit ptest | ||
11 | |||
8 | SRC_URI[sha256sum] = "90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890" | 12 | SRC_URI[sha256sum] = "90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890" |
9 | 13 | ||
10 | EXTRA_OEMAKE = "INSTALL_PREFIX='${prefix}' DESTDIR='${D}' LIBDIR='/${baselib}'" | 14 | EXTRA_OEMAKE = "INSTALL_PREFIX='${prefix}' DESTDIR='${D}' LIBDIR='/${baselib}'" |
@@ -13,8 +17,24 @@ do_compile () { | |||
13 | oe_runmake -f Makefile.sharedlibrary INSTALL_PREFIX="${prefix}" DESTDIR="${D}" | 17 | oe_runmake -f Makefile.sharedlibrary INSTALL_PREFIX="${prefix}" DESTDIR="${D}" |
14 | } | 18 | } |
15 | 19 | ||
20 | do_compile_ptest() { | ||
21 | oe_runmake -f Makefile.hello INSTALL_PREFIX="${prefix}" DESTDIR="${D}" | ||
22 | oe_runmake -f Makefile.eval INSTALL_PREFIX="${prefix}" DESTDIR="${D}" | ||
23 | oe_runmake -f Makefile.eventloop INSTALL_PREFIX="${prefix}" DESTDIR="${D}" | ||
24 | } | ||
25 | |||
16 | do_install () { | 26 | do_install () { |
17 | oe_runmake -f Makefile.sharedlibrary INSTALL_PREFIX="${prefix}" DESTDIR="${D}" install | 27 | oe_runmake -f Makefile.sharedlibrary INSTALL_PREFIX="${prefix}" DESTDIR="${D}" install |
18 | # libduktaped is identical to libduktape but has an hard-coded -g build flags, remove it | 28 | # libduktaped is identical to libduktape but has an hard-coded -g build flags, remove it |
19 | rm -f ${D}${libdir}/libduktaped.so* | 29 | rm -f ${D}${libdir}/libduktaped.so* |
20 | } | 30 | } |
31 | |||
32 | do_install_ptest() { | ||
33 | install -m 0755 "${WORKDIR}/duktape-2.7.0/hello" "${D}${PTEST_PATH}" | ||
34 | install -m 0755 "${WORKDIR}/duktape-2.7.0/eval" "${D}${PTEST_PATH}" | ||
35 | install -m 0755 "${WORKDIR}/duktape-2.7.0/evloop" "${D}${PTEST_PATH}" | ||
36 | install -m 0755 "${WORKDIR}/duktape-2.7.0/examples/eventloop/timer-test.js" "${D}${PTEST_PATH}" | ||
37 | install -m 0755 "${WORKDIR}/duktape-2.7.0/examples/eventloop/ecma_eventloop.js" "${D}${PTEST_PATH}" | ||
38 | } | ||
39 | |||
40 | RDEPENDS_${PN}-ptest += "make" | ||
diff --git a/meta-oe/recipes-extended/duktape/files/run-ptest b/meta-oe/recipes-extended/duktape/files/run-ptest new file mode 100644 index 000000000..852fb15de --- /dev/null +++ b/meta-oe/recipes-extended/duktape/files/run-ptest | |||
@@ -0,0 +1,32 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ./hello &> $test.output 2>&1 | ||
4 | out="Hello world!" | ||
5 | |||
6 | if grep -i "$out" $test.output 2>&1 ; then | ||
7 | echo "PASS: Hello duktape" | ||
8 | else | ||
9 | echo "FAIL: Hello duktape" | ||
10 | fi | ||
11 | rm -f $test.output | ||
12 | |||
13 | ./eval "print('Hello world!'); 123;" > out.log | ||
14 | |||
15 | sed -n '2p' out.log > eval.log | ||
16 | sed -n '3p' out.log >> eval.log | ||
17 | |||
18 | if grep -w 'Hello world!\|123' eval.log 2>&1; then | ||
19 | echo "PASS: eval duktape" | ||
20 | else | ||
21 | echo "FAIL: eval duktape" | ||
22 | fi | ||
23 | rm -f eval.log out.log | ||
24 | |||
25 | ./evloop timer-test.js > evloop.log 2>&1 | ||
26 | |||
27 | if grep -i "no active timers and no sockets to poll" evloop.log 2>&1; then | ||
28 | echo "PASS: evloop duktape" | ||
29 | else | ||
30 | echo "FAIL: evloop duktape" | ||
31 | fi | ||
32 | rm -f evloop.log | ||