Skip to content

Commit a792723

Browse files
committed
---
yaml --- r: 80804 b: refs/heads/try c: 36872e4 h: refs/heads/master v: v3
1 parent b2d62d3 commit a792723

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
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: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: 48f61ecbf93740359b62ad5326e70759e738d9e6
5+
refs/heads/try: 36872e4180331e4a7f00329abe7972488ce216cf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustpkg/tests.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,55 @@ fn test_extern_mod() {
11111111
assert!(os::path_exists(&exec_file) && is_executable(&exec_file));
11121112
}
11131113

1114+
#[test]
1115+
fn test_extern_mod_simpler() {
1116+
let dir = mkdtemp(&os::tmpdir(), "test_extern_mod_simpler").expect("test_extern_mod_simpler");
1117+
let main_file = dir.push("main.rs");
1118+
let lib_depend_dir = mkdtemp(&os::tmpdir(), "foo").expect("test_extern_mod_simpler");
1119+
let aux_dir = lib_depend_dir.push_many(["src", "rust-awesomeness"]);
1120+
assert!(os::mkdir_recursive(&aux_dir, U_RWX));
1121+
let aux_pkg_file = aux_dir.push("lib.rs");
1122+
1123+
writeFile(&aux_pkg_file, "pub mod bar { pub fn assert_true() { assert!(true); } }\n");
1124+
assert!(os::path_exists(&aux_pkg_file));
1125+
1126+
writeFile(&main_file,
1127+
"extern mod test = \"rust-awesomeness\";\nuse test::bar;\
1128+
fn main() { bar::assert_true(); }\n");
1129+
1130+
command_line_test([~"install", ~"rust-awesomeness"], &lib_depend_dir);
1131+
1132+
let exec_file = dir.push("out");
1133+
// Be sure to extend the existing environment
1134+
let env = Some([(~"RUST_PATH", lib_depend_dir.to_str())] + os::env());
1135+
let rustpkg_exec = rustpkg_exec();
1136+
let rustc = rustpkg_exec.with_filename("rustc");
1137+
debug!("RUST_PATH=%s %s %s \n --sysroot %s -o %s",
1138+
lib_depend_dir.to_str(),
1139+
rustc.to_str(),
1140+
main_file.to_str(),
1141+
test_sysroot().to_str(),
1142+
exec_file.to_str());
1143+
1144+
let mut prog = run::Process::new(rustc.to_str(), [main_file.to_str(),
1145+
~"--sysroot", test_sysroot().to_str(),
1146+
~"-o", exec_file.to_str()],
1147+
run::ProcessOptions {
1148+
env: env,
1149+
dir: Some(&dir),
1150+
in_fd: None,
1151+
out_fd: None,
1152+
err_fd: None
1153+
});
1154+
let outp = prog.finish_with_output();
1155+
if outp.status != 0 {
1156+
fail!("output was %s, error was %s",
1157+
str::from_utf8(outp.output),
1158+
str::from_utf8(outp.error));
1159+
}
1160+
assert!(os::path_exists(&exec_file) && is_executable(&exec_file));
1161+
}
1162+
11141163
#[test]
11151164
fn test_import_rustpkg() {
11161165
let p_id = PkgId::new("foo");

branches/try/src/librustpkg/util.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,8 @@ pub fn compile_input(context: &BuildContext,
268268
let link_options =
269269
~[attr::mk_name_value_item_str(@"name", name_to_use),
270270
attr::mk_name_value_item_str(@"vers", pkg_id.version.to_str().to_managed())] +
271-
if pkg_id.is_complex() {
272-
~[attr::mk_name_value_item_str(@"package_id",
273-
pkg_id.path.to_str().to_managed())]
274-
} else { ~[] };
271+
~[attr::mk_name_value_item_str(@"package_id",
272+
pkg_id.path.to_str().to_managed())];
275273

276274
debug!("link options: %?", link_options);
277275
crate = @ast::Crate {

0 commit comments

Comments
 (0)