Remove unnecessary external dependencies.

The main libcretonne crate should not have any external dependencies if
at all possible. Use simple substring matching instead of regular
expressions in the verifier tests to achieve this.

The tools crate no longer depends directly on glob and regex. It still
has an indirect dependency on regex through libfilecheck.
This commit is contained in:
Jakob Stoklund Olesen
2016-09-16 16:34:50 -07:00
parent a98d6e5256
commit dd9696e294
4 changed files with 7 additions and 20 deletions

View File

@@ -13,4 +13,7 @@ name = "cretonne"
path = "lib.rs"
[dependencies]
regex = "0.1.71"
# It is a goal of the cretonne crate to have minimal external dependencies.
# Please don't add any unless they are essential to the task of creating binary
# machine code. Integration tests that need external dependencies can be
# accomodated in src/tools/tests.

View File

@@ -165,22 +165,18 @@ impl<'a> Verifier<'a> {
#[cfg(test)]
mod tests {
extern crate regex;
use super::*;
use ir::Function;
use ir::instructions::{InstructionData, Opcode};
use ir::types;
use self::regex::Regex;
macro_rules! assert_err_with_msg {
($e:expr, $msg:expr) => (
let err_re = Regex::new($msg).unwrap();
match $e {
Ok(_) => { panic!("Expected an error!") },
Err(Error { location, message } ) => {
if !err_re.is_match(&message) {
panic!(format!("'{}' did not contain the pattern '{}'", message, $msg));
Err(Error { message, .. } ) => {
if !message.contains($msg) {
panic!(format!("'{}' did not contain the substring '{}'", message, $msg));
}
}
}

View File

@@ -6,8 +6,6 @@ dependencies = [
"cretonne-reader 0.0.0",
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
"filecheck 0.0.0",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -22,9 +20,6 @@ dependencies = [
[[package]]
name = "cretonne"
version = "0.0.0"
dependencies = [
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cretonne-reader"
@@ -50,11 +45,6 @@ dependencies = [
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glob"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "kernel32-sys"
version = "0.2.2"

View File

@@ -15,5 +15,3 @@ cretonne-reader = { path = "../libreader" }
filecheck = { path = "../libfilecheck" }
docopt = "0.6.80"
rustc-serialize = "0.3.19"
regex = "0.1.71"
glob = "0.2.11"