Add test_*_enabled to enable/disable tests
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
build/
|
build/
|
||||||
libs/
|
libs/
|
||||||
tests/
|
|
||||||
mgos_i2c
|
mgos_i2c
|
||||||
|
@ -15,7 +15,8 @@ bool test_*_destroy();
|
|||||||
|
|
||||||
And static variables named:
|
And static variables named:
|
||||||
```
|
```
|
||||||
uint32_t test_*_period_ms;
|
uint32_t test_*_period_ms = 1000;
|
||||||
|
bool test_*_enabled = true;
|
||||||
```
|
```
|
||||||
|
|
||||||
Running `make` will then generate the test skeleton, recursively compile
|
Running `make` will then generate the test skeleton, recursively compile
|
||||||
|
@ -120,7 +120,7 @@ gen_src_head
|
|||||||
for f in tests/*.c; do
|
for f in tests/*.c; do
|
||||||
base=$(basename $f | cut -f1 -d'.')
|
base=$(basename $f | cut -f1 -d'.')
|
||||||
echo "CHK $base in $f"
|
echo "CHK $base in $f"
|
||||||
base_list="$base_list $base"
|
egrep -q "test_${base}_enabled.*true" $f && base_list="$base_list $base"
|
||||||
done
|
done
|
||||||
|
|
||||||
gen_inc_body $base_list
|
gen_inc_body $base_list
|
||||||
|
20
tests/example.c
Normal file
20
tests/example.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "mgos.h"
|
||||||
|
#include "tests_autogen.h"
|
||||||
|
|
||||||
|
uint32_t test_example_period_ms = 10000;
|
||||||
|
bool test_example_enabled = true;
|
||||||
|
|
||||||
|
bool test_example_create(void) {
|
||||||
|
// LOG(LL_INFO, ("Setting up"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool test_example_run(void) {
|
||||||
|
// LOG(LL_INFO, ("Hello World!"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool test_example_destroy(void) {
|
||||||
|
// LOG(LL_INFO, ("Tearing down"));
|
||||||
|
return true;
|
||||||
|
}
|
Reference in New Issue
Block a user