1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Conditionally compile test modules

This commit is contained in:
Knight 2016-06-12 15:02:05 +08:00
parent e87407f598
commit 1695441880
3 changed files with 80 additions and 56 deletions

View file

@ -202,7 +202,7 @@ endef
define TEST_INTEGRATION define TEST_INTEGRATION
test_integration_$(1): build_exe_$(1) test_integration_$(1): build_exe_$(1)
${CARGO} test ${CARGOFLAGS} --test $(1) --features "$(1) $(TEST_SPEC_FEATURE)" --no-default-features $(TEST_NO_FAIL_FAST) ${CARGO} test ${CARGOFLAGS} --features "$(1) $(TEST_SPEC_FEATURE)" --no-default-features $(TEST_NO_FAIL_FAST)
endef endef
define TEST_BUSYBOX define TEST_BUSYBOX

View file

@ -3,7 +3,7 @@ extern crate uu_tail;
use common::util::*; use common::util::*;
use std::char::from_digit; use std::char::from_digit;
use std::io::Write; use std::io::Write;
use uu_tail::parse_size; use self::uu_tail::parse_size;
static UTIL_NAME: &'static str = "tail"; static UTIL_NAME: &'static str = "tail";

View file

@ -4,7 +4,6 @@ extern crate rand;
extern crate regex; extern crate regex;
extern crate tempdir; extern crate tempdir;
extern crate time; extern crate time;
extern crate uu_tail;
#[cfg(windows)] extern crate kernel32; #[cfg(windows)] extern crate kernel32;
#[cfg(windows)] extern crate winapi; #[cfg(windows)] extern crate winapi;
@ -15,57 +14,82 @@ mod common;
#[path="../src/factor/sieve.rs"] #[path="../src/factor/sieve.rs"]
mod sieve; mod sieve;
#[cfg(unix)] mod test_chmod; // For conditional compilation
#[cfg(unix)] mod test_mv; macro_rules! unix_only {
#[cfg(unix)] mod test_pathchk; ($($fea:expr, $m:ident);+) => {
#[cfg(unix)] mod test_stdbuf; $(
#[cfg(unix)] mod test_touch; #[cfg(unix)]
#[cfg(unix)] mod test_unlink; #[cfg(feature = $fea)]
#[cfg(unix)] mod test_stat; mod $m;
)+
};
}
unix_only! {
"chmod", test_chmod;
"mv", test_mv;
"pathchk", test_pathchk;
"stdbuf", test_stdbuf;
"touch", test_touch;
"unlink", test_unlink;
// Be aware of the trailing semicolon after the last item
"stat", test_stat
}
mod test_base64;
mod test_basename; macro_rules! generic {
mod test_cat; ($($fea:expr, $m:ident);+) => {
mod test_cksum; $(
mod test_comm; #[cfg(feature = $fea)]
mod test_cp; mod $m;
mod test_cut; )+
mod test_dircolors; };
mod test_dirname; }
mod test_echo; generic! {
mod test_env; "base64", test_base64;
mod test_expr; "basename", test_basename;
mod test_factor; "cat", test_cat;
mod test_false; "cksum", test_cksum;
mod test_fold; "comm", test_comm;
mod test_hashsum; "cp", test_cp;
mod test_head; "cut", test_cut;
mod test_link; "dircolors", test_dircolors;
mod test_ln; "dirname", test_dirname;
mod test_ls; "echo", test_echo;
mod test_mkdir; "env", test_env;
mod test_mktemp; "expr", test_expr;
mod test_nl; "factor", test_factor;
mod test_od; "false", test_false;
mod test_paste; "fold", test_fold;
mod test_printf; "hashsum", test_hashsum;
mod test_ptx; "head", test_head;
mod test_pwd; "link", test_link;
mod test_readlink; "ln", test_ln;
mod test_realpath; "ls", test_ls;
mod test_rm; "mkdir", test_mkdir;
mod test_rmdir; "mktemp", test_mktemp;
mod test_seq; "nl", test_nl;
mod test_sort; "od", test_od;
mod test_split; "paste", test_paste;
mod test_sum; "printf", test_printf;
mod test_tac; "ptx", test_ptx;
mod test_tail; "pwd", test_pwd;
mod test_test; "readlink", test_readlink;
mod test_tr; "realpath", test_realpath;
mod test_true; "rm", test_rm;
mod test_truncate; "rmdir", test_rmdir;
mod test_tsort; "seq", test_seq;
mod test_unexpand; "sort", test_sort;
mod test_uniq; "split", test_split;
mod test_wc; "sum", test_sum;
"tac", test_tac;
"tail", test_tail;
"test", test_test;
"tr", test_tr;
"true", test_true;
"truncate", test_truncate;
"tsort", test_tsort;
"unexpand", test_unexpand;
"uniq", test_uniq;
// Be aware of the trailing semicolon after the last item
"wc", test_wc
}