From 88b89f84766930b1d6d7be1c558290c40e55d4ff Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 11 Aug 2013 00:29:45 -0700 Subject: [PATCH] Allow disabling optimizations in tests only --- configure | 1 + mk/tests.mk | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 609a7c46e36d8..9129fc0e19e5e 100755 --- a/configure +++ b/configure @@ -371,6 +371,7 @@ opt docs 1 "build documentation" opt optimize 1 "build optimized rust code" opt optimize-cxx 1 "build optimized C++ code" opt optimize-llvm 1 "build optimized LLVM" +opt optimize-tests 1 "build tests with optimizations" opt llvm-assertions 1 "build LLVM with assertions" opt debug 0 "build with extra debug fun" opt ratchet-bench 0 "ratchet benchmarks" diff --git a/mk/tests.mk b/mk/tests.mk index 349ffc63d9701..e644248c370d2 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -552,7 +552,15 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \ # The tests select when to use debug configuration on their own; # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898). -CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS)) +CTEST_RUSTC_FLAGS := $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS)) + +# The tests can not be optimized while the rest of the compiler is optimized, so +# filter out the optimization (if any) from rustc and then figure out if we need +# to be optimized +CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS)) +ifndef CFG_DISABLE_OPTIMIZE_TESTS +CTEST_RUSTC_FLAGS += -O +endif CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \ --compile-lib-path $$(HLIB$(1)_H_$(3)) \