diff options
author | Dylan Reid <dgreid@chromium.org> | 2019-03-26 14:24:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-28 02:11:02 -0700 |
commit | 3d00b70eb53d1f89ff348346fb91600c54f7f7e8 (patch) | |
tree | e3fdadf4981fa64ea798b761782f2de804587420 | |
parent | cb5573ba198ddfaa2f41ce72a8de95a75f0393f2 (diff) | |
download | crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.tar crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.tar.gz crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.tar.bz2 crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.tar.lz crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.tar.xz crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.tar.zst crosvm-3d00b70eb53d1f89ff348346fb91600c54f7f7e8.zip |
Revert "qcow_utils: Add tests"
This test breaks the asan builders BUG=945423 This reverts commit fbbcf7ad1457b5daff1be151793441006f186683. Signed-off-by: Dylan Reid <dgreid@chromium.org> Change-Id: I4db9720118ea6e3002045fad997774ab84d3b59a Reviewed-on: https://chromium-review.googlesource.com/1540339 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
-rw-r--r-- | Cargo.lock | 10 | ||||
-rw-r--r-- | qcow_utils/Cargo.toml | 3 | ||||
-rw-r--r-- | qcow_utils/tests/client.rs | 10 | ||||
-rw-r--r-- | qcow_utils/tests/create.c | 9 | ||||
-rw-r--r-- | qcow_utils/tests/qcow_utils_test/Cargo.toml | 12 | ||||
-rw-r--r-- | qcow_utils/tests/qcow_utils_test/utils_test.rs | 76 |
6 files changed, 0 insertions, 120 deletions
diff --git a/Cargo.lock b/Cargo.lock index b6a1360..f22dcd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -391,20 +391,10 @@ dependencies = [ "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "qcow 0.1.0", - "qcow_utils_test 0.1.0", "sys_util 0.1.0", ] [[package]] -name = "qcow_utils_test" -version = "0.1.0" -dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "qcow_utils 0.1.0", - "tempdir 0.3.7", -] - -[[package]] name = "quote" version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/qcow_utils/Cargo.toml b/qcow_utils/Cargo.toml index 8c262b2..ca7e860 100644 --- a/qcow_utils/Cargo.toml +++ b/qcow_utils/Cargo.toml @@ -16,6 +16,3 @@ getopts = "*" libc = "*" qcow = { path = "../qcow" } sys_util = { path = "../sys_util" } - -[dev-dependencies] -qcow_utils_test = { path = "tests/qcow_utils_test" } diff --git a/qcow_utils/tests/client.rs b/qcow_utils/tests/client.rs deleted file mode 100644 index 5d15210..0000000 --- a/qcow_utils/tests/client.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2018 The Chromium OS Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -extern crate qcow_utils_test; - -#[test] -fn test_create() { - qcow_utils_test::run_c_test(include_str!("create.c")); -} diff --git a/qcow_utils/tests/create.c b/qcow_utils/tests/create.c deleted file mode 100644 index 77b5957..0000000 --- a/qcow_utils/tests/create.c +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018 The Chromium OS Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "qcow_utils.h" - -int main(int argc, char **argv) { - return create_qcow_with_size("/tmp/test.qcow2", 1024*1024*100); -} diff --git a/qcow_utils/tests/qcow_utils_test/Cargo.toml b/qcow_utils/tests/qcow_utils_test/Cargo.toml deleted file mode 100644 index 402a047..0000000 --- a/qcow_utils/tests/qcow_utils_test/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "qcow_utils_test" -version = "0.1.0" -authors = ["The Chromium OS Authors"] - -[lib] -path = "utils_test.rs" - -[dependencies] -libc = "*" -qcow_utils = { path = "../.." } -tempdir = { path = "../../../tempdir" } diff --git a/qcow_utils/tests/qcow_utils_test/utils_test.rs b/qcow_utils/tests/qcow_utils_test/utils_test.rs deleted file mode 100644 index 564ea8a..0000000 --- a/qcow_utils/tests/qcow_utils_test/utils_test.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2019 The Chromium OS Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -extern crate tempdir; - -use tempdir::TempDir; - -use std::env::{current_exe, var_os}; -use std::ffi::OsString; -use std::io::Write; -use std::path::{Path, PathBuf}; -use std::process::{Command, Stdio}; -use std::thread::sleep; -use std::time::Duration; - -fn get_crosvm_path() -> PathBuf { - let mut crosvm_path = current_exe() - .ok() - .map(|mut path| { - path.pop(); - path - }) - .expect("failed to get crosvm binary directory"); - crosvm_path.push("crosvm"); - crosvm_path -} - -fn build_test(src: &str) -> TempDir { - let mut libqcow_utils = get_crosvm_path(); - libqcow_utils.set_file_name("libqcow_utils.so"); - - let temp_dir = TempDir::new("qcow_util_test").expect("Failed to make temporary directory"); - let out_bin_file = PathBuf::from(temp_dir.path()).join("target"); - let mut child = Command::new(var_os("CC").unwrap_or(OsString::from("cc"))) - .args(&["-Isrc", "-pthread", "-o"]) - .arg(&out_bin_file) - .arg(libqcow_utils) - .args(&["-xc", "-"]) - .stdin(Stdio::piped()) - .spawn() - .expect("failed to spawn compiler"); - { - let stdin = child.stdin.as_mut().expect("failed to open stdin"); - stdin - .write_all(src.as_bytes()) - .expect("failed to write source to stdin"); - } - - let status = child.wait().expect("failed to wait for compiler"); - assert!(status.success(), "failed to build test"); - - temp_dir -} - -fn run_test(bin_path: &Path) { - let mut child = Command::new(PathBuf::from(bin_path).join("target")) - .spawn() - .expect("failed to spawn test"); - for _ in 0..12 { - match child.try_wait().expect("failed to wait for test") { - Some(status) => { - assert!(status.success(), "Test returned failure."); - return; - } - None => sleep(Duration::from_millis(100)), - } - } - child.kill().expect("failed to kill test"); - panic!("test subprocess has timed out"); -} - -pub fn run_c_test(src: &str) { - let bin_path = build_test(src); - run_test(bin_path.path()); -} |