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

openharmony-standard: Add support for ptest fixture setup/teardown


This adds support in the run-ptest script used by all openharmony-standard
components for providing fixture setup and teardown scripts.

Signed-off-by: default avatarEsben Haabendal <esben.haabendal@huawei.com>
parent 1e861817
No related branches found
No related tags found
1 merge request!22openharmony-standard: Component packaging and systemd integration
...@@ -13,6 +13,11 @@ if [ -f systemd-units ] ; then ...@@ -13,6 +13,11 @@ if [ -f systemd-units ] ; then
done done
fi fi
# Component level test fixture setup
if [ -f setup.sh ]; then
source setup.sh
fi
TEST_RESULT=0 TEST_RESULT=0
find_tcs() { find_tcs() {
...@@ -25,17 +30,32 @@ find_tcs() { ...@@ -25,17 +30,32 @@ find_tcs() {
} }
for ts in unittest moduletest systemtest ; do for ts in unittest moduletest systemtest ; do
for tc in $(find_tcs $ts) ; do (
echo "RUNNING $tc" # Test suite level test fixture setup
./$tc if [ -f $ts/setup.sh ]; then
test_result=$? source $ts/setup.sh
if test "$test_result" -eq 0; then
echo "PASS: $tc"
else
echo "FAIL: $tc"
TEST_RESULT=1
fi fi
done 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
# Test suite level test fixture teardown
if [ -f $ts/teardown.sh ]; then
source $ts/teardown.sh
fi
)
done done
# Component level test fixture teardown
if [ -f setup.sh ]; then
source teardown.sh
fi
exit $TEST_RESULT exit $TEST_RESULT
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