u-boot/test/py/tests
Stephen Warren 636f38d83a test/py: move U-Boot respawn trigger to the test core
Prior to this change, U-Boot was lazilly (re-)spawned if/when a test
attempted to interact with it, and no active connection existed. This
approach was simple, yet had the disadvantage that U-Boot might be
spawned in the middle of a test function, e.g. after the test had already
performed actions such as creating data files, etc. In that case, this
could cause the log to contain the sequence (1) some test logs, (2)
U-Boot's boot process, (3) the rest of that test's logs. This isn't
optimally readable. This issue will affect the upcoming DFU and enhanced
UMS tests.

This change converts u_boot_console to be a function-scoped fixture, so
that pytest attempts to re-create the object for each test invocation.
This allows the fixture factory function to ensure that U-Boot is spawned
prior to every test. In practice, the same object is returned each time
so there is essentially no additional overhead due to this change.

This allows us to remove:

- The explicit ensure_spawned() call from test_sleep, since the core now
ensures that the spawn happens before the test code is executed.

- The laxy calls to ensure_spawned() in the u_boot_console_*
implementations.

The one downside is that test_env's "state_ttest_env" fixture must be
converted to a function-scoped fixture too, since a module-scoped fixture
cannot use a function-scoped fixture. To avoid overhead, we use the same
trick of returning the same object each time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-01-28 21:01:22 -07:00
..
test_000_version.py test/py: Implement pytest infrastructure 2016-01-20 19:06:23 -07:00
test_env.py test/py: move U-Boot respawn trigger to the test core 2016-01-28 21:01:22 -07:00
test_help.py test/py: Implement pytest infrastructure 2016-01-20 19:06:23 -07:00
test_hush_if_test.py test/py: test the shell if command 2016-01-20 19:06:23 -07:00
test_md.py test/py: test the md/mw commands 2016-01-20 19:06:23 -07:00
test_sandbox_exit.py test/py: move U-Boot respawn trigger to the test core 2016-01-28 21:01:22 -07:00
test_shell_basics.py test/py: add test of basic shell functionality 2016-01-20 19:06:23 -07:00
test_sleep.py test/py: move U-Boot respawn trigger to the test core 2016-01-28 21:01:22 -07:00
test_ums.py test/py: test the ums command 2016-01-20 19:06:24 -07:00
test_unknown_cmd.py test/py: Implement pytest infrastructure 2016-01-20 19:06:23 -07:00