Skip to content

Commit

Permalink
auto merge of #8866 : brson/rust/rvstdrun, r=alexcrichton
Browse files Browse the repository at this point in the history
...ing, r=brson"

This reverts commit b8d1fa3, reversing
changes made to f22b4b1.

Conflicts:
	mk/rt.mk
	src/libuv

This caused a big performance regression on the windows bots and possibly some unexpected segfaults in pretty-printing tests.
  • Loading branch information
bors committed Aug 29, 2013
2 parents 698873e + 3c5a43e commit 5ef8cdb
Show file tree
Hide file tree
Showing 27 changed files with 1,126 additions and 1,158 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
branch = master
[submodule "src/libuv"]
path = src/libuv
url = https://github.com/alexcrichton/libuv.git
url = https://github.com/brson/libuv.git
branch = master
46 changes: 10 additions & 36 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -168,58 +168,36 @@ LIBUV_DEPS := $$(wildcard \
$$(S)src/libuv/*/*/*/*)
endif

LIBUV_GYP := $$(S)src/libuv/build/gyp
LIBUV_MAKEFILE_$(1)_$(2) := $$(CFG_BUILD_DIR)rt/$(1)/stage$(2)/libuv/Makefile
LIBUV_NO_LOAD = run-benchmarks.target.mk run-tests.target.mk \
uv_dtrace_header.target.mk uv_dtrace_provider.target.mk

ifeq ($(OSTYPE_$(1)), linux-androideabi)
$$(LIBUV_MAKEFILE_$(1)_$(2)): $$(LIBUV_GYP)
(cd $(S)src/libuv/ && \
$$(CFG_PYTHON) ./gyp_uv -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) -D ninja -DOS=android \
-Goutput_dir=$$(@D) --generator-output $$(@D))
else
$$(LIBUV_MAKEFILE_$(1)_$(2)): $$(LIBUV_GYP)
(cd $(S)src/libuv/ && \
$$(CFG_PYTHON) ./gyp_uv -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) -D ninja \
-Goutput_dir=$$(@D) --generator-output $$(@D))
endif

# XXX: Shouldn't need platform-specific conditions here
ifdef CFG_WINDOWSY_$(1)
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
$$(Q)rm -f $$(S)src/libuv/libuv.a
$$(Q)$$(MAKE) -C $$(S)src/libuv -f Makefile.mingw \
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
AR="$$(AR_$(1))" \
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
OS=mingw \
V=$$(VERBOSE)
$$(Q)cp $$(S)src/libuv/libuv.a $$@
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)_$(2))
$$(Q)$$(MAKE) -C $$(@D) \
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
LINK="$$(CXX_$(1))" \
AR="$$(AR_$(1))" \
host=android OS=linux \
PLATFORM=android \
builddir="." \
BUILDTYPE=Release \
NO_LOAD="$$(LIBUV_NO_LOAD)" \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
host=android OS=linux \
V=$$(VERBOSE)
else
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)_$(2))
$$(Q)$$(MAKE) -C $$(@D) \
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
AR="$$(AR_$(1))" \
builddir="." \
BUILDTYPE=Release \
NO_LOAD="$$(LIBUV_NO_LOAD)" \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/libuv" \
V=$$(VERBOSE)
endif

Expand Down Expand Up @@ -283,7 +261,3 @@ endef
$(foreach stage,$(STAGES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_RUNTIME_TARGETS,$(target),$(stage)))))

$(LIBUV_GYP):
mkdir -p $(S)src/libuv/build
git clone https://git.chromium.org/external/gyp.git $(S)src/libuv/build/gyp
4 changes: 2 additions & 2 deletions src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ pub fn run(lib_path: &str,
in_fd: None,
out_fd: None,
err_fd: None
}).unwrap();
});

for input in input.iter() {
proc.input().write(input.as_bytes());
proc.input().write_str(*input);
}
let output = proc.finish_with_output();

Expand Down
29 changes: 27 additions & 2 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,41 @@ use procsrv;
use util;
use util::logv;

use std::cell::Cell;
use std::io;
use std::os;
use std::str;
use std::task::{spawn_sched, SingleThreaded};
use std::vec;
use std::unstable::running_on_valgrind;

use extra::test::MetricMap;

pub fn run(config: config, testfile: ~str) {
let mut _mm = MetricMap::new();
run_metrics(config, testfile, &mut _mm);
let config = Cell::new(config);
let testfile = Cell::new(testfile);
// FIXME #6436: Creating another thread to run the test because this
// is going to call waitpid. The new scheduler has some strange
// interaction between the blocking tasks and 'friend' schedulers
// that destroys parallelism if we let normal schedulers block.
// It should be possible to remove this spawn once std::run is
// rewritten to be non-blocking.
//
// We do _not_ create another thread if we're running on V because
// it serializes all threads anyways.
if running_on_valgrind() {
let config = config.take();
let testfile = testfile.take();
let mut _mm = MetricMap::new();
run_metrics(config, testfile, &mut _mm);
} else {
do spawn_sched(SingleThreaded) {
let config = config.take();
let testfile = testfile.take();
let mut _mm = MetricMap::new();
run_metrics(config, testfile, &mut _mm);
}
}
}

pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) {
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/markdown_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ fn pandoc_writer(
];
do generic_writer |markdown| {
use std::io::WriterUtil;
debug!("pandoc cmd: %s", pandoc_cmd);
debug!("pandoc args: %s", pandoc_args.connect(" "));

let proc = run::Process::new(pandoc_cmd, pandoc_args,
run::ProcessOptions::new());
let mut proc = proc.unwrap();
let mut proc = run::Process::new(pandoc_cmd, pandoc_args, run::ProcessOptions::new());

proc.input().write(markdown.as_bytes());
proc.input().write_str(markdown);
let output = proc.finish_with_output();

debug!("pandoc result: %i", output.status);
Expand Down
2 changes: 1 addition & 1 deletion src/librustpkg/source_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub fn git_clone_general(source: &str, target: &Path, v: &Version) -> bool {

fn process_output_in_cwd(prog: &str, args: &[~str], cwd: &Path) -> ProcessOutput {
let mut prog = Process::new(prog, args, ProcessOptions{ dir: Some(cwd)
,..ProcessOptions::new()}).unwrap();
,..ProcessOptions::new()});
prog.finish_with_output()
}

Expand Down
14 changes: 6 additions & 8 deletions src/librustpkg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,13 @@ fn mk_temp_workspace(short_name: &Path, version: &Version) -> Path {

fn run_git(args: &[~str], env: Option<~[(~str, ~str)]>, cwd: &Path, err_msg: &str) {
let cwd = (*cwd).clone();
let prog = run::Process::new("git", args, run::ProcessOptions {
let mut prog = run::Process::new("git", args, run::ProcessOptions {
env: env,
dir: Some(&cwd),
in_fd: None,
out_fd: None,
err_fd: None
});
let mut prog = prog.unwrap();
let rslt = prog.finish_with_output();
if rslt.status != 0 {
fail!("%s [git returned %?, output = %s, error = %s]", err_msg,
Expand Down Expand Up @@ -227,7 +226,7 @@ fn command_line_test_with_env(args: &[~str], cwd: &Path, env: Option<~[(~str, ~s
in_fd: None,
out_fd: None,
err_fd: None
}).unwrap();
});
let output = prog.finish_with_output();
debug!("Output from command %s with args %? was %s {%s}[%?]",
cmd, args, str::from_bytes(output.output),
Expand Down Expand Up @@ -1028,17 +1027,16 @@ fn test_extern_mod() {
test_sysroot().to_str(),
exec_file.to_str());

let prog = run::Process::new(rustc.to_str(), [main_file.to_str(),
~"--sysroot", test_sysroot().to_str(),
~"-o", exec_file.to_str()],
run::ProcessOptions {
let mut prog = run::Process::new(rustc.to_str(), [main_file.to_str(),
~"--sysroot", test_sysroot().to_str(),
~"-o", exec_file.to_str()],
run::ProcessOptions {
env: env,
dir: Some(&dir),
in_fd: None,
out_fd: None,
err_fd: None
});
let mut prog = prog.unwrap();
let outp = prog.finish_with_output();
if outp.status != 0 {
fail!("output was %s, error was %s",
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/rt/io/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ pub struct FileStream {
last_nread: int,
}

impl FileStream {
}

impl Reader for FileStream {
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
match self.fd.read(buf) {
Expand Down
3 changes: 0 additions & 3 deletions src/libstd/rt/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,6 @@ pub use self::extensions::WriterByteConversions;
/// Synchronous, non-blocking file I/O.
pub mod file;

/// Synchronous, in-memory I/O.
pub mod pipe;

/// Synchronous, non-blocking network I/O.
pub mod net {
pub mod tcp;
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/rt/io/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rt::io::{io_error, read_error, EndOfFile};
use rt::rtio::{IoFactory, IoFactoryObject,
RtioSocket, RtioTcpListener,
RtioTcpListenerObject, RtioTcpStream,
RtioTcpStreamObject, RtioStream};
RtioTcpStreamObject};
use rt::local::Local;

pub struct TcpStream(~RtioTcpStreamObject);
Expand Down Expand Up @@ -69,7 +69,7 @@ impl TcpStream {

impl Reader for TcpStream {
fn read(&mut self, buf: &mut [u8]) -> Option<uint> {
match (***self).read(buf) {
match (**self).read(buf) {
Ok(read) => Some(read),
Err(ioerr) => {
// EOF is indicated by returning None
Expand All @@ -86,7 +86,7 @@ impl Reader for TcpStream {

impl Writer for TcpStream {
fn write(&mut self, buf: &[u8]) {
match (***self).write(buf) {
match (**self).write(buf) {
Ok(_) => (),
Err(ioerr) => io_error::cond.raise(ioerr),
}
Expand Down Expand Up @@ -166,7 +166,7 @@ mod test {
do run_in_newsched_task {
let mut called = false;
do io_error::cond.trap(|e| {
assert_eq!(e.kind, ConnectionRefused);
assert!(e.kind == ConnectionRefused);
called = true;
}).inside {
let addr = SocketAddr { ip: Ipv4Addr(0, 0, 0, 0), port: 1 };
Expand Down
77 changes: 0 additions & 77 deletions src/libstd/rt/io/pipe.rs

This file was deleted.

Loading

0 comments on commit 5ef8cdb

Please sign in to comment.