rust/src/test/run-make/codegen-options-parsing/Makefile

34 lines
1.4 KiB
Makefile
Raw Normal View History

-include ../tools.mk
2017-09-25 14:26:25 -05:00
LOG = $(TMPDIR)/log.txt
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)
$(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)
$(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)
$(RUSTC) -C lto dummy.rs
# Should not link dead code...
$(RUSTC) -Z print-link-args dummy.rs 2>&1 | \
grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\<ignore\>' -e '-dead_strip' -e '/OPT:REF'
# ... unless you specifically ask to keep it
$(RUSTC) -Z print-link-args -C link-dead-code dummy.rs 2>&1 | \
(! grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\<ignore\>' -e '-dead_strip' -e '/OPT:REF')