David Brown | 841d73a | 2017-01-09 12:23:09 -0700 | [diff] [blame] | 1 | MCUboot Simulator |
| 2 | ################# |
| 3 | |
| 4 | This is a small simulator designed to exercise the mcuboot upgrade |
| 5 | code, specifically testing untimely reset scenarios to make sure the |
| 6 | code is robust. |
| 7 | |
| 8 | Prerequisites |
| 9 | ============= |
| 10 | |
| 11 | The simulator is written in Rust_, and you will need to install it to |
| 12 | build it. The installation_ page describes this process. The |
| 13 | simulator 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 Brown | 9600ec8 | 2017-07-21 08:28:28 -0600 | [diff] [blame] | 19 | Dependent code |
| 20 | -------------- |
| 21 | |
| 22 | The simulator depends on some external modules. These are stored as |
| 23 | submodules within git. To fetch these dependencies the first time:: |
| 24 | |
| 25 | $ git submodule update --init |
| 26 | |
| 27 | will clone and check out these trees in the appropriate place. |
| 28 | |
David Brown | da21ad7 | 2017-11-07 00:42:09 -0700 | [diff] [blame^] | 29 | Testing |
| 30 | ======= |
David Brown | 841d73a | 2017-01-09 12:23:09 -0700 | [diff] [blame] | 31 | |
David Brown | da21ad7 | 2017-11-07 00:42:09 -0700 | [diff] [blame^] | 32 | The tests are written as unit tests in Rust, and can be built and run |
| 33 | automatically:: |
David Brown | 841d73a | 2017-01-09 12:23:09 -0700 | [diff] [blame] | 34 | |
David Brown | da21ad7 | 2017-11-07 00:42:09 -0700 | [diff] [blame^] | 35 | $ cargo test |
David Brown | 841d73a | 2017-01-09 12:23:09 -0700 | [diff] [blame] | 36 | |
| 37 | this should download and compile the necessary dependencies, compile |
David Brown | da21ad7 | 2017-11-07 00:42:09 -0700 | [diff] [blame^] | 38 | the relevant modules from mcuboot, build the simulator, and run the |
| 39 | tests. |
David Brown | 841d73a | 2017-01-09 12:23:09 -0700 | [diff] [blame] | 40 | |
| 41 | Debugging |
| 42 | ========= |
| 43 | |
| 44 | If the simulator indicates a failure, you can turn on additional |
| 45 | logging by setting ``RUST_LOG=warn`` or ``RUST_LOG=error`` in the |
| 46 | environment:: |
| 47 | |
| 48 | $ RUST_LOG=warn ./target/release/bootsim run ... |
David Brown | da21ad7 | 2017-11-07 00:42:09 -0700 | [diff] [blame^] | 49 | |
| 50 | It is also possible to run specific tests, for example:: |
| 51 | |
| 52 | $ cargo test -- basic_revert |
| 53 | |
| 54 | which will run only the `basic_revert` test. |