Complete autogen, first stab at scheduling each test on an individual period_ms basis
This commit is contained in:
36
autogen.sh
36
autogen.sh
@ -19,7 +19,11 @@ EOF
|
|||||||
gen_src_body() {
|
gen_src_body() {
|
||||||
echo "GEN $OUT_SRC"
|
echo "GEN $OUT_SRC"
|
||||||
(
|
(
|
||||||
for func in create run destroy; do
|
for n in $*; do
|
||||||
|
echo "extern uint32_t test_${n}_period_ms;"
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
|
for func in create destroy; do
|
||||||
echo "bool tests_${func}(void) {"
|
echo "bool tests_${func}(void) {"
|
||||||
echo " uint32_t total=0, success=0;"
|
echo " uint32_t total=0, success=0;"
|
||||||
for n in $*; do
|
for n in $*; do
|
||||||
@ -39,6 +43,36 @@ EOF
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
done
|
done
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
bool tests_run(void) {
|
||||||
|
double now;
|
||||||
|
uint32_t total, success;
|
||||||
|
EOF
|
||||||
|
for n in $*; do
|
||||||
|
echo " static double next_${n}_run = 0;"
|
||||||
|
done
|
||||||
|
cat << EOF
|
||||||
|
for (;;) {
|
||||||
|
now = mg_time();
|
||||||
|
EOF
|
||||||
|
for n in $*; do
|
||||||
|
cat << EOF
|
||||||
|
if (now > next_${n}_run) {
|
||||||
|
if (test_${n}_run()) success++;
|
||||||
|
next_${n}_run = now + (test_${n}_period_ms/1000.f);
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
mgos_usleep(1000);
|
||||||
|
}
|
||||||
|
return (total == success);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOF
|
||||||
) >> $OUT_SRC
|
) >> $OUT_SRC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user