Skip to content

Complete Path rewrite #9655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Oct 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d202834
Initial sketching out of the new path module
lilyball Aug 24, 2013
e97d616
path2: Implement PosixPath
lilyball Aug 24, 2013
b413913
path2: Start reimplementing in terms of ~[u8] instead of ~str
lilyball Aug 26, 2013
550bc9b
path2: Reimplement PosixPath in terms of ~[u8]
lilyball Aug 26, 2013
f0fc065
path2: Update all the tests for the new [u8]-based approach
lilyball Aug 26, 2013
17ca6f0
path2: Add tests for the [u8]-based methods
lilyball Aug 26, 2013
6d29142
path2: Extract posix/windows into their own files
lilyball Sep 1, 2013
6f5b809
path2: Add more tests to posix impl
lilyball Sep 2, 2013
3d80a2f
path2: Update for changes from master
lilyball Oct 1, 2013
f25835c
path2: Implement WindowsPath
lilyball Aug 27, 2013
c16d7a4
path2: Rename Path::new() to Path::from_vec()
lilyball Sep 26, 2013
1dfe508
path2: Add opt variants for from_vec/from_str
lilyball Sep 26, 2013
33adf6d
path2: Implement .as_display_str() and .to_display_str()
lilyball Sep 26, 2013
7fcdcae
path2: Implement IterBytes for Path
lilyball Sep 26, 2013
56b96a3
path2: Implement stat support
lilyball Sep 26, 2013
179f50f
path2: Rename pop_opt() to pop() and add each_parent()
lilyball Sep 26, 2013
3a2735c
path2: Convert typedefs to `pub use`s
lilyball Sep 27, 2013
6741241
path2: Add format helpers .display() and .filename_display()
lilyball Oct 1, 2013
73d3d00
path2: Replace the path module outright
lilyball Sep 27, 2013
b8af653
path2: Update asserts for new format!() style
lilyball Oct 2, 2013
e65d33e
path2: Update for loop -> continue
lilyball Oct 3, 2013
eaec8a7
path2: Write a few paragraphs of module documentation
lilyball Oct 3, 2013
ed539e1
path2: Remove Path::normalize()
lilyball Oct 3, 2013
d6d9b92
path2: Adjust the API to remove all the _str mutation methods
lilyball Oct 6, 2013
c01a97b
path2: Remove .with_display_str and friends
lilyball Oct 7, 2013
bab7eb2
path2: Update based on more review feedback
lilyball Oct 8, 2013
0c7e8f7
path2: Remove some API functions
lilyball Oct 10, 2013
40b324f
path2: Remove Path.into_str()
lilyball Oct 16, 2013
6eade9e
path2: Update for latest master
lilyball Oct 16, 2013
d108a22
path2: Update for privacy changes
lilyball Oct 16, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ pub fn parse_config(args: ~[~str]) -> config {
}

fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
Path(m.opt_str(nm).unwrap())
Path::new(m.opt_str(nm).unwrap())
}

config {
compile_lib_path: matches.opt_str("compile-lib-path").unwrap(),
run_lib_path: matches.opt_str("run-lib-path").unwrap(),
rustc_path: opt_path(matches, "rustc-path"),
clang_path: matches.opt_str("clang-path").map(|s| Path(s)),
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path(s)),
clang_path: matches.opt_str("clang-path").map(|s| Path::new(s)),
llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::new(s)),
src_base: opt_path(matches, "src-base"),
build_base: opt_path(matches, "build-base"),
aux_base: opt_path(matches, "aux-base"),
Expand All @@ -123,10 +123,10 @@ pub fn parse_config(args: ~[~str]) -> config {
} else {
None
},
logfile: matches.opt_str("logfile").map(|s| Path(s)),
save_metrics: matches.opt_str("save-metrics").map(|s| Path(s)),
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),
save_metrics: matches.opt_str("save-metrics").map(|s| Path::new(s)),
ratchet_metrics:
matches.opt_str("ratchet-metrics").map(|s| Path(s)),
matches.opt_str("ratchet-metrics").map(|s| Path::new(s)),
ratchet_noise_percent:
matches.opt_str("ratchet-noise-percent").and_then(|s| from_str::<f64>(s)),
runtool: matches.opt_str("runtool"),
Expand Down Expand Up @@ -155,9 +155,9 @@ pub fn log_config(config: &config) {
logv(c, format!("configuration:"));
logv(c, format!("compile_lib_path: {}", config.compile_lib_path));
logv(c, format!("run_lib_path: {}", config.run_lib_path));
logv(c, format!("rustc_path: {}", config.rustc_path.to_str()));
logv(c, format!("src_base: {}", config.src_base.to_str()));
logv(c, format!("build_base: {}", config.build_base.to_str()));
logv(c, format!("rustc_path: {}", config.rustc_path.display()));
logv(c, format!("src_base: {}", config.src_base.display()));
logv(c, format!("build_base: {}", config.build_base.display()));
logv(c, format!("stage_id: {}", config.stage_id));
logv(c, format!("mode: {}", mode_str(config.mode)));
logv(c, format!("run_ignored: {}", config.run_ignored));
Expand Down Expand Up @@ -245,12 +245,12 @@ pub fn test_opts(config: &config) -> test::TestOpts {

pub fn make_tests(config: &config) -> ~[test::TestDescAndFn] {
debug2!("making tests from {}",
config.src_base.to_str());
config.src_base.display());
let mut tests = ~[];
let dirs = os::list_dir_path(&config.src_base);
for file in dirs.iter() {
let file = file.clone();
debug2!("inspecting file {}", file.to_str());
debug2!("inspecting file {}", file.display());
if is_test(config, &file) {
let t = do make_test(config, &file) {
match config.mode {
Expand All @@ -272,7 +272,7 @@ pub fn is_test(config: &config, testfile: &Path) -> bool {
_ => ~[~".rc", ~".rs"]
};
let invalid_prefixes = ~[~".", ~"#", ~"~"];
let name = testfile.filename().unwrap();
let name = testfile.filename_str().unwrap();

let mut valid = false;

Expand Down Expand Up @@ -303,9 +303,9 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {

// Try to elide redundant long paths
fn shorten(path: &Path) -> ~str {
let filename = path.filename();
let p = path.pop();
let dir = p.filename();
let filename = path.filename_str();
let p = path.dir_path();
let dir = p.filename_str();
format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or(""))
}

Expand All @@ -317,13 +317,15 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn {
use std::cell::Cell;
let config = Cell::new((*config).clone());
let testfile = Cell::new(testfile.to_str());
// FIXME (#9639): This needs to handle non-utf8 paths
let testfile = Cell::new(testfile.as_str().unwrap().to_owned());
test::DynTestFn(|| { runtest::run(config.take(), testfile.take()) })
}

pub fn make_metrics_test_closure(config: &config, testfile: &Path) -> test::TestFn {
use std::cell::Cell;
let config = Cell::new((*config).clone());
let testfile = Cell::new(testfile.to_str());
// FIXME (#9639): This needs to handle non-utf8 paths
let testfile = Cell::new(testfile.as_str().unwrap().to_owned());
test::DynMetricFn(|mm| { runtest::run_metrics(config.take(), testfile.take(), mm) })
}
4 changes: 2 additions & 2 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {

fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
match parse_name_value_directive(line, ~"pp-exact") {
Some(s) => Some(Path(s)),
Some(s) => Some(Path::new(s)),
None => {
if parse_name_directive(line, "pp-exact") {
Some(testfile.file_path())
testfile.filename().map(|s| Path::new(s))
} else {
None
}
Expand Down
Loading