2014-11-15 07:51:22 -06:00
|
|
|
-include ../tools.mk
|
|
|
|
|
2017-09-25 14:26:25 -05:00
|
|
|
LOG = $(TMPDIR)/log.txt
|
|
|
|
|
2014-11-15 07:51:22 -06:00
|
|
|
all:
|
|
|
|
#Option taking a number
|
2017-09-25 14:26:25 -05:00
|
|
|
$(RUSTC) -C codegen-units dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'codegen option `codegen-units` requires a number' $(LOG)
|
|
|
|
$(RUSTC) -C codegen-units= dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'incorrect value `` for codegen option `codegen-units` - a number was expected' $(LOG)
|
|
|
|
$(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' $(LOG)
|
2014-11-15 07:51:22 -06:00
|
|
|
$(RUSTC) -C codegen-units=1 dummy.rs
|
|
|
|
#Option taking a string
|
2017-09-25 14:26:25 -05:00
|
|
|
$(RUSTC) -C extra-filename dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'codegen option `extra-filename` requires a string' $(LOG)
|
2014-11-15 07:51:22 -06:00
|
|
|
$(RUSTC) -C extra-filename= dummy.rs 2>&1
|
|
|
|
$(RUSTC) -C extra-filename=foo dummy.rs 2>&1
|
|
|
|
#Option taking no argument
|
2017-09-25 14:26:25 -05:00
|
|
|
$(RUSTC) -C lto= dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'codegen option `lto` takes no value' $(LOG)
|
|
|
|
$(RUSTC) -C lto=1 dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'codegen option `lto` takes no value' $(LOG)
|
|
|
|
$(RUSTC) -C lto=foo dummy.rs 2>&1 | tee $(LOG)
|
|
|
|
grep 'codegen option `lto` takes no value' $(LOG)
|
2014-11-15 07:51:22 -06:00
|
|
|
$(RUSTC) -C lto dummy.rs
|
2016-02-02 11:56:59 -06:00
|
|
|
|
|
|
|
# Should not link dead code...
|
|
|
|
$(RUSTC) -Z print-link-args dummy.rs 2>&1 | \
|
2017-08-03 19:18:19 -05:00
|
|
|
grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\<ignore\>' -e '-dead_strip' -e '/OPT:REF'
|
2016-02-02 11:56:59 -06:00
|
|
|
# ... unless you specifically ask to keep it
|
|
|
|
$(RUSTC) -Z print-link-args -C link-dead-code dummy.rs 2>&1 | \
|
2017-08-03 19:18:19 -05:00
|
|
|
(! grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\<ignore\>' -e '-dead_strip' -e '/OPT:REF')
|