mcuboot/sim
Fabio Utzig 57c40f7164 Fix assert abstraction in sim
Assertions that are expected to fail under sim test, are now marked as such
using the macro ASSERT which allows to programmatically switch between normal
assert() behavior and captured assertion.

Assertion changes were moved to more appropriate owners and code duplication
was removed.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-12-21 13:36:34 -07:00
..
mcuboot-sys Fix assert abstraction in sim 2017-12-21 13:36:34 -07:00
simflash Add option to disable verifying contents before writes 2017-12-21 13:36:34 -07:00
src Mark non-used functions in overwrite only mode 2017-12-21 13:36:34 -07:00
tests Add test with write status area fail and interruption 2017-12-21 13:36:34 -07:00
.gitignore sim: Add simulator code 2017-01-09 12:28:10 -07:00
Cargo.lock Enable capturing asserts inside simulator 2017-12-21 13:36:34 -07:00
Cargo.toml Add MCUBOOT_VALIDATE_SLOT0 as feature 2017-12-21 13:36:34 -07:00
README.rst sim: Update README for new test organization 2017-11-07 09:39:45 -07:00

README.rst

MCUboot Simulator
#################

This is a small simulator designed to exercise the mcuboot upgrade
code, specifically testing untimely reset scenarios to make sure the
code is robust.

Prerequisites
=============

The simulator is written in Rust_, and you will need to install it to
build it.  The installation_ page describes this process.  The
simulator can be built with the stable release of Rust.

.. _Rust: https://www.rust-lang.org/

.. _installation: https://www.rust-lang.org/en-US/install.html

Dependent code
--------------

The simulator depends on some external modules.  These are stored as
submodules within git.  To fetch these dependencies the first time::

  $ git submodule update --init

will clone and check out these trees in the appropriate place.

Testing
=======

The tests are written as unit tests in Rust, and can be built and run
automatically::

  $ cargo test

this should download and compile the necessary dependencies, compile
the relevant modules from mcuboot, build the simulator, and run the
tests.

Debugging
=========

If the simulator indicates a failure, you can turn on additional
logging by setting ``RUST_LOG=warn`` or ``RUST_LOG=error`` in the
environment::

  $ RUST_LOG=warn ./target/release/bootsim run ...

It is also possible to run specific tests, for example::

  $ cargo test -- basic_revert

which will run only the `basic_revert` test.