diff options
author | Ricardo M. Correia <rcorreia@wizy.org> | 2014-09-30 16:11:26 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-10-01 02:34:25 +0100 |
commit | 272c44f1a5769f1d93c4605d6a76fa502e3b4fe4 (patch) | |
tree | a31caafabe540edbe121046e0d6675c6c431d7f5 | |
parent | 516be15130a2f0a8c55d309e3f8c61b989c18575 (diff) | |
download | nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.tar nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.tar.gz nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.tar.bz2 nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.tar.lz nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.tar.xz nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.tar.zst nixlib-272c44f1a5769f1d93c4605d6a76fa502e3b4fe4.zip |
rustcMaster: Fix test_override_env and enable tests
We also need to disable parallel building due to rust-lang/rust#16305. Closes #4339
-rw-r--r-- | pkgs/development/compilers/rustc/head.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/rustc/override_env.HEAD.patch | 39 |
2 files changed, 50 insertions, 4 deletions
diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix index b2c5d8740751..ab3458f435b8 100644 --- a/pkgs/development/compilers/rustc/head.nix +++ b/pkgs/development/compilers/rustc/head.nix @@ -1,4 +1,6 @@ -{stdenv, fetchurl, fetchgit, which, file, perl, curl, python27, makeWrapper}: +{ stdenv, fetchurl, fetchgit, which, file, perl, curl, python27, makeWrapper +, tzdata, git +}: assert stdenv.gcc.gcc != null; @@ -63,7 +65,7 @@ in stdenv.mkDerivation { configureFlags = [ "--enable-local-rust" "--local-rust-root=$snapshot" ]; # The compiler requires cc, so we patch the source to tell it where to find it - patches = [ ./hardcode_paths.HEAD.patch ./local_stage0.HEAD.patch ]; + patches = [ ./hardcode_paths.HEAD.patch ./local_stage0.HEAD.patch ./override_env.HEAD.patch ]; postPatch = '' substituteInPlace src/librustc/back/link.rs \ --subst-var-by "ccPath" "${stdenv.gcc}/bin/cc" @@ -71,6 +73,11 @@ in stdenv.mkDerivation { --subst-var-by "arPath" "${stdenv.gcc.binutils}/bin/ar" ''; - buildInputs = [ which file perl curl python27 makeWrapper ]; - enableParallelBuilding = true; + buildInputs = [ which file perl curl python27 makeWrapper git ]; + + enableParallelBuilding = false; # disabled due to rust-lang/rust#16305 + + preCheck = "export TZDIR=${tzdata}/share/zoneinfo"; + + doCheck = true; } diff --git a/pkgs/development/compilers/rustc/override_env.HEAD.patch b/pkgs/development/compilers/rustc/override_env.HEAD.patch new file mode 100644 index 000000000000..c050cde96339 --- /dev/null +++ b/pkgs/development/compilers/rustc/override_env.HEAD.patch @@ -0,0 +1,39 @@ +commit 02f4c61bd6a2aedbf56169aff5b3a65c83c89557 +Author: Ricardo M. Correia <rcorreia@wizy.org> +Date: Tue Sep 30 15:57:06 2014 +0200 + + libstd: Pass-through PATH in test_override_env test + + In some operating systems (such as NixOS), `env` can only be found in + the explicitly-provided PATH, not in default places such as /bin or + /usr/bin. So we need to pass-through PATH when spawning the `env` + sub-process. + +diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs +index 83890d2..8fbf254 100644 +--- a/src/libstd/io/process.rs ++++ b/src/libstd/io/process.rs +@@ -956,7 +956,22 @@ mod tests { + }) + + iotest!(fn test_override_env() { +- let new_env = vec![("RUN_TEST_NEW_ENV", "123")]; ++ use os; ++ let mut new_env = vec![("RUN_TEST_NEW_ENV", "123")]; ++ ++ // In some operating systems (such as NixOS), `env` can only be found in ++ // the explicitly-provided PATH env variable, not in default places ++ // such as /bin or /usr/bin. So we need to pass through PATH to our ++ // sub-process. ++ let path_val: String; ++ match os::getenv("PATH") { ++ None => {} ++ Some(val) => { ++ path_val = val; ++ new_env.push(("PATH", path_val.as_slice())) ++ } ++ } ++ + let prog = env_cmd().env_set_all(new_env.as_slice()).spawn().unwrap(); + let result = prog.wait_with_output().unwrap(); + let output = String::from_utf8_lossy(result.output.as_slice()).into_string(); |