From 6982d66a595a5078ae5383b071ba5d4739bb5bd4 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Wed, 17 May 2017 18:15:21 +0200 Subject: [PATCH] Enable 64bit vs 32bit tests --- tests/examples.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/examples.rs b/tests/examples.rs index 0b77b993f..3e05f42bc 100644 --- a/tests/examples.rs +++ b/tests/examples.rs @@ -1,6 +1,9 @@ #[macro_use] extern crate duct; +use std::io::{BufRead, BufReader}; +use std::fs::File; + #[test] fn examples() { let mut error = false; @@ -10,6 +13,16 @@ fn examples() { if file.extension().map_or(true, |file| file != "rs") { continue; } + print!("testing {}... ", file.file_stem().unwrap().to_str().unwrap()); + let skip = BufReader::new(File::open(&file).unwrap()).lines().any(|line| { + let line = line.as_ref().unwrap().trim(); + line == "// ignore-x86" && cfg!(target_pointer_width = "32") || + line == "// ignore-x86_64" && cfg!(target_pointer_width = "64") + }); + if skip { + println!("skipping"); + continue; + } cmd!("touch", &file).run().unwrap(); let output = file.with_extension("stderr"); cmd!("cargo", "rustc", "-q", "--example", file.file_stem().unwrap(), "--", "-Dwarnings", @@ -22,7 +35,6 @@ fn examples() { .dir("clippy_tests") .run() .unwrap(); - print!("testing {}... ", file.file_stem().unwrap().to_str().unwrap()); if cmd!("git", "diff", "--exit-code", output).run().is_err() { error = true; println!("ERROR");