Skip to content

Commit 6ad15fc

Browse files
committed
---
yaml --- r: 145087 b: refs/heads/try2 c: a7e49d6 h: refs/heads/master i: 145085: 7c39abd 145083: da87b6a 145079: dbaaab4 145071: aa641b2 145055: d70ca1f 145023: 436b841 v: v3
1 parent c2c6df0 commit 6ad15fc

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: a2231dce929a2c525df7cb10e5ab3258804a3a36
8+
refs/heads/try2: a7e49d6e83f61989b2456c213daeb7461d9ee606
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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/try2/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)