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