Test fixes and merge conflicts
This commit is contained in:
parent
c1e287af77
commit
56e4c82a38
@ -924,9 +924,10 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
|
||||
@rm -rf $(3)/test/run-make/$$*
|
||||
@mkdir -p $(3)/test/run-make/$$*
|
||||
@echo maketest: $$*
|
||||
@python $(S)src/etc/maketest.py $$(dir $$<) \
|
||||
$$(Q)python $(S)src/etc/maketest.py $$(dir $$<) \
|
||||
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
|
||||
$(3)/test/run-make/$$*
|
||||
$(3)/test/run-make/$$* \
|
||||
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))"
|
||||
@touch $$@
|
||||
|
||||
endef
|
||||
|
@ -6,6 +6,7 @@ import sys
|
||||
|
||||
os.putenv('RUSTC', os.path.abspath(sys.argv[2]))
|
||||
os.putenv('TMPDIR', os.path.abspath(sys.argv[3]))
|
||||
os.putenv('CC', sys.argv[4])
|
||||
|
||||
proc = subprocess.Popen(['make', '-C', sys.argv[1]],
|
||||
stdout = subprocess.PIPE,
|
||||
|
@ -40,6 +40,7 @@ Rust extras are part of the standard Rust distribution.
|
||||
|
||||
#[deny(non_camel_case_types)];
|
||||
#[deny(missing_doc)];
|
||||
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
|
||||
|
||||
use std::str::{StrSlice, OwnedStr};
|
||||
|
||||
|
@ -27,7 +27,7 @@ pub struct Archive {
|
||||
|
||||
fn run_ar(sess: Session, args: &str, cwd: Option<&Path>,
|
||||
paths: &[&Path]) -> ProcessOutput {
|
||||
let ar = sess.opts.ar.clone().unwrap_or(~"ar");
|
||||
let ar = sess.opts.ar.clone().unwrap_or_else(|| ~"ar");
|
||||
let mut args = ~[args.to_owned()];
|
||||
let mut paths = paths.iter().map(|p| p.as_str().unwrap().to_owned());
|
||||
args.extend(&mut paths);
|
||||
@ -64,7 +64,17 @@ impl Archive {
|
||||
|
||||
/// Read a file in the archive
|
||||
pub fn read(&self, file: &str) -> ~[u8] {
|
||||
run_ar(self.sess, "p", None, [&self.dst, &Path::new(file)]).output
|
||||
// Apparently if "ar p" is used on windows, it generates a corrupt file
|
||||
// which has bad headers and LLVM will immediately choke on it
|
||||
if cfg!(windows) && cfg!(windows) { // FIXME(#10734) double-and
|
||||
let loc = TempDir::new("rsar").unwrap();
|
||||
let archive = os::make_absolute(&self.dst);
|
||||
run_ar(self.sess, "x", Some(loc.path()), [&archive,
|
||||
&Path::init(file)]);
|
||||
fs::File::open(&loc.path().join(file)).read_to_end()
|
||||
} else {
|
||||
run_ar(self.sess, "p", None, [&self.dst, &Path::init(file)]).output
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds all of the contents of a native library to this archive. This will
|
||||
@ -77,7 +87,7 @@ impl Archive {
|
||||
/// Adds all of the contents of the rlib at the specified path to this
|
||||
/// archive.
|
||||
pub fn add_rlib(&mut self, rlib: &Path) {
|
||||
let name = rlib.filename_str().unwrap().split_iter('-').next().unwrap();
|
||||
let name = rlib.filename_str().unwrap().split('-').next().unwrap();
|
||||
self.add_archive(rlib, name);
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ fn link_args(sess: Session,
|
||||
// follow this flag. Thus, use it before specifing libraries to link to.
|
||||
args.push(~"-Wl,--as-needed");
|
||||
|
||||
// GNU-style linkers supports optimization with -O. --gc-sections
|
||||
// GNU-style linkers support optimization with -O. --gc-sections
|
||||
// removes metadata and potentially other useful things, so don't
|
||||
// include it. GNU ld doesn't need a numeric argument, but other linkers
|
||||
// do.
|
||||
@ -1212,7 +1212,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
|
||||
}
|
||||
}
|
||||
|
||||
// This is a fallback of three differnet cases of linking:
|
||||
// This is a fallback of three different cases of linking:
|
||||
//
|
||||
// * When creating a dynamic library, all inputs are required to be dynamic
|
||||
// as well
|
||||
@ -1223,7 +1223,8 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
|
||||
let crates = cstore::get_used_crates(cstore, cstore::RequireDynamic);
|
||||
for &(cnum, ref path) in crates.iter() {
|
||||
let cratepath = match *path {
|
||||
Some(ref p) => p.clone(), None => {
|
||||
Some(ref p) => p.clone(),
|
||||
None => {
|
||||
sess.err(format!("could not find dynamic library for: `{}`",
|
||||
cstore::get_crate_data(sess.cstore, cnum).name));
|
||||
return
|
||||
|
@ -420,75 +420,3 @@ pub fn sess_os_to_meta_os(os: abi::Os) -> metadata::loader::Os {
|
||||
abi::OsFreebsd => loader::OsFreebsd
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use driver::session::{bin_crate, building_library, lib_crate};
|
||||
use driver::session::{unknown_crate};
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::codemap;
|
||||
|
||||
fn make_crate_type_attr(t: @str) -> ast::Attribute {
|
||||
attr::mk_attr(attr::mk_name_value_item_str(@"crate_type", t))
|
||||
}
|
||||
|
||||
fn make_crate(with_bin: bool, with_lib: bool) -> @ast::Crate {
|
||||
let mut attrs = ~[];
|
||||
if with_bin {
|
||||
attrs.push(make_crate_type_attr(@"bin"));
|
||||
}
|
||||
if with_lib {
|
||||
attrs.push(make_crate_type_attr(@"lib"));
|
||||
}
|
||||
@ast::Crate {
|
||||
module: ast::_mod { view_items: ~[], items: ~[] },
|
||||
attrs: attrs,
|
||||
config: ~[],
|
||||
span: codemap::dummy_sp(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bin_crate_type_attr_results_in_bin_output() {
|
||||
let crate = make_crate(true, false);
|
||||
assert!(!building_library(unknown_crate, crate, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_crate_type_attr_results_in_lib_output() {
|
||||
let crate = make_crate(false, true);
|
||||
assert!(building_library(unknown_crate, crate, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bin_option_overrides_lib_crate_type() {
|
||||
let crate = make_crate(false, true);
|
||||
assert!(!building_library(bin_crate, crate, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lib_option_overrides_bin_crate_type() {
|
||||
let crate = make_crate(true, false);
|
||||
assert!(building_library(lib_crate, crate, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bin_crate_type_is_default() {
|
||||
let crate = make_crate(false, false);
|
||||
assert!(!building_library(unknown_crate, crate, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_option_overrides_lib_crate_type() {
|
||||
let crate = make_crate(false, true);
|
||||
assert!(!building_library(unknown_crate, crate, true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_option_does_not_override_requested_lib_type() {
|
||||
let crate = make_crate(false, false);
|
||||
assert!(building_library(lib_crate, crate, true));
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ impl Visitor<()> for Context {
|
||||
}
|
||||
}
|
||||
|
||||
ast::item_foreign_mod(*) => {
|
||||
ast::item_foreign_mod(..) => {
|
||||
if attr::contains_name(i.attrs, "link_args") &&
|
||||
cfg!(stage0, remove_this_on_next_snapshot) { // NOTE: snap
|
||||
self.gate_feature("link_args", i.span,
|
||||
|
@ -20,6 +20,7 @@
|
||||
#[crate_type = "dylib"];
|
||||
|
||||
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
|
||||
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
|
||||
|
||||
extern mod extra;
|
||||
extern mod syntax;
|
||||
|
@ -187,9 +187,9 @@ fn visit_item(e: &Env, i: @ast::item) {
|
||||
for m in link_args.iter() {
|
||||
match m.meta_item_list() {
|
||||
Some(items) => {
|
||||
let kind = do items.iter().find |k| {
|
||||
let kind = items.iter().find(|k| {
|
||||
"kind" == k.name()
|
||||
}.and_then(|a| a.value_str());
|
||||
}).and_then(|a| a.value_str());
|
||||
let kind = match kind {
|
||||
Some(k) if "static" == k => cstore::NativeStatic,
|
||||
Some(k) => {
|
||||
@ -198,9 +198,9 @@ fn visit_item(e: &Env, i: @ast::item) {
|
||||
}
|
||||
None => cstore::NativeUnknown
|
||||
};
|
||||
let n = do items.iter().find |n| {
|
||||
let n = items.iter().find(|n| {
|
||||
"name" == n.name()
|
||||
}.and_then(|a| a.value_str());
|
||||
}).and_then(|a| a.value_str());
|
||||
let n = match n {
|
||||
Some(n) => n,
|
||||
None => {
|
||||
|
@ -1533,9 +1533,9 @@ pub fn get_trait_of_method(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
|
||||
pub fn get_native_libraries(cdata: Cmd) -> ~[~str] {
|
||||
let libraries = reader::get_doc(reader::Doc(cdata.data), tag_native_libraries);
|
||||
let mut result = ~[];
|
||||
do reader::tagged_docs(libraries, tag_native_libraries_lib) |lib_doc| {
|
||||
reader::tagged_docs(libraries, tag_native_libraries_lib, |lib_doc| {
|
||||
result.push(lib_doc.as_str());
|
||||
true
|
||||
};
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ impl Context {
|
||||
let rlib_prefix = format!("lib{}-", crate_name);
|
||||
|
||||
let mut matches = ~[];
|
||||
do filesearch::search(filesearch) |path| {
|
||||
filesearch::search(filesearch, |path| {
|
||||
match path.filename_str() {
|
||||
None => FileDoesntMatch,
|
||||
Some(file) => {
|
||||
@ -135,7 +135,7 @@ impl Context {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
match matches.len() {
|
||||
0 => None,
|
||||
@ -180,7 +180,7 @@ impl Context {
|
||||
lib.rlib = Some(path.clone());
|
||||
return true;
|
||||
}
|
||||
Some(*) | None => {}
|
||||
Some(..) | None => {}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -200,7 +200,7 @@ impl Context {
|
||||
lib.dylib = Some(path.clone());
|
||||
return true;
|
||||
}
|
||||
Some(*) | None => {}
|
||||
Some(..) | None => {}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -360,7 +360,7 @@ pub fn list_file_metadata(sess: Session,
|
||||
let crate_name = path.filename_str().unwrap();
|
||||
let crate_name = if crate_name.starts_with("lib") {
|
||||
crate_name.slice_from(3) } else { crate_name };
|
||||
let crate_name = crate_name.split_iter('-').next().unwrap();
|
||||
let crate_name = crate_name.split('-').next().unwrap();
|
||||
match get_metadata_section(sess, os, path, crate_name) {
|
||||
option::Some(bytes) => decoder::list_crate_metadata(intr, bytes, out),
|
||||
option::None => {
|
||||
|
@ -808,7 +808,7 @@ fn check_heap_item(cx: &Context, it: &ast::item) {
|
||||
}
|
||||
|
||||
static crate_attrs: &'static [&'static str] = &[
|
||||
"crate_type", "link", "feature", "no_uv", "no_main", "no_std",
|
||||
"crate_type", "feature", "no_uv", "no_main", "no_std",
|
||||
"desc", "comment", "license", "copyright", // not used in rustc now
|
||||
];
|
||||
|
||||
@ -830,7 +830,7 @@ static other_attrs: &'static [&'static str] = &[
|
||||
"deprecated", "experimental", "unstable", "stable", "locked", "frozen", //item stability
|
||||
"crate_map", "cfg", "doc", "export_name", "link_section", "no_freeze",
|
||||
"no_mangle", "no_send", "static_assert", "unsafe_no_drop_flag",
|
||||
"packed", "simd", "repr", "deriving", "unsafe_destructor",
|
||||
"packed", "simd", "repr", "deriving", "unsafe_destructor", "link",
|
||||
|
||||
//mod-level
|
||||
"path", "link_name", "link_args", "nolink", "macro_escape", "no_implicit_prelude",
|
||||
|
@ -46,6 +46,7 @@ via `close` and `delete` methods.
|
||||
#[crate_type = "dylib"];
|
||||
|
||||
#[feature(macro_rules, globs)];
|
||||
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
|
||||
|
||||
use std::cast::transmute;
|
||||
use std::cast;
|
||||
|
@ -723,7 +723,7 @@ extern {
|
||||
}
|
||||
|
||||
// various platform libraries required by libuv
|
||||
#[cfg(not(stage0))]
|
||||
#[cfg(not(stage0), not(target_os = "android"))]
|
||||
#[link(name = "pthread")]
|
||||
extern {}
|
||||
#[cfg(stage0)]
|
||||
|
@ -66,6 +66,7 @@
|
||||
|
||||
#[deny(non_camel_case_types)];
|
||||
#[deny(missing_doc)];
|
||||
#[allow(attribute_usage)]; // NOTE: remove after the next snapshot
|
||||
|
||||
// When testing libstd, bring in libuv as the I/O backend so tests can print
|
||||
// things and all of the std::io tests have an I/O interface to run on top
|
||||
|
@ -19,9 +19,9 @@ endif
|
||||
%.a: %.o
|
||||
ar crus $@ $<
|
||||
%.dylib: %.o
|
||||
ld -o $@ $< -dylib
|
||||
$(CC) -dynamiclib -Wl,-dylib -o $@ $<
|
||||
%.so: %.o
|
||||
ld -o $@ $< -shared
|
||||
$(CC) -o $@ $< -shared
|
||||
$(TMPDIR)/lib%.o: %.c
|
||||
$(CC) -c -o $@ $<
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
// xfail-pretty
|
||||
// aux-build:anon-extern-mod-cross-crate-1.rs
|
||||
extern mod anonexternmod;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
// xfail-pretty
|
||||
// aux-build:foreign_lib.rs
|
||||
|
||||
// The purpose of this test is to check that we can
|
||||
|
Loading…
x
Reference in New Issue
Block a user