Skip to content

Commit 3d65531

Browse files
committed
---
yaml --- r: 1739 b: refs/heads/master c: 4691a75 h: refs/heads/master i: 1737: e2442d2 1735: 787a63f v: v3
1 parent 75fe7dd commit 3d65531

File tree

3 files changed

+107
-34
lines changed

3 files changed

+107
-34
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 74a585eeb764882a482f1092d3701426023ea151
2+
refs/heads/master: 4691a7515079c56895bae727b2b7aa92a784f1a4

trunk/Makefile.in

+103-17
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ifdef CFG_WINDOWSY
7070
CFG_LIB_NAME=$(1).dll
7171
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_BINDIR)
7272
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
73-
CFG_RUN_PROGRAM=PATH=$(CFG_LDPATH) $(1)
73+
CFG_RUN_TARG=PATH=$(CFG_LDPATH) $(1)
7474

7575
CFG_PATH_MUNGE := $(strip | perl -p \
7676
-e 's@\\(.)@/\1@go;' \
@@ -87,7 +87,7 @@ ifdef CFG_UNIXY
8787

8888
CFG_EXE_SUFFIX :=
8989
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_LIBDIR)
90-
CFG_RUN_PROGRAM=\
90+
CFG_RUN_TARG=\
9191
LD_LIBRARY_PATH=$(dir $(1)):$(CFG_LDPATH) $(CFG_VALGRIND) $(1)
9292

9393
CFG_BOOT_NATIVE := 1
@@ -97,7 +97,7 @@ ifdef CFG_UNIXY
9797
CFG_LIB_NAME=$(1).dll
9898
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_BINDIR)
9999
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
100-
CFG_RUN_PROGRAM=PATH=$(CFG_LDPATH) $(1)
100+
CFG_RUN_TARG=PATH=$(CFG_LDPATH) $(1)
101101

102102
CFG_INFO := $(info cfg: mingw-cross)
103103
CFG_GCC_CROSS := i586-mingw32msvc-
@@ -178,7 +178,7 @@ else
178178
E = echo $(1)
179179
endif
180180

181-
R := $(CFG_RUN_PROGRAM)
181+
R := $(CFG_RUN_TARG)
182182
S := $(CFG_SRC_DIR)
183183
X := $(CFG_EXE_SUFFIX)
184184

@@ -187,8 +187,8 @@ VPATH := $(S)doc $(S)src
187187

188188
# Compilers we build, we now know how to run.
189189
BOOT := $(Q)OCAMLRUNPARAM="b1" boot/rustboot$(X) $(CFG_BOOT_FLAGS) -L stage0
190-
STAGE0 := $(Q)$(CFG_RUN_PROGRAM) stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage1
191-
STAGE1 := $(Q)$(CFG_RUN_PROGRAM) stage1/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage2
190+
STAGE0 := $(Q)$(CFG_RUN_TARG) stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage1
191+
STAGE1 := $(Q)$(CFG_RUN_TARG) stage1/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage2
192192

193193
# "Source" files we generate in builddir along the way.
194194
GENERATED := boot/fe/lexer.ml boot/version.ml
@@ -336,17 +336,26 @@ COMPILER_CRATE := comp/rustc.rc
336336
COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
337337
rustc.rc *.rs */*.rs))
338338

339+
######################################################################
340+
# test dependency variables
341+
######################################################################
342+
343+
LREQ := rt/$(CFG_RUNTIME) llvmext/$(CFG_LLVMEXT)
344+
BREQ := boot/rustboot$(X) boot/$(CFG_STDLIB)
345+
SREQ0 := stage0/rustc$(X) $(LREQ)
346+
SREQ1 := stage1/rustc$(X) $(LREQ)
347+
339348
######################################################################
340349
# Single-target rules
341350
######################################################################
342351

343352
all: boot/rustboot$(X) \
353+
boot/$(CFG_STDLIB) \
344354
rt/$(CFG_RUNTIME) \
345355
llvmext/$(CFG_LLVMEXT) \
346-
stage0/$(CFG_STDLIB) \
347-
stage1/$(CFG_STDLIB) \
348356
stage0/rustc$(X) \
349357
stage0/glue.o \
358+
stage0/$(CFG_STDLIB) \
350359
$(GENERATED)
351360

352361
rt/$(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR)
@@ -375,27 +384,25 @@ boot/version.ml: $(MKFILES)
375384
--pretty=format:'let version = "prerelease (%h %ci)";;' >$@ || exit 1
376385

377386

378-
stage0/$(CFG_STDLIB): $(S)src/$(STDLIB_CRATE) $(STDLIB_INPUTS) \
379-
boot/rustboot$(X) $(MKFILES)
387+
boot/$(CFG_STDLIB): $(S)src/$(STDLIB_CRATE) $(STDLIB_INPUTS) \
388+
boot/rustboot$(X) $(MKFILES)
380389
@$(call E, compile: $@)
381390
$(BOOT) -shared -o $@ $<
382391

383-
stage1/$(CFG_STDLIB): $(S)src/$(STDLIB_CRATE) $(STDLIB_INPUTS) \
392+
stage0/$(CFG_STDLIB): $(S)src/$(STDLIB_CRATE) $(STDLIB_INPUTS) \
384393
stage0/rustc$(X) $(MKFILES)
385394
@$(call E, compile: $@)
386395
$(STAGE0) -shared -o $@ $<
387396

388397

389398
stage0/rustc$(X): $(S)src/$(COMPILER_CRATE) $(COMPILER_INPUTS) \
390-
boot/rustboot$(X) rt/$(CFG_RUNTIME) \
391-
stage0/$(CFG_STDLIB)
399+
$(BREQ)
392400
@$(call E, compile: $@)
393401
$(BOOT) -minimal -o $@ $<
394402
$(Q)chmod 0755 $@
395403

396404
stage1/rustc$(X): $(S)src/$(COMPILER_CRATE) $(COMPILER_INPUTS) \
397-
stage0/rustc$(X) rt/$(CFG_RUNTIME) \
398-
stage1/$(CFG_STDLIB)
405+
$(SREQ0) stage0/$(CFG_STDLIB)
399406
@$(call E, compile: $@)
400407
$(STAGE0) -o $@ $<
401408
$(Q)chmod 0755 $@
@@ -412,7 +419,7 @@ stage1/glue.bc: stage1/rustc$(X) stage1/$(CFG_STDLIB) \
412419
$(STAGE1) -o $@ -glue
413420

414421
######################################################################
415-
# Pattern rules
422+
# Library and boot rules
416423
######################################################################
417424

418425
rt/%.o: rt/%.cpp $(MKFILES)
@@ -437,6 +444,35 @@ llvmext/%.o: llvmext/%.cpp $(MKFILES)
437444
@$(call E, lex-gen: $@)
438445
$(Q)ocamllex$(OPT) -q -o $@ $<
439446

447+
448+
######################################################################
449+
# Testing rules
450+
######################################################################
451+
452+
%.boot$(X): %.rs $(BREQ)
453+
@$(call E, compile [boot]: $@)
454+
$(BOOT) -o $@ $<
455+
456+
%.boot$(X): %.rc $(BREQ)
457+
@$(call E, compile [boot]: $@)
458+
$(BOOT) -o $@ $<
459+
460+
%.stage0$(X): %.o rt/$(CFG_RUNTIME) stage0/glue.o
461+
@$(call E, link [llvm]: $@)
462+
$(Q)gcc $(CFG_GCC_CFLAGS) stage0/glue.o -o $@ $< -Lstage0 -lrustrt
463+
@# dsymutil sometimes fails or prints a warning, but the
464+
@# program still runs. Since it simplifies debugging other
465+
@# programs, I\'ll live with the noise.
466+
-$(Q)$(DSYMUTIL) $@
467+
468+
%.stage0.bc: %.rc $(SREQ0)
469+
@$(call E, compile [stage0]: $@)
470+
$(STAGE0) -o $@ $<
471+
472+
%.stage0.bc: %.rs $(SREQ0)
473+
@$(call E, compile [stage0]: $@)
474+
$(STAGE0) -o $@ $<
475+
440476
%.o: %.s
441477
@$(call E, assemble [llvm]: $@)
442478
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
@@ -445,11 +481,61 @@ llvmext/%.o: llvmext/%.cpp $(MKFILES)
445481
@$(call E, dis [llvm]: $@)
446482
$(Q)$(CFG_LLVM_BINDIR)/llvm-dis -o $@ $<
447483

448-
449484
%.s: %.bc
450485
@$(call E, compile [llvm]: $@)
451486
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
452487

488+
# Cancel the implicit .out rule in GNU make.
489+
%.out: %
490+
491+
%.out: %.out.tmp
492+
$(Q)mv $< $@
493+
494+
test/run-pass/%.out.tmp: test/run-pass/%$(CFG_EXE_SUFFIX) rt/$(CFG_RUNTIME)
495+
$(Q)rm -f $<.tmp
496+
@$(call E, run: $@)
497+
$(Q)$(call CFG_RUN_TARG, $<) > $@
498+
499+
test/bench/shootout/%.out.tmp: test/bench/shootout/%$(X) \
500+
rt/$(CFG_RUNTIME)
501+
$(Q)rm -f $<.tmp
502+
@$(call E, run: $@)
503+
$(Q)$(call CFG_RUN_TARG, $<) > $@
504+
505+
test/bench/99-bottles/%.out.tmp: test/bench/99-bottles/%$(X) \
506+
rt/$(CFG_RUNTIME)
507+
$(Q)rm -f $<.tmp
508+
@$(call E, run: $@)
509+
$(Q)$(call CFG_RUN_TARG, $<) > $@
510+
511+
test/run-fail/%.out.tmp: test/run-fail/%$(X) \
512+
rt/$(CFG_RUNTIME)
513+
$(Q)rm -f $<.tmp
514+
@$(call E, run: $@)
515+
$(Q)grep -q error-pattern $(S)src/test/run-fail/$(basename $*).rs
516+
$(Q)rm -f $@
517+
$(Q)$(call CFG_RUN_TARG, $<) >$@ 2>&1 ; X=$$? ; \
518+
if [ $$X -eq 0 ] ; then exit 1 ; else exit 0 ; fi
519+
$(Q)grep --text --quiet \
520+
"$$(grep error-pattern $(S)src/test/run-fail/$(basename $*).rs \
521+
| cut -d : -f 2- | tr -d '\n\r')" $@
522+
523+
test/compile-fail/%.boot.out.tmp: test/compile-fail/%.rs $(BREQ)
524+
@$(call E, compile [boot]: $@)
525+
$(Q)grep -q error-pattern $<
526+
$(Q)rm -f $@
527+
$(BOOT) -o $(@:.out=$(X)) $< >$@ 2>&1; test $$? -ne 0
528+
$(Q)grep --text --quiet \
529+
"$$(grep error-pattern $< | cut -d : -f 2- | tr -d '\n\r')" $@
530+
531+
test/compile-fail/%.stage0.out.tmp: test/compile-fail/%.rs $(SREQ0)
532+
@$(call E, compile [stage0]: $@)
533+
$(Q)grep -q error-pattern $<
534+
$(Q)rm -f $@
535+
$(STAGE0) -o $(@:.out=$(X)) $< >$@ 2>&1; test $$? -ne 0
536+
$(Q)grep --text --quiet \
537+
"$$(grep error-pattern $< | cut -d : -f 2- | tr -d '\n\r')" $@
538+
453539

454540
######################################################################
455541
# Cleanup

trunk/configure

+3-16
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ copy() {
3333
cp $1 $2
3434
}
3535

36-
make_test_subdirs() {
37-
for t in run-pass run-fail compile-fail
38-
do
39-
make_dir $1/test/$t
40-
done
41-
}
42-
4336
putvar() {
4437
local T
4538
eval T=\$$1
@@ -89,19 +82,13 @@ for i in \
8982
doc \
9083
boot/fe boot/me boot/be boot/driver boot/util \
9184
rt rt/isaac rt/bigint rt/sync rt/test \
92-
llvmext
85+
llvmext \
86+
state0 stage1 stage2 \
87+
test/run-pass test/run-fail test/compile-fail
9388
do
9489
make_dir $i
9590
done
9691

97-
make_test_subdirs boot
98-
99-
for i in 0 1 2
100-
do
101-
make_dir stage$i
102-
make_test_subdirs stage$i
103-
done
104-
10592
msg "inspecting environment"
10693

10794
CFG_OSTYPE=$(uname -s)

0 commit comments

Comments
 (0)