summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--devices/src/pci/pci_configuration.rs3
-rw-r--r--gpu_buffer/src/lib.rs2
-rw-r--r--gpu_display/examples/simple.rs2
-rw-r--r--io_jail/src/lib.rs14
-rw-r--r--p9/wire_format_derive/wire_format_derive.rs4
-rw-r--r--src/main.rs2
-rw-r--r--tests/plugins.rs14
7 files changed, 27 insertions, 14 deletions
diff --git a/devices/src/pci/pci_configuration.rs b/devices/src/pci/pci_configuration.rs
index 770d1e9..0030c5e 100644
--- a/devices/src/pci/pci_configuration.rs
+++ b/devices/src/pci/pci_configuration.rs
@@ -332,12 +332,13 @@ impl PciConfiguration {
 
 #[cfg(test)]
 mod tests {
-    use data_model::{DataInit, Le32};
+    use data_model::DataInit;
 
     use super::*;
 
     #[repr(packed)]
     #[derive(Clone, Copy)]
+    #[allow(dead_code)]
     struct TestCap {
         len: u8,
         foo: u8,
diff --git a/gpu_buffer/src/lib.rs b/gpu_buffer/src/lib.rs
index dcabc9d..aa57ea9 100644
--- a/gpu_buffer/src/lib.rs
+++ b/gpu_buffer/src/lib.rs
@@ -746,7 +746,7 @@ mod tests {
         assert_eq!(f.bytes_per_pixel(1), None);
         let f = Format::new(b'N', b'V', b'1', b'2');
         assert_eq!(f.bytes_per_pixel(0), Some(1));
-        assert_eq!(f.bytes_per_pixel(1), Some(2));
+        assert_eq!(f.bytes_per_pixel(1), Some(1));
         assert_eq!(f.bytes_per_pixel(2), None);
         let f = Format::new(b'R', b'8', b' ', b' ');
         assert_eq!(f.bytes_per_pixel(0), Some(1));
diff --git a/gpu_display/examples/simple.rs b/gpu_display/examples/simple.rs
index 2ca9ab7..e3499f8 100644
--- a/gpu_display/examples/simple.rs
+++ b/gpu_display/examples/simple.rs
@@ -3,7 +3,7 @@ extern crate gpu_display;
 use gpu_display::*;
 
 fn main() {
-    let mut disp = GpuDisplay::new().unwrap();
+    let mut disp = GpuDisplay::new("/run/wayland-0").unwrap();
     let surface_id = disp.create_surface(None, 1280, 1024).unwrap();
     while !disp.close_requested(surface_id) {
         disp.dispatch_events();
diff --git a/io_jail/src/lib.rs b/io_jail/src/lib.rs
index b6f0aea..e711b30 100644
--- a/io_jail/src/lib.rs
+++ b/io_jail/src/lib.rs
@@ -497,14 +497,12 @@ impl Minijail {
     /// This Function may abort in the child on error because a partially
     /// entered jail isn't recoverable.
     pub unsafe fn fork(&self, inheritable_fds: Option<&[RawFd]>) -> Result<pid_t> {
-        // This test will fail during `cargo test` because the test harness always spawns a test
-        // thread. We will make an exception for that case because the tests for this module should
-        // always be run in a serial fashion using `--test-threads=1`.
-        #[cfg(not(test))]
-        {
-            if !is_single_threaded().map_err(Error::CheckingMultiThreaded)? {
-                return Err(Error::ForkingWhileMultiThreaded);
-            }
+        if !is_single_threaded().map_err(Error::CheckingMultiThreaded)? {
+            // This test will fail during `cargo test` because the test harness always spawns a test
+            // thread. We will make an exception for that case because the tests for this module
+            // should always be run in a serial fashion using `--test-threads=1`.
+            #[cfg(not(test))]
+            return Err(Error::ForkingWhileMultiThreaded);
         }
 
         if let Some(keep_fds) = inheritable_fds {
diff --git a/p9/wire_format_derive/wire_format_derive.rs b/p9/wire_format_derive/wire_format_derive.rs
index c3d104f..5268b92 100644
--- a/p9/wire_format_derive/wire_format_derive.rs
+++ b/p9/wire_format_derive/wire_format_derive.rs
@@ -55,6 +55,8 @@ fn p9_wire_format_inner(input: DeriveInput) -> Tokens {
             use self::std::io;
             use self::std::result::Result::Ok;
 
+            use super::#name;
+
             #import
 
             impl #wire_format for #name {
@@ -262,6 +264,8 @@ mod tests {
                 use self::std::io;
                 use self::std::result::Result::Ok;
 
+                use super::Niijima_先輩;
+
                 use protocol::WireFormat;
 
                 impl WireFormat for Niijima_先輩 {
diff --git a/src/main.rs b/src/main.rs
index de93f1b..8e065ed 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -626,7 +626,7 @@ fn print_usage() {
 
 fn crosvm_main() -> std::result::Result<(), ()> {
     if let Err(e) = syslog::init() {
-        println!("failed to initiailize syslog: {:?}", e);
+        println!("failed to initialize syslog: {:?}", e);
         return Err(());
     }
 
diff --git a/tests/plugins.rs b/tests/plugins.rs
index 987b033..67e68e6 100644
--- a/tests/plugins.rs
+++ b/tests/plugins.rs
@@ -35,6 +35,16 @@ fn get_target_path() -> PathBuf {
         .ok()
         .map(|mut path| {
                  path.pop();
+                 path
+             })
+        .expect("failed to get crosvm binary directory")
+}
+
+fn get_crosvm_path() -> PathBuf {
+    current_exe()
+        .ok()
+        .map(|mut path| {
+                 path.pop();
                  if path.ends_with("deps") {
                      path.pop();
                  }
@@ -44,8 +54,8 @@ fn get_target_path() -> PathBuf {
 }
 
 fn build_plugin(src: &str) -> RemovePath {
-    let mut out_bin = PathBuf::from("target");
     let libcrosvm_plugin_dir = get_target_path();
+    let mut out_bin = libcrosvm_plugin_dir.clone();
     out_bin.push(thread_rng()
                      .gen_ascii_chars()
                      .take(10)
@@ -77,7 +87,7 @@ fn build_plugin(src: &str) -> RemovePath {
 }
 
 fn run_plugin(bin_path: &Path, with_sandbox: bool) {
-    let mut crosvm_path = get_target_path();
+    let mut crosvm_path = get_crosvm_path();
     crosvm_path.push("crosvm");
     let mut cmd = Command::new(crosvm_path);
     cmd.args(&["run",