Skip to content

Commit

Permalink
test: Don't write files into the source tree
Browse files Browse the repository at this point in the history
Tweak a few run-make tests to emit files in the output directories, not directly
in the source tree.
  • Loading branch information
alexcrichton committed Oct 14, 2016
1 parent 40cd1fd commit 094c3a2
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
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
@@ -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
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 094c3a2

Please sign in to comment.