blob: d07bc111a73d4e3f89518b4839f68f1b51ce8b56 [file] [log] [blame]
David Brown841d73a2017-01-09 12:23:09 -07001MCUboot Simulator
2#################
3
4This is a small simulator designed to exercise the mcuboot upgrade
5code, specifically testing untimely reset scenarios to make sure the
6code is robust.
7
8Prerequisites
9=============
10
11The simulator is written in Rust_, and you will need to install it to
12build it. The installation_ page describes this process. The
13simulator can be built with the stable release of Rust.
14
15.. _Rust: https://www.rust-lang.org/
16
17.. _installation: https://www.rust-lang.org/en-US/install.html
18
David Brown9600ec82017-07-21 08:28:28 -060019Dependent code
20--------------
21
22The simulator depends on some external modules. These are stored as
23submodules within git. To fetch these dependencies the first time::
24
David Browna3a96fe2020-05-11 14:08:53 -060025 $ git submodule update --init --recursive
David Brown9600ec82017-07-21 08:28:28 -060026
27will clone and check out these trees in the appropriate place.
28
David Brownda21ad72017-11-07 00:42:09 -070029Testing
30=======
David Brown841d73a2017-01-09 12:23:09 -070031
David Brownda21ad72017-11-07 00:42:09 -070032The tests are written as unit tests in Rust, and can be built and run
33automatically::
David Brown841d73a2017-01-09 12:23:09 -070034
David Brownda21ad72017-11-07 00:42:09 -070035 $ cargo test
David Brown841d73a2017-01-09 12:23:09 -070036
37this should download and compile the necessary dependencies, compile
David Brownda21ad72017-11-07 00:42:09 -070038the relevant modules from mcuboot, build the simulator, and run the
39tests.
David Brown841d73a2017-01-09 12:23:09 -070040
Marti Bolivar4ec7f762018-04-25 17:22:55 -040041There are several different features you can test. For example,
42testing RSA signatures can be done with::
43
44 $ cargo test --features sig-rsa
45
46For a complete list of features, see Cargo.toml.
47
David Brown841d73a2017-01-09 12:23:09 -070048Debugging
49=========
50
51If the simulator indicates a failure, you can turn on additional
52logging by setting ``RUST_LOG=warn`` or ``RUST_LOG=error`` in the
53environment::
54
55 $ RUST_LOG=warn ./target/release/bootsim run ...
David Brownda21ad72017-11-07 00:42:09 -070056
57It is also possible to run specific tests, for example::
58
59 $ cargo test -- basic_revert
60
61which will run only the `basic_revert` test.