librustdoc: De-export compiletest, combine-tests, libcargo, libfuzzer, and librustdoc. rs=deexporting

This commit is contained in:
Patrick Walton
2013-01-30 14:10:03 -08:00
parent d73bf62952
commit 83ced67d0b
19 changed files with 213 additions and 256 deletions

View File

@@ -12,16 +12,15 @@ use core::prelude::*;
use cmp;
enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }
impl mode : cmp::Eq {
pure fn eq(&self, other: &mode) -> bool {
(*other) as int == (*self) as int
}
pure fn ne(&self, other: &mode) -> bool { !(*self).eq(other) }
#[deriving_eq]
pub enum mode {
mode_compile_fail,
mode_run_fail,
mode_run_pass,
mode_pretty,
}
type config = {
pub type config = {
// The library paths required for running the compiler
compile_lib_path: ~str,

View File

@@ -11,7 +11,6 @@
#[crate_type = "bin"];
#[no_core];
#[legacy_exports];
#[legacy_records];
#[allow(vecs_implicitly_copyable)];
@@ -24,17 +23,11 @@ extern mod std(vers = "0.6");
use core::*;
#[legacy_exports]
mod procsrv;
#[legacy_exports]
mod util;
#[legacy_exports]
mod header;
#[legacy_exports]
mod runtest;
#[legacy_exports]
mod common;
#[legacy_exports]
mod errors;
use std::getopts;
@@ -51,14 +44,14 @@ use common::mode_pretty;
use common::mode;
use util::logv;
fn main() {
pub fn main() {
let args = os::args();
let config = parse_config(args);
log_config(config);
run_tests(config);
}
fn parse_config(args: ~[~str]) -> config {
pub fn parse_config(args: ~[~str]) -> config {
let opts =
~[getopts::reqopt(~"compile-lib-path"),
getopts::reqopt(~"run-lib-path"),
@@ -105,7 +98,7 @@ fn parse_config(args: ~[~str]) -> config {
verbose: getopts::opt_present(matches, ~"verbose")};
}
fn log_config(config: config) {
pub fn log_config(config: config) {
let c = config;
logv(c, fmt!("configuration:"));
logv(c, fmt!("compile_lib_path: %s", config.compile_lib_path));
@@ -124,15 +117,15 @@ fn log_config(config: config) {
logv(c, fmt!("\n"));
}
fn opt_str(maybestr: Option<~str>) -> ~str {
pub fn opt_str(maybestr: Option<~str>) -> ~str {
match maybestr { option::Some(s) => s, option::None => ~"(none)" }
}
fn str_opt(maybestr: ~str) -> Option<~str> {
pub fn str_opt(maybestr: ~str) -> Option<~str> {
if maybestr != ~"(none)" { option::Some(maybestr) } else { option::None }
}
fn str_mode(s: ~str) -> mode {
pub fn str_mode(s: ~str) -> mode {
match s {
~"compile-fail" => mode_compile_fail,
~"run-fail" => mode_run_fail,
@@ -142,7 +135,7 @@ fn str_mode(s: ~str) -> mode {
}
}
fn mode_str(mode: mode) -> ~str {
pub fn mode_str(mode: mode) -> ~str {
match mode {
mode_compile_fail => ~"compile-fail",
mode_run_fail => ~"run-fail",
@@ -151,14 +144,14 @@ fn mode_str(mode: mode) -> ~str {
}
}
fn run_tests(config: config) {
pub fn run_tests(config: config) {
let opts = test_opts(config);
let tests = make_tests(config);
let res = test::run_tests_console(&opts, tests);
if !res { fail ~"Some tests failed"; }
}
fn test_opts(config: config) -> test::TestOpts {
pub fn test_opts(config: config) -> test::TestOpts {
test::TestOpts {
filter: config.filter,
run_ignored: config.run_ignored,
@@ -166,7 +159,7 @@ fn test_opts(config: config) -> test::TestOpts {
}
}
fn make_tests(config: config) -> ~[test::TestDesc] {
pub fn make_tests(config: config) -> ~[test::TestDesc] {
debug!("making tests from %s",
config.src_base.to_str());
let mut tests = ~[];
@@ -180,7 +173,7 @@ fn make_tests(config: config) -> ~[test::TestDesc] {
move tests
}
fn is_test(config: config, testfile: &Path) -> bool {
pub fn is_test(config: config, testfile: &Path) -> bool {
// Pretty-printer does not work with .rc files yet
let valid_extensions =
match config.mode {
@@ -203,7 +196,7 @@ fn is_test(config: config, testfile: &Path) -> bool {
return valid;
}
fn make_test(config: config, testfile: &Path) ->
pub fn make_test(config: config, testfile: &Path) ->
test::TestDesc {
test::TestDesc {
name: make_test_name(config, testfile),
@@ -213,11 +206,11 @@ fn make_test(config: config, testfile: &Path) ->
}
}
fn make_test_name(config: config, testfile: &Path) -> ~str {
pub fn make_test_name(config: config, testfile: &Path) -> ~str {
fmt!("[%s] %s", mode_str(config.mode), testfile.to_str())
}
fn make_test_closure(config: config, testfile: &Path) -> test::TestFn {
pub fn make_test_closure(config: config, testfile: &Path) -> test::TestFn {
let testfile = testfile.to_str();
fn~() { runtest::run(config, testfile) }
}

View File

@@ -15,13 +15,10 @@ use io;
use io::ReaderUtil;
use str;
export load_errors;
export ExpectedError;
struct ExpectedError { line: uint, kind: ~str, msg: ~str }
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
// Load any test directives embedded in the file
fn load_errors(testfile: &Path) -> ~[ExpectedError] {
pub fn load_errors(testfile: &Path) -> ~[ExpectedError] {
let mut error_patterns = ~[];
let rdr = io::file_reader(testfile).get();
let mut line_num = 1u;

View File

@@ -17,11 +17,7 @@ use io::ReaderUtil;
use os;
use str;
export TestProps;
export load_props;
export is_test_ignored;
struct TestProps {
pub struct TestProps {
// Lines that should be expected, in order, on standard out
error_patterns: ~[~str],
// Extra flags to pass to the compiler
@@ -36,7 +32,7 @@ struct TestProps {
}
// Load any test directives embedded in the file
fn load_props(testfile: &Path) -> TestProps {
pub fn load_props(testfile: &Path) -> TestProps {
let mut error_patterns = ~[];
let mut aux_builds = ~[];
let mut exec_env = ~[];
@@ -73,7 +69,7 @@ fn load_props(testfile: &Path) -> TestProps {
};
}
fn is_test_ignored(config: config, testfile: &Path) -> bool {
pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
let mut found = false;
for iter_header(testfile) |ln| {
if parse_name_directive(ln, ~"xfail-test") { return true; }

View File

@@ -22,8 +22,6 @@ use str;
use task;
use vec;
export run;
#[cfg(target_os = "win32")]
fn target_env(lib_path: ~str, prog: ~str) -> ~[(~str,~str)] {
@@ -54,12 +52,11 @@ fn target_env(_lib_path: ~str, _prog: ~str) -> ~[(~str,~str)] {
struct Result {status: int, out: ~str, err: ~str}
// FIXME (#2659): This code is duplicated in core::run::program_output
fn run(lib_path: ~str,
prog: ~str,
args: ~[~str],
env: ~[(~str, ~str)],
input: Option<~str>) -> Result {
pub fn run(lib_path: ~str,
prog: ~str,
args: ~[~str],
env: ~[(~str, ~str)],
input: Option<~str>) -> Result {
let pipe_in = os::pipe();
let pipe_out = os::pipe();
let pipe_err = os::pipe();

View File

@@ -31,9 +31,7 @@ use procsrv;
use util;
use util::logv;
export run;
fn run(config: config, testfile: ~str) {
pub fn run(config: config, testfile: ~str) {
if config.verbose {
// We're going to be dumping a lot of info. Start on a new line.
io::stdout().write_str(~"\n\n");

View File

@@ -17,7 +17,7 @@ use os::getenv;
use common;
use common::config;
fn make_new_path(path: ~str) -> ~str {
pub fn make_new_path(path: ~str) -> ~str {
// Windows just uses PATH as the library search path, so we have to
// maintain the current value while adding our own
@@ -31,23 +31,23 @@ fn make_new_path(path: ~str) -> ~str {
#[cfg(target_os = "linux")]
#[cfg(target_os = "freebsd")]
fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
pub fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
#[cfg(target_os = "macos")]
fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
pub fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
#[cfg(target_os = "win32")]
fn lib_path_env_var() -> ~str { ~"PATH" }
pub fn lib_path_env_var() -> ~str { ~"PATH" }
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
fn path_div() -> ~str { ~":" }
pub fn path_div() -> ~str { ~":" }
#[cfg(target_os = "win32")]
fn path_div() -> ~str { ~";" }
pub fn path_div() -> ~str { ~";" }
fn logv(config: config, s: ~str) {
pub fn logv(config: config, s: ~str) {
log(debug, s);
if config.verbose { io::println(s); }
}