Skip to content
Snippets Groups Projects
Commit ff5fcb49 authored by Esben Haabendal's avatar Esben Haabendal
Browse files

openharmony-standard: Use a generic run-ptest script


Instead of writing custom run-ptest scripts for all the (yet to come) ptest
suites for OpenHarmony 1st party components, this commit introduces a generic
run-ptest script, which should hopefully be usable for all (or at least most)
components.

Signed-off-by: default avatarEsben Haabendal <esben.haabendal@huawei.com>
parent f9402f8a
No related branches found
No related tags found
1 merge request!15Various improvements in preparation for splitting components into packages
#!/bin/sh
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
PTEST_PATH=$(dirname $(readlink -f $0))
cd ${PTEST_PATH}
# Start systemd services as needed
if [ -f systemd-units ] ; then
for unit in $(cat systemd-units) ; do
systemctl start $unit
done
fi
TEST_RESULT=0
find_tcs() {
ts=$1
for tc in $ts/* $ts/*/*Test $ts/*/*_test ; do
if [ -f $tc -a -x $tc ] ; then
echo $tc
fi
done
}
for ts in unittest moduletest systemtest ; do
for tc in $(find_tcs $ts) ; do
echo "RUNNING $tc"
./$tc
test_result=$?
if test "$test_result" -eq 0; then
echo "PASS: $tc"
else
echo "FAIL: $tc"
TEST_RESULT=1
fi
done
done
exit $TEST_RESULT
#!/bin/sh
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
# Start the hilogd service if it is not already running
systemctl start hilogd.service
# Add path to hilog test suite $PATH
PTEST_PATH=$(dirname $(readlink -f $0))
export PATH="${PTEST_PATH}:${PATH}"
HiLogNDKTest
TEST_RESULT=$?
if test "$TEST_RESULT" -eq 0; then
echo "PASS: HiLogNDKTest"
else
echo "FAIL: HiLogNDKTest"
fi
......@@ -23,6 +23,8 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/openharmony-standard-${OPENHARMONY_VERSIO
require ${PN}-sources-${OPENHARMONY_VERSION}.inc
require java-tools.inc
SRC_URI += "${@bb.utils.contains('PTEST_ENABLED', '1', 'file://run-ptest', '', d)}"
# TODO: we probably want these
#SRC_URI += "file://hilog-Add-tests.patch"
......@@ -233,6 +235,8 @@ do_install_ptest () {
do
install -D -m 755 "${B}/tests/$f" "${D}${PTEST_PATH}/$f"
done
# undo the default installation of ptest done by ptest.bbclass
rm -f ${D}${PTEST_PATH}/run-ptest
}
generate_platforms_build_file() {
......@@ -435,11 +439,11 @@ RDEPENDS:${PN} += "${PN}-libbegetutil"
inherit systemd
SYSTEMD_AUTO_ENABLE = "enable"
# //base/hiviewdfx/hilog component
PACKAGES =+ "${PN}-hilog ${PN}-hilog-ptest"
SYSTEMD_PACKAGES = "${PN}-hilog"
SYSTEMD_SERVICE:${PN}-hilog = "hilogd.service"
SRC_URI += "file://hilogd.service"
SRC_URI += "${@bb.utils.contains('PTEST_ENABLED', '1', 'file://hilog.run-ptest', '', d)}"
do_install:append() {
install -d ${D}/${systemd_unitdir}/system
install -m 644 ${WORKDIR}/hilogd.service ${D}${systemd_unitdir}/system/
......@@ -447,10 +451,12 @@ do_install:append() {
install -d ${D}${sysconfdir}/sysctl.d
echo "net.unix.max_dgram_qlen=600" > ${D}${sysconfdir}/sysctl.d/hilogd.conf
}
do_install_ptest_base[cleandirs] += "${D}${libdir}/${BPN}-hilog/ptest"
do_install_ptest:append() {
install -D ${WORKDIR}/hilog.run-ptest ${D}${libdir}/${BPN}-hilog/ptest/run-ptest
mv ${D}${PTEST_PATH}/moduletest/hiviewdfx/hilog/* ${D}${libdir}/${BPN}-hilog/ptest/
rmdir ${D}${PTEST_PATH}/moduletest/hiviewdfx/hilog
install -D ${WORKDIR}/run-ptest ${D}${libdir}/${BPN}-hilog/ptest/run-ptest
mv ${D}${PTEST_PATH}/moduletest/hiviewdfx/hilog ${D}${libdir}/${BPN}-hilog/ptest/moduletest
rmdir ${D}${PTEST_PATH}/moduletest/hiviewdfx
echo "hilogd.service" > ${D}${libdir}/${BPN}-hilog/ptest/systemd-units
}
FILES:${PN}-hilog = "\
${bindir}/hilog* \
......@@ -459,10 +465,12 @@ FILES:${PN}-hilog = "\
${systemd_unitdir}/hilogd.service \
"
FILES:${PN}-hilog-ptest = "${libdir}/${BPN}-hilog/ptest"
RDEPENDS:${PN}-hilog += "musl libcxx ${PN}-libsec-shared ${PN}-libutilsecurec ${PN}-libbegetutil ${PN}-libsyspara"
RDEPENDS:${PN}-hilog-ptest += "${PN}-hilog musl libcxx"
RDEPENDS:${PN} += "${PN}-hilog"
RDEPENDS:${PN}-ptest += "${PN}-hilog-ptest ${PN}-hilog"
RDEPENDS:${PN}-hilog-ptest += "${PN}-hilog"
RDEPENDS:${PN}-hilog += "musl libcxx"
RDEPENDS:${PN}-hilog-ptest += "musl libcxx"
RDEPENDS:${PN}-hilog += "${PN}-libsec-shared ${PN}-libutilsecurec ${PN}-libbegetutil ${PN}-libsyspara"
EXCLUDE_FROM_SHLIBS = "1"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment