Use test_*_enabled

This commit is contained in:
Pim van Pelt
2019-01-06 16:09:27 +01:00
parent 60bf5b82a5
commit 0633980341
3 changed files with 6 additions and 5 deletions

View File

@ -21,6 +21,7 @@ gen_src_body() {
(
for n in $*; do
echo "extern uint32_t test_${n}_period_ms;"
echo "extern bool test_${n}_enabled;"
done
echo ""
for func in create destroy; do
@ -28,7 +29,7 @@ gen_src_body() {
echo " uint32_t total=0, success=0;"
for n in $*; do
cat << EOF
if (!test_${n}_${func}()) {
if (test_${n}_enabled && !test_${n}_${func}()) {
LOG(LL_ERROR, ("Could not $func test $n"));
} else {
success++;
@ -58,7 +59,7 @@ EOF
EOF
for n in $*; do
cat << EOF
if (now > next_${n}_run) {
if (test_${n}_enabled && (now > next_${n}_run)) {
if (test_${n}_run()) success++;
next_${n}_run = now + (test_${n}_period_ms/1000.f);
total++;
@ -120,7 +121,7 @@ gen_src_head
for f in tests/*.c; do
base=$(basename $f | cut -f1 -d'.')
echo "CHK $base in $f"
egrep -q "test_${base}_enabled.*true" $f && base_list="$base_list $base"
base_list="$base_list $base"
done
gen_inc_body $base_list