Skip to content

Commit 549ba0e

Browse files
committed
---
yaml --- r: 83519 b: refs/heads/try c: b74663e h: refs/heads/master i: 83517: c622c38 83515: 2dd9526 83511: 0fc6df5 83503: 57527a7 83487: a2a8411 83455: 44feed3 v: v3
1 parent 3cfe245 commit 549ba0e

File tree

11 files changed

+62
-210
lines changed

11 files changed

+62
-210
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 96bdcd07fe9ec44fac8dedb2425ae7783e4108ce
5+
refs/heads/try: b74663e027521d351b5920e6ce95d5c58221cef5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/ringbuf.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,6 @@ impl<T> RingBuf<T> {
143143
}
144144
}
145145

146-
/// Swap elements at indices `i` and `j`
147-
///
148-
/// `i` and `j` may be equal.
149-
///
150-
/// Fails if there is no element with the given index
151-
pub fn swap(&mut self, i: uint, j: uint) {
152-
assert!(i < self.len());
153-
assert!(j < self.len());
154-
let ri = self.raw_index(i);
155-
let rj = self.raw_index(j);
156-
self.elts.swap(ri, rj);
157-
}
158-
159146
/// Return index in underlying vec for a given logical element index
160147
fn raw_index(&self, idx: uint) -> uint {
161148
raw_index(self.lo, self.elts.len(), idx)
@@ -617,14 +604,6 @@ mod tests {
617604
assert_eq!(d.elts.capacity(), 64);
618605
}
619606

620-
#[test]
621-
fn test_swap() {
622-
let mut d: RingBuf<int> = range(0, 5).collect();
623-
d.pop_front();
624-
d.swap(0, 3);
625-
assert_eq!(d.iter().map(|&x|x).collect::<~[int]>(), ~[4, 2, 3, 1]);
626-
}
627-
628607
#[test]
629608
fn test_iter() {
630609
let mut d = RingBuf::new();

branches/try/src/librustdoc/html/render.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,11 +1124,12 @@ impl<'self> fmt::Default for Sidebar<'self> {
11241124
write!(w, "<a class='{ty} {class}' href='{curty, select,
11251125
mod{../}
11261126
other{}
1127-
}{ty, select,
1127+
}{tysel, select,
11281128
mod{{name}/index.html}
11291129
other{#.{name}.html}
11301130
}'>{name}</a><br/>",
11311131
ty = short,
1132+
tysel = short,
11321133
class = class,
11331134
curty = shortty(cur),
11341135
name = item.as_slice());

branches/try/src/librustpkg/package_source.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,13 @@ impl PkgSrc {
246246
/// Infers crates to build. Called only in the case where there
247247
/// is no custom build logic
248248
pub fn find_crates(&mut self) {
249-
self.find_crates_with_filter(|_| true);
250-
}
251-
252-
pub fn find_crates_with_filter(&mut self, filter: &fn(&str) -> bool) {
253249
use conditions::missing_pkg_files::cond;
254250

255251
let prefix = self.start_dir.components.len();
256252
debug!("Matching against %s", self.id.short_name);
257253
do os::walk_dir(&self.start_dir) |pth| {
258254
let maybe_known_crate_set = match pth.filename() {
259-
Some(filename) if filter(filename) => match filename {
255+
Some(filename) => match filename {
260256
"lib.rs" => Some(&mut self.libs),
261257
"main.rs" => Some(&mut self.mains),
262258
"test.rs" => Some(&mut self.tests),

branches/try/src/librustpkg/rustpkg.rs

Lines changed: 34 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use extra::{getopts};
3333
use syntax::{ast, diagnostic};
3434
use util::*;
3535
use messages::{error, warn, note};
36-
use path_util::{build_pkg_id_in_workspace, built_test_in_workspace};
36+
use path_util::build_pkg_id_in_workspace;
3737
use path_util::{U_RWX, in_rust_path};
3838
use path_util::{built_executable_in_workspace, built_library_in_workspace, default_workspace};
3939
use path_util::{target_executable_in_workspace, target_library_in_workspace};
@@ -44,7 +44,7 @@ use context::{Context, BuildContext,
4444
LLVMAssemble, LLVMCompileBitcode};
4545
use package_id::PkgId;
4646
use package_source::PkgSrc;
47-
use target::{WhatToBuild, Everything, is_lib, is_main, is_test, is_bench, Tests};
47+
use target::{WhatToBuild, Everything, is_lib, is_main, is_test, is_bench};
4848
// use workcache_support::{discover_outputs, digest_only_date};
4949
use workcache_support::digest_only_date;
5050
use exit_codes::COPY_FAILED_CODE;
@@ -177,8 +177,6 @@ impl<'self> PkgScript<'self> {
177177
pub trait CtxMethods {
178178
fn run(&self, cmd: &str, args: ~[~str]);
179179
fn do_cmd(&self, _cmd: &str, _pkgname: &str);
180-
/// Returns a pair of the selected package ID, and the destination workspace
181-
fn build_args(&self, args: ~[~str], what: &WhatToBuild) -> Option<(PkgId, Path)>;
182180
/// Returns the destination workspace
183181
fn build(&self, pkg_src: &mut PkgSrc, what: &WhatToBuild) -> Path;
184182
fn clean(&self, workspace: &Path, id: &PkgId);
@@ -192,53 +190,43 @@ pub trait CtxMethods {
192190
target_workspace: &Path,
193191
id: &PkgId) -> ~[~str];
194192
fn prefer(&self, _id: &str, _vers: Option<~str>);
195-
fn test(&self, id: &PkgId, workspace: &Path);
193+
fn test(&self);
196194
fn uninstall(&self, _id: &str, _vers: Option<~str>);
197195
fn unprefer(&self, _id: &str, _vers: Option<~str>);
198196
fn init(&self);
199197
}
200198

201199
impl CtxMethods for BuildContext {
202-
fn build_args(&self, args: ~[~str], what: &WhatToBuild) -> Option<(PkgId, Path)> {
203-
if args.len() < 1 {
204-
match cwd_to_workspace() {
205-
None if self.context.use_rust_path_hack => {
206-
let cwd = os::getcwd();
207-
let pkgid = PkgId::new(cwd.components[cwd.components.len() - 1]);
208-
let mut pkg_src = PkgSrc::new(cwd, true, pkgid);
209-
let dest_ws = self.build(&mut pkg_src, what);
210-
Some((pkg_src.id, dest_ws))
211-
}
212-
None => { usage::build(); None }
213-
Some((ws, pkgid)) => {
214-
let mut pkg_src = PkgSrc::new(ws, false, pkgid);
215-
let dest_ws = self.build(&mut pkg_src, what);
216-
Some((pkg_src.id, dest_ws))
217-
}
218-
}
219-
} else {
220-
// The package id is presumed to be the first command-line
221-
// argument
222-
let pkgid = PkgId::new(args[0].clone());
223-
let mut dest_ws = None;
224-
do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| {
225-
debug!("found pkg %s in workspace %s, trying to build",
226-
pkgid.to_str(), workspace.to_str());
227-
let mut pkg_src = PkgSrc::new(workspace.clone(), false, pkgid.clone());
228-
dest_ws = Some(self.build(&mut pkg_src, what));
229-
true
230-
};
231-
assert!(dest_ws.is_some());
232-
// n.b. If this builds multiple packages, it only returns the workspace for
233-
// the last one. The whole building-multiple-packages-with-the-same-ID is weird
234-
// anyway and there are no tests for it, so maybe take it out
235-
Some((pkgid, dest_ws.unwrap()))
236-
}
237-
}
238200
fn run(&self, cmd: &str, args: ~[~str]) {
239201
match cmd {
240202
"build" => {
241-
self.build_args(args, &Everything);
203+
if args.len() < 1 {
204+
match cwd_to_workspace() {
205+
None if self.context.use_rust_path_hack => {
206+
let cwd = os::getcwd();
207+
let pkgid = PkgId::new(cwd.components[cwd.components.len() - 1]);
208+
let mut pkg_src = PkgSrc::new(cwd, true, pkgid);
209+
self.build(&mut pkg_src, &Everything);
210+
}
211+
None => { usage::build(); return; }
212+
Some((ws, pkgid)) => {
213+
let mut pkg_src = PkgSrc::new(ws, false, pkgid);
214+
self.build(&mut pkg_src, &Everything);
215+
}
216+
}
217+
}
218+
else {
219+
// The package id is presumed to be the first command-line
220+
// argument
221+
let pkgid = PkgId::new(args[0].clone());
222+
do each_pkg_parent_workspace(&self.context, &pkgid) |workspace| {
223+
debug!("found pkg %s in workspace %s, trying to build",
224+
pkgid.to_str(), workspace.to_str());
225+
let mut pkg_src = PkgSrc::new(workspace.clone(), false, pkgid.clone());
226+
self.build(&mut pkg_src, &Everything);
227+
true
228+
};
229+
}
242230
}
243231
"clean" => {
244232
if args.len() < 1 {
@@ -322,17 +310,7 @@ impl CtxMethods for BuildContext {
322310
self.prefer(args[0], None);
323311
}
324312
"test" => {
325-
// Build the test executable
326-
let maybe_id_and_workspace = self.build_args(args, &Tests);
327-
match maybe_id_and_workspace {
328-
Some((pkg_id, workspace)) => {
329-
// Assuming it's built, run the tests
330-
self.test(&pkg_id, &workspace);
331-
}
332-
None => {
333-
error("Testing failed because building the specified package failed.");
334-
}
335-
}
313+
self.test();
336314
}
337315
"init" => {
338316
if args.len() != 0 {
@@ -447,8 +425,6 @@ impl CtxMethods for BuildContext {
447425
match what_to_build {
448426
// Find crates inside the workspace
449427
&Everything => pkg_src.find_crates(),
450-
// Find only tests
451-
&Tests => pkg_src.find_crates_with_filter(|s| { is_test(&Path(s)) }),
452428
// Don't infer any crates -- just build the one that was requested
453429
&JustOne(ref p) => {
454430
// We expect that p is relative to the package source's start directory,
@@ -616,25 +592,9 @@ impl CtxMethods for BuildContext {
616592
fail!("prefer not yet implemented");
617593
}
618594

619-
fn test(&self, pkgid: &PkgId, workspace: &Path) {
620-
match built_test_in_workspace(pkgid, workspace) {
621-
Some(test_exec) => {
622-
debug!("test: test_exec = %s", test_exec.to_str());
623-
let p_output = run::process_output(test_exec.to_str(), [~"--test"]);
624-
if p_output.status == 0 {
625-
println(str::from_utf8(p_output.output));
626-
}
627-
else {
628-
println(str::from_utf8(p_output.error));
629-
}
630-
os::set_exit_status(p_output.status);
631-
}
632-
None => {
633-
error(fmt!("Internal error: test executable for package ID %s in workspace %s \
634-
wasn't built! Please report this as a bug.",
635-
pkgid.to_str(), workspace.to_str()));
636-
}
637-
}
595+
fn test(&self) {
596+
// stub
597+
fail!("test not yet implemented");
638598
}
639599

640600
fn init(&self) {

branches/try/src/librustpkg/target.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ pub enum Target {
2626
pub enum WhatToBuild {
2727
/// Build just one lib.rs file in `path`, which is relative to the active workspace's src/ dir
2828
JustOne(Path),
29-
/// Build any test.rs files that can be recursively found in the active workspace
30-
Tests,
3129
/// Build everything
3230
Everything
3331
}

branches/try/src/librustpkg/tests.rs

Lines changed: 12 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -350,19 +350,11 @@ fn assert_executable_exists(repo: &Path, short_name: &str) {
350350
}
351351

352352
fn executable_exists(repo: &Path, short_name: &str) -> bool {
353-
debug!("executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
353+
debug!("assert_executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
354354
let exec = target_executable_in_workspace(&PkgId::new(short_name), repo);
355355
os::path_exists(&exec) && is_rwx(&exec)
356356
}
357357

358-
fn test_executable_exists(repo: &Path, short_name: &str) -> bool {
359-
debug!("test_executable_exists: repo = %s, short_name = %s", repo.to_str(), short_name);
360-
let exec = built_test_in_workspace(&PkgId::new(short_name), repo);
361-
do exec.map_default(false) |exec| {
362-
os::path_exists(exec) && is_rwx(exec)
363-
}
364-
}
365-
366358
fn remove_executable_file(p: &PkgId, workspace: &Path) {
367359
let exec = target_executable_in_workspace(&PkgId::new(p.short_name), workspace);
368360
if os::path_exists(&exec) {
@@ -1053,8 +1045,19 @@ fn test_info() {
10531045
}
10541046
10551047
#[test]
1048+
#[ignore(reason = "test not yet implemented")]
1049+
fn test_rustpkg_test() {
1050+
let expected_results = ~"1 out of 1 tests passed"; // fill in
1051+
let workspace = create_local_package_with_test(&PkgId::new("foo"));
1052+
let output = command_line_test([~"test", ~"foo"], &workspace);
1053+
assert_eq!(str::from_utf8(output.output), expected_results);
1054+
}
1055+
1056+
#[test]
1057+
#[ignore(reason = "test not yet implemented")]
10561058
fn test_uninstall() {
10571059
let workspace = create_local_package(&PkgId::new("foo"));
1060+
let _output = command_line_test([~"info", ~"foo"], &workspace);
10581061
command_line_test([~"uninstall", ~"foo"], &workspace);
10591062
let output = command_line_test([~"list"], &workspace);
10601063
assert!(!str::from_utf8(output.output).contains("foo"));
@@ -1797,64 +1800,6 @@ fn correct_package_name_with_rust_path_hack() {
17971800
assert!(!lib_exists(&foo_workspace, &foo_id.path.clone(), foo_id.version.clone()));
17981801
}
17991802
1800-
#[test]
1801-
fn test_rustpkg_test_creates_exec() {
1802-
let foo_id = PkgId::new("foo");
1803-
let foo_workspace = create_local_package(&foo_id);
1804-
writeFile(&foo_workspace.push_many(["src", "foo-0.1", "test.rs"]),
1805-
"#[test] fn f() { assert!('a' == 'a'); }");
1806-
command_line_test([~"test", ~"foo"], &foo_workspace);
1807-
assert!(test_executable_exists(&foo_workspace, "foo"));
1808-
}
1809-
1810-
#[test]
1811-
fn test_rustpkg_test_output() {
1812-
let workspace = create_local_package_with_test(&PkgId::new("foo"));
1813-
let output = command_line_test([~"test", ~"foo"], &workspace);
1814-
let output_str = str::from_utf8(output.output);
1815-
assert!(output_str.contains("test f ... ok"));
1816-
assert!(output_str.contains(
1817-
"test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured"));
1818-
}
1819-
1820-
#[test]
1821-
#[ignore(reason = "See issue #9441")]
1822-
fn test_rebuild_when_needed() {
1823-
let foo_id = PkgId::new("foo");
1824-
let foo_workspace = create_local_package(&foo_id);
1825-
let test_crate = foo_workspace.push_many(["src", "foo-0.1", "test.rs"]);
1826-
writeFile(&test_crate, "#[test] fn f() { assert!('a' == 'a'); }");
1827-
command_line_test([~"test", ~"foo"], &foo_workspace);
1828-
assert!(test_executable_exists(&foo_workspace, "foo"));
1829-
let test_executable = built_test_in_workspace(&foo_id,
1830-
&foo_workspace).expect("test_rebuild_when_needed failed");
1831-
frob_source_file(&foo_workspace, &foo_id, "test.rs");
1832-
chmod_read_only(&test_executable);
1833-
match command_line_test_partial([~"test", ~"foo"], &foo_workspace) {
1834-
Success(*) => fail!("test_rebuild_when_needed didn't rebuild"),
1835-
Fail(status) if status == 65 => (), // ok
1836-
Fail(_) => fail!("test_rebuild_when_needed failed for some other reason")
1837-
}
1838-
}
1839-
1840-
#[test]
1841-
fn test_no_rebuilding() {
1842-
let foo_id = PkgId::new("foo");
1843-
let foo_workspace = create_local_package(&foo_id);
1844-
let test_crate = foo_workspace.push_many(["src", "foo-0.1", "test.rs"]);
1845-
writeFile(&test_crate, "#[test] fn f() { assert!('a' == 'a'); }");
1846-
command_line_test([~"test", ~"foo"], &foo_workspace);
1847-
assert!(test_executable_exists(&foo_workspace, "foo"));
1848-
let test_executable = built_test_in_workspace(&foo_id,
1849-
&foo_workspace).expect("test_no_rebuilding failed");
1850-
chmod_read_only(&test_executable);
1851-
match command_line_test_partial([~"test", ~"foo"], &foo_workspace) {
1852-
Success(*) => (), // ok
1853-
Fail(status) if status == 65 => fail!("test_no_rebuilding failed: it rebuilt the tests"),
1854-
Fail(_) => fail!("test_no_rebuilding failed for some other reason")
1855-
}
1856-
}
1857-
18581803
/// Returns true if p exists and is executable
18591804
fn is_executable(p: &Path) -> bool {
18601805
use std::libc::consts::os::posix88::{S_IXUSR};

0 commit comments

Comments
 (0)