diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/kconfig/full.cfg | 2 | ||||
-rw-r--r-- | test/py/test_bthread.py | 23 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/kconfig/full.cfg b/test/kconfig/full.cfg index e69de29bb2..39275768ea 100644 --- a/test/kconfig/full.cfg +++ b/test/kconfig/full.cfg @@ -0,0 +1,2 @@ +CONFIG_BTHREAD=y +CONFIG_CMD_BTHREAD=y diff --git a/test/py/test_bthread.py b/test/py/test_bthread.py new file mode 100644 index 0000000000..6e7b4ba500 --- /dev/null +++ b/test/py/test_bthread.py @@ -0,0 +1,23 @@ +import pytest +from .helper import * + +def stale_spawners(barebox): + threads = barebox.run_check("bthread -i") + if len(threads) == 0: + return False + return len([t for t in threads if t.startswith('spawner')]) > 0 + +def test_bthread(barebox, barebox_config): + skip_disabled(barebox_config, "CONFIG_CMD_BTHREAD") + + assert not stale_spawners(barebox) + + _, _, returncode = barebox.run('bthread -vvvv') + assert returncode == 0 + + assert not stale_spawners(barebox) + + switches = int(barebox.run_check("bthread -c")[0].split()[0]) + yields = int(barebox.run_check("bthread -t")[0].split()[0]) + + assert yields < switches |