mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-12 08:40:54 +00:00
fix warning and bit rotted tests uncovered by kokoro
TEST=run kokoro presubmit BUG=None Change-Id: I301551f8f58263f1a8b7a8276867881cb17517ab Reviewed-on: https://chromium-review.googlesource.com/1236889 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
parent
0a4f280e3a
commit
a1422e6bca
7 changed files with 27 additions and 14 deletions
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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_先輩 {
|
||||
|
|
|
@ -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(());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,16 @@ impl Drop for RemovePath {
|
|||
}
|
||||
|
||||
fn get_target_path() -> PathBuf {
|
||||
current_exe()
|
||||
.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| {
|
||||
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue