Integrate shootout benchmarks into testsuite

This commit is contained in:
Brian Anderson 2011-03-06 18:35:07 -05:00 committed by Graydon Hoare
parent 242ecd0e96
commit 8438eca45c
2 changed files with 17 additions and 8 deletions

View file

@ -574,7 +574,8 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
while-type-error.rs \
wrong-ret-type.rs \
), \
$(wildcard test/*fail/*.rs test/*fail/*.rc))
$(wildcard test/*fail/*.rs test/*fail/*.rc)) \
test/bench/shootout/fasta.rs
ifdef MINGW_CROSS
@ -586,8 +587,10 @@ TEST_XFAILS_BOOT += test/run-pass/native-mod.rc
TEST_XFAILS_RUSTC += test/run-pass/native-mod.rc
endif
RPASS_RC := $(wildcard test/run-pass/*.rc)
RPASS_RS := $(wildcard test/run-pass/*.rs)
BENCH_RC := $(wildcard test/bench/shootout/*rc)
BENCH_RS := $(wildcard test/bench/shootout/*rs)
RPASS_RC := $(wildcard test/run-pass/*.rc) $(BENCH_RC)
RPASS_RS := $(wildcard test/run-pass/*.rs) $(BENCH_RS)
RFAIL_RC := $(wildcard test/run-fail/*.rc)
RFAIL_RS := $(wildcard test/run-fail/*.rs)
CFAIL_RC := $(wildcard test/compile-fail/*.rc)
@ -731,6 +734,12 @@ test/run-pass/%.out.tmp: test/run-pass/%$(CFG_EXE_SUFFIX) $(CFG_RUNTIME)
@$(call CFG_ECHO, run: $<)
$(CFG_QUIET)$(call CFG_RUN_TARG, $<) > $@
test/bench/shootout/%.out.tmp: test/bench/shootout/%$(CFG_EXE_SUFFIX) \
$(CFG_RUNTIME)
$(CFG_QUIET)rm -f $<.tmp
@$(call CFG_ECHO, run: $<)
$(CFG_QUIET)$(call CFG_RUN_TARG, $<) > $@
test/run-fail/%.out.tmp: test/run-fail/%$(CFG_EXE_SUFFIX) \
$(CFG_RUNTIME)
$(CFG_QUIET)rm -f $<.tmp

View file

@ -1,14 +1,14 @@
tag tree {
nil();
nil;
node(@tree, @tree, int);
}
fn item_check(&tree t) -> int {
alt (t) {
case (nil()) {
fn item_check(@tree t) -> int {
alt (*t) {
case (nil) {
ret 0;
}
case (node(@tree left, @tree right, int item)) {
case (node(?left, ?right, ?item)) {
ret item + item_check(left) - item_check(right);
}
}