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/src/lib.rs b/sim/src/lib.rs
index 3f3967d..fe2d52e 100644
--- a/sim/src/lib.rs
+++ b/sim/src/lib.rs
@@ -58,7 +58,7 @@
 #[derive(Copy, Clone, Debug, Deserialize)]
 pub enum DeviceName { Stm32f4, K64f, K64fBig, Nrf52840 }
 
-static ALL_DEVICES: &'static [DeviceName] = &[
+pub static ALL_DEVICES: &'static [DeviceName] = &[
     DeviceName::Stm32f4,
     DeviceName::K64f,
     DeviceName::K64fBig,
@@ -152,20 +152,20 @@
     }
 }
 
-struct RunStatus {
+pub struct RunStatus {
     failures: usize,
     passes: usize,
 }
 
 impl RunStatus {
-    fn new() -> RunStatus {
+    pub fn new() -> RunStatus {
         RunStatus {
             failures: 0,
             passes: 0,
         }
     }
 
-    fn run_single(&mut self, device: DeviceName, align: u8) {
+    pub fn run_single(&mut self, device: DeviceName, align: u8) {
         warn!("Running on device {} with alignment {}", device, align);
 
         let (mut flash, areadesc) = make_device(device, align);
@@ -249,6 +249,10 @@
             self.passes += 1;
         }
     }
+
+    pub fn failures(&self) -> usize {
+        self.failures
+    }
 }
 
 /// Build the Flash and area descriptor for a given device.