From 5bf2fc0ffacb4379b509f7ac922fedc8a3e5f2c5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 2 Oct 2019 12:06:00 -0700 Subject: [PATCH] Don't enable Lightbeam tests if Lightbeam isn't enabled. --- build.rs | 6 +++++- src/bin/wast.rs | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 1debf375c0..50c38277f1 100644 --- a/build.rs +++ b/build.rs @@ -14,7 +14,11 @@ fn main() { let mut out = File::create(out_dir.join("wast_testsuite_tests.rs")) .expect("error generating test source file"); - for strategy in &["AlwaysCranelift", "AlwaysLightbeam"] { + for strategy in &[ + "AlwaysCranelift", + #[cfg(feature = "lightbeam")] + "AlwaysLightbeam", + ] { writeln!(out, "#[allow(non_snake_case)]").expect("generating tests"); writeln!(out, "mod {} {{", strategy).expect("generating tests"); diff --git a/src/bin/wast.rs b/src/bin/wast.rs index 8d7866aeb4..b87a8ede01 100644 --- a/src/bin/wast.rs +++ b/src/bin/wast.rs @@ -154,7 +154,10 @@ fn main() { // Decide how to compile. let strategy = match (args.flag_always_lightbeam, args.flag_always_cranelift) { + #[cfg(feature = "lightbeam")] (true, false) => CompilationStrategy::AlwaysLightbeam, + #[cfg(not(feature = "lightbeam"))] + (true, false) => panic!("--always-lightbeam given, but Lightbeam support is not enabled"), (false, true) => CompilationStrategy::AlwaysCranelift, (false, false) => CompilationStrategy::Auto, (true, true) => {