@@ -18,7 +18,7 @@ use std::run::ProcessOutput;
18
18
use installed_packages:: list_installed_packages;
19
19
use package_path:: * ;
20
20
use package_id:: { PkgId } ;
21
- use version:: { ExactRevision , NoVersion , Version , Tagged } ;
21
+ use version:: { ExactRevision , NoVersion , Version } ;
22
22
use path_util:: { target_executable_in_workspace, target_library_in_workspace,
23
23
target_test_in_workspace, target_bench_in_workspace,
24
24
make_dir_rwx, U_RWX , library_in_workspace,
@@ -61,16 +61,6 @@ fn git_repo_pkg() -> PkgId {
61
61
}
62
62
}
63
63
64
- fn git_repo_pkg_with_tag ( a_tag : ~str ) -> PkgId {
65
- let remote = RemotePath ( Path ( "mocki.8713187.xyz/catamorphism/test-pkg" ) ) ;
66
- PkgId {
67
- local_path : normalize ( remote. clone ( ) ) ,
68
- remote_path : remote,
69
- short_name : ~"test_pkg",
70
- version : Tagged ( a_tag)
71
- }
72
- }
73
-
74
64
fn writeFile ( file_path : & Path , contents : & str ) {
75
65
let out = io:: file_writer ( file_path, [ io:: Create , io:: Truncate ] ) . unwrap ( ) ;
76
66
out. write_line ( contents) ;
@@ -158,13 +148,9 @@ fn init_git_repo(p: &Path) -> Path {
158
148
}
159
149
}
160
150
161
- fn add_all_and_commit ( repo : & Path ) {
162
- git_add_all ( repo) ;
163
- git_commit ( repo, ~"floop") ;
164
- }
165
-
166
- fn git_commit ( repo : & Path , msg : ~str ) {
167
- let mut prog = run:: Process :: new ( "git" , [ ~"commit", ~"-m", msg] ,
151
+ fn add_git_tag ( repo : & Path , tag : ~str ) {
152
+ assert ! ( repo. is_absolute( ) ) ;
153
+ let mut prog = run:: Process :: new ( "git" , [ ~"add", ~"-A "] ,
168
154
run:: ProcessOptions { env : None ,
169
155
dir : Some ( repo) ,
170
156
in_fd : None ,
@@ -173,14 +159,9 @@ fn git_commit(repo: &Path, msg: ~str) {
173
159
} ) ;
174
160
let output = prog. finish_with_output ( ) ;
175
161
if output. status != 0 {
176
- fail ! ( "Couldn't commit in %s: output was %s" , repo. to_str( ) ,
177
- str :: from_bytes( output. output + output. error) )
162
+ fail ! ( "Couldn't add all files in %s" , repo. to_str( ) )
178
163
}
179
-
180
- }
181
-
182
- fn git_add_all ( repo : & Path ) {
183
- let mut prog = run:: Process :: new ( "git" , [ ~"add", ~"-A "] ,
164
+ prog = run:: Process :: new ( "git" , [ ~"commit", ~"-m", ~"whatever"] ,
184
165
run:: ProcessOptions { env : None ,
185
166
dir : Some ( repo) ,
186
167
in_fd : None ,
@@ -189,16 +170,10 @@ fn git_add_all(repo: &Path) {
189
170
} ) ;
190
171
let output = prog. finish_with_output ( ) ;
191
172
if output. status != 0 {
192
- fail ! ( "Couldn't add all files in %s: output was %s" ,
193
- repo. to_str( ) , str :: from_bytes( output. output + output. error) )
173
+ fail ! ( "Couldn't commit in %s" , repo. to_str( ) )
194
174
}
195
- }
196
175
197
- fn add_git_tag ( repo : & Path , tag : ~str ) {
198
- assert ! ( repo. is_absolute( ) ) ;
199
- git_add_all ( repo) ;
200
- git_commit ( repo, ~"whatever") ;
201
- let mut prog = run:: Process :: new ( "git" , [ ~"tag", tag. clone ( ) ] ,
176
+ prog = run:: Process :: new ( "git" , [ ~"tag", tag. clone ( ) ] ,
202
177
run:: ProcessOptions { env : None ,
203
178
dir : Some ( repo) ,
204
179
in_fd : None ,
@@ -647,6 +622,31 @@ fn test_package_request_version() {
647
622
writeFile(&repo_subdir.push(" version-0.4 -file. txt"), " hello");
648
623
add_git_tag(&repo_subdir, ~" 0.4 ");
649
624
625
+ /*
626
+
627
+ let pkg_src = PkgSrc::new(&repo, &repo, &temp_pkg_id);
628
+ match temp_pkg_id.version {
629
+ ExactRevision(~" 0.3 ") => {
630
+ debug!(" Version matches, calling fetch_git");
631
+ match pkg_src.fetch_git() {
632
+ Some(p) => {
633
+ debug!(" does version-0.3 -file exist?");
634
+ assert!(os::path_exists(&p.push(" version-0.3 -file. txt")));
635
+ debug!(" does version-0.4 -file exist?");
636
+ assert!(!os::path_exists(&p.push(" version-0.4 -file. txt")));
637
+
638
+ }
639
+ None => fail!(" test_package_request_version: fetch_git failed")
640
+ }
641
+ }
642
+ ExactRevision(n) => {
643
+ fail!(" n is %? and %? %s %?", n, n, if n == ~" 0.3 " { " ==" } else { " !=" }, " 0.3 ");
644
+ }
645
+ _ => fail!(fmt!(" test_package_version: package version was %?, expected ExactRevision ( 0.3 ) ",
646
+ temp_pkg_id.version))
647
+ }
648
+ */
649
+
650
650
command_line_test([~" install", fmt!(" %s#0.3 ", local_path)], &repo);
651
651
652
652
assert!(match installed_library_in_workspace(" test_pkg_version", &repo.push(" . rust")) {
@@ -679,7 +679,6 @@ fn rustpkg_install_url_2() {
679
679
}
680
680
681
681
// FIXME: #7956: temporarily disabled
682
- #[test]
683
682
fn rustpkg_library_target() {
684
683
let foo_repo = init_git_repo(&Path(" foo"));
685
684
let package_dir = foo_repo.push(" foo");
@@ -706,10 +705,8 @@ fn rustpkg_local_pkg() {
706
705
assert_executable_exists(&dir, " foo");
707
706
}
708
707
709
- // FIXME: #7956: temporarily disabled
710
- // Failing on dist-linux bot
711
708
#[test]
712
- #[ignore]
709
+ #[ignore] // XXX Failing on dist-linux bot
713
710
fn package_script_with_default_build() {
714
711
let dir = create_local_package(&PkgId::new(" fancy-lib", &os::getcwd()));
715
712
debug!(" dir = %s", dir.to_str());
@@ -768,7 +765,7 @@ fn rustpkg_clean_no_arg() {
768
765
}
769
766
770
767
#[test]
771
- #[ignore (reason = " Specifying env doesn ' t work -- see # 8028 ")]
768
+ #[ignore (reason = " Un -ignore when # 7071 is fixed ")]
772
769
fn rust_path_test() {
773
770
let dir_for_path = mkdtemp(&os::tmpdir(), " more_rust").expect(" rust_path_test failed");
774
771
let dir = mk_workspace(&dir_for_path, &normalize(RemotePath(Path(" foo"))), &NoVersion);
@@ -777,13 +774,9 @@ fn rust_path_test() {
777
774
778
775
let cwd = os::getcwd();
779
776
debug!(" cwd = %s", cwd.to_str());
780
- debug!(" Running command: cd %s; RUST_LOG =rustpkg RUST_PATH =%s rustpkg install foo",
781
- cwd.to_str(), dir_for_path.to_str());
782
777
let mut prog = run::Process::new(" rustpkg",
783
778
[~" install", ~" foo"],
784
- run::ProcessOptions { env: Some(&[(~" RUST_LOG ",
785
- ~" rustpkg"),
786
- (~" RUST_PATH ",
779
+ run::ProcessOptions { env: Some(&[(~" RUST_PATH ",
787
780
dir_for_path.to_str())]),
788
781
dir: Some(&cwd),
789
782
in_fd: None,
@@ -961,6 +954,7 @@ fn do_rebuild_dep_only_contents_change() {
961
954
}
962
955
963
956
#[test]
957
+ #[ignore(reason = " list not yet implemented")]
964
958
fn test_versions() {
965
959
let workspace = create_local_package(&PkgId::new(" foo#0.1 ", &os::getcwd()));
966
960
create_local_package(&PkgId::new(" foo#0.2 ", &os::getcwd()));
@@ -998,35 +992,11 @@ fn test_rustpkg_test() {
998
992
}
999
993
1000
994
#[test]
995
+ #[ignore(reason = " uninstall not yet implemented")]
1001
996
fn test_uninstall() {
1002
997
let workspace = create_local_package(&PkgId::new(" foo", &os::getcwd()));
1003
998
let _output = command_line_test([~" info", ~" foo"], &workspace);
1004
999
command_line_test([~" uninstall", ~" foo"], &workspace);
1005
1000
let output = command_line_test([~" list"], &workspace);
1006
1001
assert!(!str::from_bytes(output.output).contains(" foo") ) ;
1007
1002
}
1008
-
1009
- #[test]
1010
- fn test_non_numeric_tag() {
1011
- let temp_pkg_id = git_repo_pkg();
1012
- let repo = init_git_repo(&Path(temp_pkg_id.local_path.to_str()));
1013
- let repo_subdir = repo.push(" mockgithub. com").push(" catamorphism").push(" test_pkg");
1014
- writeFile(&repo_subdir.push(" foo"), " foo");
1015
- writeFile(&repo_subdir.push(" lib. rs"),
1016
- " pub fn f( ) { let _x = ( ) ; } ");
1017
- add_git_tag(&repo_subdir, ~" testbranch");
1018
- writeFile(&repo_subdir.push(" testbranch_only"), " hello");
1019
- add_git_tag(&repo_subdir, ~" another_tag");
1020
- writeFile(&repo_subdir.push(" not_on_testbranch_only"), " bye bye");
1021
- add_all_and_commit(&repo_subdir);
1022
-
1023
-
1024
- command_line_test([~" install", fmt!(" %s#testbranch", temp_pkg_id.remote_path.to_str())],
1025
- &repo);
1026
- let file1 = repo.push_many([" mockgithub. com", " catamorphism",
1027
- " test_pkg", " testbranch_only"]);
1028
- let file2 = repo.push_many([" mockgithub. com", " catamorphism", " test_pkg",
1029
- " master_only"] ) ;
1030
- assert ! ( os:: path_exists( & file1) ) ;
1031
- assert ! ( !os:: path_exists( & file2) ) ;
1032
- }
0 commit comments