about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2017-06-20 13:37:58 -0700
committerThomas Lively <tlively@google.com>2017-06-22 18:34:56 -0700
commit447297ce597d2762db40afaa2349fc927c90f897 (patch)
treec78f7493384a6805b973a49d5b6a685d969072b0
parentbd62230fbdcaf6508dec02a59818f732bd4c1759 (diff)
downloadrust-447297ce597d2762db40afaa2349fc927c90f897.tar.gz
rust-447297ce597d2762db40afaa2349fc927c90f897.zip
Make wasm32 buildbot test LLVM backend
This adds the experimental targets option to configure so it can be used
by the builders and changes the wasm32 Dockerfile accordingly. Instead
of using LLVM from the emsdk, the builder's emscripten tools now uses
the Rust in-tree LLVM, since this is the one built with wasm support.
-rwxr-xr-xconfigure1
-rw-r--r--src/bootstrap/config.rs3
-rw-r--r--src/ci/docker/disabled/wasm32/Dockerfile6
-rw-r--r--src/ci/docker/scripts/emscripten.sh5
-rw-r--r--src/tools/compiletest/src/runtest.rs11
5 files changed, 19 insertions, 7 deletions
diff --git a/configure b/configure
index 2b493ee91b5..e08bcc02827 100755
--- a/configure
+++ b/configure
@@ -490,6 +490,7 @@ valopt musl-root-armhf "" "arm-unknown-linux-musleabihf install directory"
 valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory"
 valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
 valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this"
+valopt experimental-targets "" "experimental LLVM targets to build"
 
 if [ -e ${CFG_SRC_DIR}.git ]
 then
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 902cd0997a8..3ada846e382 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -497,6 +497,9 @@ impl Config {
                 "CFG_TARGET" if value.len() > 0 => {
                     self.target.extend(value.split(" ").map(|s| s.to_string()));
                 }
+                "CFG_EXPERIMENTAL_TARGETS" if value.len() > 0 => {
+                    self.llvm_experimental_targets = Some(value.to_string());
+                }
                 "CFG_MUSL_ROOT" if value.len() > 0 => {
                     self.musl_root = Some(parse_configure_path(value));
                 }
diff --git a/src/ci/docker/disabled/wasm32/Dockerfile b/src/ci/docker/disabled/wasm32/Dockerfile
index daf398ac096..f3dd48ae411 100644
--- a/src/ci/docker/disabled/wasm32/Dockerfile
+++ b/src/ci/docker/disabled/wasm32/Dockerfile
@@ -20,7 +20,7 @@ RUN sh /scripts/dumb-init.sh
 # emscripten
 COPY scripts/emscripten.sh /scripts/
 RUN bash /scripts/emscripten.sh
-COPY wasm32/node.sh /usr/local/bin/node
+COPY disabled/wasm32/node.sh /usr/local/bin/node
 
 # env
 ENV PATH=$PATH:/emsdk-portable
@@ -30,9 +30,9 @@ ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
 ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
 ENV EM_CONFIG=/emsdk-portable/.emscripten
 
-ENV TARGETS=wasm32-unknown-emscripten
+ENV TARGETS=wasm32-unknown-emscripten,wasm32-experimental-emscripten
 
-ENV RUST_CONFIGURE_ARGS --target=$TARGETS
+ENV RUST_CONFIGURE_ARGS --target=$TARGETS --experimental-targets=WebAssembly
 
 ENV SCRIPT python2.7 ../x.py test --target $TARGETS
 
diff --git a/src/ci/docker/scripts/emscripten.sh b/src/ci/docker/scripts/emscripten.sh
index 8aa5a98d7fc..516ef0ae0d2 100644
--- a/src/ci/docker/scripts/emscripten.sh
+++ b/src/ci/docker/scripts/emscripten.sh
@@ -40,9 +40,12 @@ hide_output ./emsdk install sdk-1.37.13-64bit
 source ./emsdk_env.sh
 echo "main(){}" > a.c
 HOME=/emsdk-portable/ emcc a.c
-HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
+HOME=/emsdk-portable/ emcc -s WASM=1 a.c
 rm -f a.*
 
+# Make emscripten use Rust's LLVM
+echo "LLVM_ROOT='/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/bin'" >> /root/.emscripten
+
 # Make emsdk usable by any user
 cp /root/.emscripten /emsdk-portable
 chmod a+rxw -R /emsdk-portable
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 01419c42570..3b3a94c6c58 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1280,6 +1280,12 @@ actual:\n\
         let extra_link_args = vec!["-L".to_owned(),
                                    aux_dir.to_str().unwrap().to_owned()];
 
+        let mut env = self.props.rustc_env.clone();
+        // Tell emscripten to link using libc produced with LLVM backend
+        if self.config.target.contains("wasm32") && self.config.target.contains("experimental") {
+            env.push(("EMCC_WASM_BACKEND".to_string(), "1".to_string()));
+        }
+
         for rel_ab in &self.props.aux_builds {
             let aux_testpaths = self.compute_aux_test_paths(rel_ab);
             let aux_props = self.props.from_aux_file(&aux_testpaths.file,
@@ -1319,7 +1325,7 @@ actual:\n\
             };
             let aux_args = aux_cx.make_compile_args(crate_type, &aux_testpaths.file, aux_output);
             let auxres = aux_cx.compose_and_run(aux_args,
-                                                Vec::new(),
+                                                env.clone(),
                                                 aux_cx.config.compile_lib_path.to_str().unwrap(),
                                                 Some(aux_dir.to_str().unwrap()),
                                                 None);
@@ -1332,13 +1338,12 @@ actual:\n\
         }
 
         self.compose_and_run(args,
-                             self.props.rustc_env.clone(),
+                             env,
                              self.config.compile_lib_path.to_str().unwrap(),
                              Some(aux_dir.to_str().unwrap()),
                              input)
     }
 
-
     fn compose_and_run(&self,
                        ProcArgs{ args, prog }: ProcArgs,
                        procenv: Vec<(String, String)> ,