Skip to content

Commit 5554f88

Browse files
committed
test: cleanup scripts for test
1 parent 8ea6cde commit 5554f88

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

Makefile

+12-8
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@ $(MM): $(OBJS)
1515

1616
$(OBJS): $(HEADERS)
1717

18-
.PHONY: selfhost
19-
selfhost: $(MMS)
20-
2118
$(MMS): $(MM)
2219
cat $(SRCS) > src/self.c
2320
$(MM) ./src/self.c > ./src/self.s
2421
$(CC) $(AFLAGS) ./src/self.s -o $@
2522

23+
.PHONY: test
24+
test: $(TEST_MM) src/lib.o
25+
$(TEST_MM) --test
26+
./test.sh $(TEST_MM)
27+
make -s $(TESTS_DIFFS) TEST_MM=$(TEST_MM)
28+
2629
.PHONY: diffs
2730
diffs: $(TESTS_DIFFS)
2831

@@ -32,11 +35,12 @@ diffs: $(TESTS_DIFFS)
3235
./$*.bin > $*.out
3336
diff $*.ans $*.out | tee $*.diff
3437

35-
.PHONY: test
36-
test: $(MM) src/lib.o
37-
$(MM) --test
38-
./test.sh
39-
make -s $(TESTS_DIFFS)
38+
.PHONY: selfhost
39+
selfhost: $(MMS)
40+
41+
.PHONY: test_selfhost
42+
test_selfhost: $(MMS)
43+
make -s test TEST_MM=$(MMS)
4044

4145
.PHONY: clean
4246
clean:

test.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
##!/bin/bash
22

3+
TEST_TARGET=$1
4+
35
try() {
46
expected="$1"
57
input="$2"
68

7-
echo "./9mm '$input'"
8-
./9mm --str "$input" >tmp.s
9+
echo "$TEST_TARGET --str '$input'"
10+
$TEST_TARGET --str "$input" >tmp.s
911
if [[ "$?" != "0" ]]; then
1012
echo 'Compilation error'
1113
exit 1

0 commit comments

Comments
 (0)