@@ -218,6 +218,7 @@ fn command_line_test(args: &[~str], cwd: &Path) -> ProcessOutput {
218
218
fn command_line_test_with_env ( args : & [ ~str ] , cwd : & Path , env : Option < ~[ ( ~str , ~str ) ] > )
219
219
-> ProcessOutput {
220
220
let cmd = test_sysroot ( ) . push ( "bin" ) . push ( "rustpkg" ) . to_str ( ) ;
221
+ let cwd = normalize ( RemotePath ( ( * cwd) . clone ( ) ) ) ;
221
222
debug ! ( "About to run command: %? %? in %s" , cmd, args, cwd. to_str( ) ) ;
222
223
assert ! ( os:: path_is_dir( & * cwd) ) ;
223
224
let cwd = ( * cwd) . clone ( ) ;
@@ -321,14 +322,6 @@ fn assert_executable_exists(repo: &Path, short_name: &str) {
321
322
assert ! ( is_rwx( & exec) ) ;
322
323
}
323
324
324
- fn assert_built_executable_exists ( repo : & Path , short_name : & str ) {
325
- debug ! ( "assert_built_executable_exists: repo = %s, short_name = %s" , repo. to_str( ) , short_name) ;
326
- let exec = built_executable_in_workspace ( & PkgId :: new ( short_name, repo) ,
327
- repo) . expect ( "assert_built_executable_exists failed" ) ;
328
- assert ! ( os:: path_exists( & exec) ) ;
329
- assert ! ( is_rwx( & exec) ) ;
330
- }
331
-
332
325
fn command_line_test_output ( args : & [ ~str ] ) -> ~[ ~str ] {
333
326
let mut result = ~[ ] ;
334
327
let p_output = command_line_test ( args, & os:: getcwd ( ) ) ;
@@ -497,29 +490,30 @@ fn test_install_git() {
497
490
// should have test, bench, lib, and main
498
491
command_line_test ( [ ~"install", temp_pkg_id. local_path . to_str ( ) ] , & repo) ;
499
492
// Check that all files exist
500
- debug ! ( "Checking for files in %s" , repo. to_str( ) ) ;
501
- let exec = target_executable_in_workspace ( & temp_pkg_id, & repo) ;
493
+ let ws = repo. push ( ".rust" ) ;
494
+ debug ! ( "Checking for files in %s" , ws. to_str( ) ) ;
495
+ let exec = target_executable_in_workspace ( & temp_pkg_id, & ws) ;
502
496
debug ! ( "exec = %s" , exec. to_str( ) ) ;
503
497
assert ! ( os:: path_exists( & exec) ) ;
504
498
assert ! ( is_rwx( & exec) ) ;
505
499
let _built_lib =
506
500
built_library_in_workspace ( & temp_pkg_id,
507
- & repo ) . expect ( "test_install_git: built lib should exist" ) ;
508
- let lib = target_library_in_workspace ( & temp_pkg_id, & repo ) ;
501
+ & ws ) . expect ( "test_install_git: built lib should exist" ) ;
502
+ let lib = target_library_in_workspace ( & temp_pkg_id, & ws ) ;
509
503
debug ! ( "lib = %s" , lib. to_str( ) ) ;
510
504
assert ! ( os:: path_exists( & lib) ) ;
511
505
assert ! ( is_rwx( & lib) ) ;
512
506
let built_test = built_test_in_workspace ( & temp_pkg_id,
513
- & repo ) . expect ( "test_install_git: built test should exist" ) ;
507
+ & ws ) . expect ( "test_install_git: built test should exist" ) ;
514
508
assert ! ( os:: path_exists( & built_test) ) ;
515
509
let built_bench = built_bench_in_workspace ( & temp_pkg_id,
516
- & repo ) . expect ( "test_install_git: built bench should exist" ) ;
510
+ & ws ) . expect ( "test_install_git: built bench should exist" ) ;
517
511
assert ! ( os:: path_exists( & built_bench) ) ;
518
512
// And that the test and bench executables aren't installed
519
- let test = target_test_in_workspace ( & temp_pkg_id, & repo ) ;
513
+ let test = target_test_in_workspace ( & temp_pkg_id, & ws ) ;
520
514
assert ! ( !os:: path_exists( & test) ) ;
521
515
debug ! ( "test = %s" , test. to_str( ) ) ;
522
- let bench = target_bench_in_workspace ( & temp_pkg_id, & repo ) ;
516
+ let bench = target_bench_in_workspace ( & temp_pkg_id, & ws ) ;
523
517
debug ! ( "bench = %s" , bench. to_str( ) ) ;
524
518
assert ! ( !os:: path_exists( & bench) ) ;
525
519
}
@@ -592,12 +586,12 @@ fn test_package_version() {
592
586
command_line_test([~" install", ~" mockgithub. com/catamorphism/test_pkg_version"],
593
587
&repo);
594
588
assert!(match built_library_in_workspace(&temp_pkg_id,
595
- &repo) {
589
+ &repo.push(" . rust ") ) {
596
590
Some(p) => p.to_str().ends_with(fmt!(" 0.4 %s", os::consts::DLL_SUFFIX)),
597
591
None => false
598
592
});
599
- assert!(built_executable_in_workspace(&temp_pkg_id, &repo)
600
- == Some(repo.push(" build").
593
+ assert!(built_executable_in_workspace(&temp_pkg_id, &repo.push(" . rust ") )
594
+ == Some(repo.push(" . rust ").push(" build").
601
595
push(" mockgithub. com").
602
596
push(" catamorphism").
603
597
push(" test_pkg_version").
@@ -695,7 +689,7 @@ fn rustpkg_library_target() {
695
689
696
690
add_git_tag(&package_dir, ~" 1.0 ");
697
691
command_line_test([~" install", ~" foo"], &foo_repo);
698
- assert_lib_exists(&foo_repo, " foo", ExactRevision(~" 1.0 "));
692
+ assert_lib_exists(&foo_repo.push(" . rust ") , " foo", ExactRevision(~" 1.0 "));
699
693
}
700
694
701
695
#[test]
@@ -722,55 +716,14 @@ fn package_script_with_default_build() {
722
716
assert!(os::path_exists(&dir.push(" build").push(" fancy_lib").push(" generated. rs")));
723
717
}
724
718
725
- #[test]
726
- fn rustpkg_build_no_arg() {
727
- let tmp = mkdtemp(&os::tmpdir(), " rustpkg_build_no_arg").expect(" rustpkg_build_no_arg failed");
728
- let package_dir = tmp.push(" src").push(" foo");
729
- assert!(os::mkdir_recursive(&package_dir, U_RWX));
730
-
731
- writeFile(&package_dir.push(" main. rs"),
732
- " fn main( ) { let _x = ( ) ; } ");
733
- debug!(" build_no_arg: dir = %s", package_dir.to_str());
734
- command_line_test([~" build"], &package_dir);
735
- assert_built_executable_exists(&tmp, " foo");
736
- }
737
-
738
- #[test]
739
- fn rustpkg_install_no_arg() {
740
- let tmp = mkdtemp(&os::tmpdir(),
741
- " rustpkg_install_no_arg").expect(" rustpkg_build_no_arg failed");
742
- let package_dir = tmp.push(" src").push(" foo");
743
- assert!(os::mkdir_recursive(&package_dir, U_RWX));
744
- writeFile(&package_dir.push(" lib. rs"),
745
- " fn main( ) { let _x = ( ) ; } ");
746
- debug!(" install_no_arg: dir = %s", package_dir.to_str());
747
- command_line_test([~" install"], &package_dir);
748
- assert_lib_exists(&tmp, " foo", NoVersion);
749
- }
750
-
751
- #[test]
752
- fn rustpkg_clean_no_arg() {
753
- let tmp = mkdtemp(&os::tmpdir(), " rustpkg_clean_no_arg").expect(" rustpkg_clean_no_arg failed");
754
- let package_dir = tmp.push(" src").push(" foo");
755
- assert!(os::mkdir_recursive(&package_dir, U_RWX));
756
-
757
- writeFile(&package_dir.push(" main. rs"),
758
- " fn main( ) { let _x = ( ) ; } ");
759
- debug!(" clean_no_arg: dir = %s", package_dir.to_str());
760
- command_line_test([~" build"], &package_dir);
761
- assert_built_executable_exists(&tmp, " foo");
762
- command_line_test([~" clean"], &package_dir);
763
- assert!(!built_executable_in_workspace(&PkgId::new(" foo", &package_dir),
764
- &tmp).map_default(false, |m| { os::path_exists(m) }));
765
- }
766
-
767
719
#[test]
768
720
#[ignore (reason = " Un -ignore when #7071 is fixed")]
769
721
fn rust_path_test() {
770
722
let dir_for_path = mkdtemp(&os::tmpdir(), " more_rust").expect(" rust_path_test failed");
771
723
let dir = mk_workspace(&dir_for_path, &normalize(RemotePath(Path(" foo"))), &NoVersion);
772
724
debug!(" dir = %s", dir.to_str());
773
- writeFile(&dir.push(" main. rs"), " fn main( ) { let _x = ( ) ; } ");
725
+ writeFile(&Path(" /Users /tjc/more_rust/src/foo-0.1 /main. rs"),
726
+ " fn main( ) { let _x = ( ) ; } ");
774
727
775
728
let cwd = os::getcwd();
776
729
debug!(" cwd = %s", cwd.to_str());
@@ -828,24 +781,21 @@ fn test_list() {
828
781
let quux = PkgId::new(" quux", &dir);
829
782
create_local_package_in(&quux, &dir);
830
783
831
- // NOTE Not really great output, though...
832
- // NOTE do any tests need to be unignored?
833
784
command_line_test([~" install", ~" foo"], &dir);
834
785
let env_arg = ~[(~" RUST_PATH ", dir.to_str())];
835
- debug!(" RUST_PATH = %s", dir.to_str());
836
786
let list_output = command_line_test_output_with_env([~" list"], env_arg.clone());
837
- assert!(list_output.iter().any(|x| x.starts_with(" libfoo_ ")));
787
+ assert!(list_output.iter().any(|x| x.starts_with(" foo- ")));
838
788
839
789
command_line_test([~" install", ~" bar"], &dir);
840
790
let list_output = command_line_test_output_with_env([~" list"], env_arg.clone());
841
- assert!(list_output.iter().any(|x| x.starts_with(" libfoo_ ")));
842
- assert!(list_output.iter().any(|x| x.starts_with(" libbar_ ")));
791
+ assert!(list_output.iter().any(|x| x.starts_with(" foo- ")));
792
+ assert!(list_output.iter().any(|x| x.starts_with(" bar- ")));
843
793
844
794
command_line_test([~" install", ~" quux"], &dir);
845
795
let list_output = command_line_test_output_with_env([~" list"], env_arg);
846
- assert!(list_output.iter().any(|x| x.starts_with(" libfoo_ ")));
847
- assert!(list_output.iter().any(|x| x.starts_with(" libbar_ ")));
848
- assert!(list_output.iter().any(|x| x.starts_with(" libquux_ ")));
796
+ assert!(list_output.iter().any(|x| x.starts_with(" foo- ")));
797
+ assert!(list_output.iter().any(|x| x.starts_with(" bar- ")));
798
+ assert!(list_output.iter().any(|x| x.starts_with(" quux- ")));
849
799
}
850
800
851
801
#[test]
@@ -886,7 +836,7 @@ fn install_check_duplicates() {
886
836
let mut contents = ~[];
887
837
let check_dups = |p: &PkgId| {
888
838
if contents.contains(p) {
889
- fail!(" package %s appears in `list` output more than once ", p.local_path.to_str() );
839
+ fail!(" package database contains duplicate ID " );
890
840
}
891
841
else {
892
842
contents.push((*p).clone());
0 commit comments