From bd4b984537bd33c9625212c9ccbb3a6084001407 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 29 Apr 2015 17:18:44 +0200 Subject: [PATCH 1/3] add `--enable-debuginfo-tests`, analogous to `--disable-optimize-tests`. Then, decouple the question of whether the compiler/stdlib carry debuginfo (which is controlled via `--enable-debuginfo` and implied by `--enable-debug`) from the question of whether the tests carry debuginfo (which now no longer is implied by `--enable-debug` nor `--enable-debuginfo`, and is off by default). --- configure | 1 + mk/tests.mk | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/configure b/configure index f4e1d41276aa9..dbca73415fec6 100755 --- a/configure +++ b/configure @@ -551,6 +551,7 @@ opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind" opt docs 1 "build standard library documentation" opt compiler-docs 0 "build compiler documentation" opt optimize-tests 1 "build tests with optimizations" +opt debuginfo-tests 0 "build tests with debugger metadata" opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang" opt llvm-assertions 0 "build LLVM with assertions" opt debug-assertions 0 "build with debugging assertions" diff --git a/mk/tests.mk b/mk/tests.mk index 3c4818f65dade..f391d8555fc2b 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -632,6 +632,13 @@ ifndef CFG_DISABLE_OPTIMIZE_TESTS CTEST_RUSTC_FLAGS += -O endif +# Analogously to the above, whether to pass `-g` when compiling tests +# is a separate choice from whether to pass `-g` when building the +# compiler and standard library themselves. +CTEST_RUSTC_FLAGS := $$(subst -g,,$$(CTEST_RUSTC_FLAGS)) +ifdef CFG_ENABLE_DEBUGINFO_TESTS +CTEST_RUSTC_FLAGS += -g +endif CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \ --compile-lib-path $$(HLIB$(1)_H_$(3)) \ From 2007169583f4b1e98d4d69ed05a63fa4919753bf Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 29 Apr 2015 17:20:36 +0200 Subject: [PATCH 2/3] Allow `-g` and `-O` options to be specified multiple times at command line. --- src/librustc/session/config.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 072761f2754b3..b999929c4af9e 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -755,11 +755,14 @@ mod opt { pub fn multi(a: S, b: S, c: S, d: S) -> R { stable(getopts::optmulti(a, b, c, d)) } pub fn flag(a: S, b: S, c: S) -> R { stable(getopts::optflag(a, b, c)) } pub fn flagopt(a: S, b: S, c: S, d: S) -> R { stable(getopts::optflagopt(a, b, c, d)) } + pub fn flagmulti(a: S, b: S, c: S) -> R { stable(getopts::optflagmulti(a, b, c)) } + pub fn opt_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optopt(a, b, c, d)) } pub fn multi_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optmulti(a, b, c, d)) } pub fn flag_u(a: S, b: S, c: S) -> R { unstable(getopts::optflag(a, b, c)) } pub fn flagopt_u(a: S, b: S, c: S, d: S) -> R { unstable(getopts::optflagopt(a, b, c, d)) } + pub fn flagmulti_u(a: S, b: S, c: S) -> R { unstable(getopts::optflagmulti(a, b, c)) } } /// Returns the "short" subset of the rustc command line options, @@ -786,8 +789,8 @@ pub fn rustc_short_optgroups() -> Vec { opt::multi("", "print", "Comma separated list of compiler information to \ print on stdout", "[crate-name|file-names|sysroot]"), - opt::flag("g", "", "Equivalent to -C debuginfo=2"), - opt::flag("O", "", "Equivalent to -C opt-level=2"), + opt::flagmulti("g", "", "Equivalent to -C debuginfo=2"), + opt::flagmulti("O", "", "Equivalent to -C opt-level=2"), opt::opt("o", "", "Write output to ", "FILENAME"), opt::opt("", "out-dir", "Write output to compiler-chosen filename \ in ", "DIR"), From df82df8cf846246577507d32edcec14c6d3d0851 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 29 Apr 2015 18:54:20 +0200 Subject: [PATCH 3/3] Unit test ensuring we accept repeated `-g` and `-O`. --- .../run-pass/issue-24945-repeat-dash-opts.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/test/run-pass/issue-24945-repeat-dash-opts.rs diff --git a/src/test/run-pass/issue-24945-repeat-dash-opts.rs b/src/test/run-pass/issue-24945-repeat-dash-opts.rs new file mode 100644 index 0000000000000..33ac519a584f9 --- /dev/null +++ b/src/test/run-pass/issue-24945-repeat-dash-opts.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This test is just checking that we continue to accept `-g -g -O -O` +// as options to the compiler. + +// compile-flags:-g -g -O -O + +fn main() { + assert_eq!(1, 1); +}