sim: Run main test as a Rust unit test
As a start of doing the testing using Rust/Cargo's test framework, write
a test runner that just runs the existing tests. They run as they do
now, except that there is an assertion that there were no failures.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/tests/core.rs b/sim/tests/core.rs
new file mode 100644
index 0000000..dea9cfe
--- /dev/null
+++ b/sim/tests/core.rs
@@ -0,0 +1,20 @@
+//! Core tests
+//!
+//! Run the existing testsuite as a Rust unit test.
+
+extern crate bootsim;
+
+use bootsim::{ALL_DEVICES, RunStatus};
+
+#[test]
+fn core_tests() {
+ let mut status = RunStatus::new();
+
+ for &dev in ALL_DEVICES {
+ for &align in &[1, 2, 4, 8] {
+ status.run_single(dev, align);
+ }
+ }
+
+ assert!(status.failures() == 0);
+}