Skip to content

Commit

Permalink
Rollup merge of rust-lang#37176 - alexcrichton:no-write-to-root, r=brson
Browse files Browse the repository at this point in the history
test: Don't write files into the source tree

Tweak a few run-make tests to emit files in the output directories, not directly
in the source tree.
  • Loading branch information
eddyb authored Oct 19, 2016
2 parents 5e6168f + 094c3a2 commit b9241bc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/test/run-make/dep-info-spaces/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
ifneq ($(shell uname),FreeBSD)
ifndef IS_WINDOWS
all:
$(RUSTC) --emit link,dep-info --crate-type=lib lib.rs
cp lib.rs $(TMPDIR)/
cp 'foo foo.rs' $(TMPDIR)/
cp bar.rs $(TMPDIR)/
$(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs
sleep 1
touch 'foo foo.rs'
touch $(TMPDIR)/'foo foo.rs'
-rm -f $(TMPDIR)/done
$(MAKE) -drf Makefile.foo
rm $(TMPDIR)/done
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-make/dep-info-spaces/Makefile.foo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
LIB := $(shell $(RUSTC) --print file-names --crate-type=lib lib.rs)
LIB := $(shell $(RUSTC) --print file-names --crate-type=lib $(TMPDIR)/lib.rs)

$(TMPDIR)/$(LIB):
$(RUSTC) --emit link,dep-info --crate-type=lib lib.rs
$(RUSTC) --emit link,dep-info --crate-type=lib $(TMPDIR)/lib.rs
touch $(TMPDIR)/done

-include $(TMPDIR)/lib.d
5 changes: 4 additions & 1 deletion src/test/run-make/llvm-phase/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use rustc_driver::driver::CompileController;
use rustc_trans::ModuleSource;
use rustc::session::Session;
use syntax::codemap::FileLoader;
use std::env;
use std::io;
use std::path::{PathBuf, Path};

Expand Down Expand Up @@ -75,9 +76,11 @@ fn main() {
path.pop();
path.pop();

let args: Vec<String> =
let mut args: Vec<String> =
format!("_ _ --sysroot {} --crate-type dylib", path.to_str().unwrap())
.split(' ').map(|s| s.to_string()).collect();
args.push("--out-dir".to_string());
args.push(env::var("TMPDIR").unwrap());

let (result, _) = rustc_driver::run_compiler(
&args, &mut JitCalls, Some(box JitLoader), None);
Expand Down

0 comments on commit b9241bc

Please sign in to comment.