Skip to content

Commit 77d3e60

Browse files
committed
tests: Make with central config.mk
1 parent c530985 commit 77d3e60

File tree

12 files changed

+75
-40
lines changed

12 files changed

+75
-40
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/target
2+
/tests/config.mk
23
*.png

tests/Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
SUBDIRS := burghard censoredusername palaiologos voliva wconrad wsf \
2+
third_party/palaiologos third_party/voliva third_party/wconrad
3+
4+
.PHONY: all clean
5+
all: $(SUBDIRS:%=%.all)
6+
clean: $(SUBDIRS:%=%.clean)
7+
8+
.PHONY: %.all
9+
%.all:
10+
@echo make -C $* all
11+
@$(MAKE) -C $* all
12+
13+
.PHONY: %.clean
14+
%.clean:
15+
@echo make -C $* clean
16+
@$(MAKE) -C $* clean

tests/burghard/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
WSA = $(error 'Specify $$WSA')
1+
-include ../config.mk
2+
-include ../config.tmpl.mk
23

34
PASS = $(shell find pass -name '*.wsa')
45
FAIL = $(shell find fail -name '*.wsa')
@@ -9,10 +10,10 @@ ERR = $(FAIL:.wsa=.err)
910
all: $(WS) $(ERR)
1011

1112
%.ws: %.wsa
12-
$(WSA) --ext-syntax --ended $< > $@
13+
$(BURGHARD_WSA) --ext-syntax --ended $< > $@
1314

1415
%.err: %.wsa
15-
! $(WSA) --ext-syntax --ended $< 2> $@
16+
! $(BURGHARD_WSA) --ext-syntax --ended $< 2> $@
1617

1718
.PHONY: clean
1819
clean:

tests/censoredusername/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
WSC = $(error 'Specify $$WSC')
1+
-include ../config.mk
2+
-include ../config.tmpl.mk
23

34
PASS = $(shell find pass -name '*.wsa')
45
FAIL = $(shell find fail -name '*.wsa')
@@ -9,11 +10,11 @@ ERR = $(FAIL:.wsa=.err)
910
all: $(WS) $(ERR)
1011

1112
%.ws: %.wsa
12-
$(WSC) -t -f asm -o $@ $<
13+
$(CENSOREDUSERNAME_WSC) -t -f asm -o $@ $<
1314

1415
# Test for empty stdout, since wsc always exits with 0 unless it panics.
1516
%.err: %.wsa
16-
! $(WSC) -t -f asm $< 2> $@ > $<.out || ! test -s $<.out && rm $<.out
17+
! $(CENSOREDUSERNAME_WSC) -t -f asm $< 2> $@ > $<.out || ! test -s $<.out && rm $<.out
1718

1819
.PHONY: all
1920
clean:

tests/config.tmpl.mk

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copy this template to config.mk to configure paths to each of these
2+
# assemblers.
3+
4+
BURGHARD_WSA ?= $(error 'Configure $$BURGHARD_WSA in config.mk')
5+
CENSOREDUSERNAME_WSC ?= $(error 'Configure $$CENSOREDUSERNAME_WSC in config.mk')
6+
PALAIOLOGOS_WSI ?= $(error 'Configure $$PALAIOLOGOS_WSI in config.mk')
7+
VOLIVA_WSA_DIR ?= $(error 'Configure $$VOLIVA_WSA_DIR in config.mk')
8+
VOLIVA_CLI ?= $(VOLIVA_WSA_DIR)/dist/cli.js
9+
WCONRAD_ASM ?= $(error 'Configure $$WCONRAD_ASM in config.mk')
10+
WSF_ASSEMBLE ?= $(error 'Configure $$WSF_ASSEMBLE in config.mk')
11+
WSC_WSF ?= $(error 'Configure $$WSC_WSF in config.mk')
12+
13+
NODE ?= node
14+
RUBY ?= ruby
15+
16+
TIMEOUT_SECS ?= 1

tests/palaiologos/Makefile

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
WSI = $(error 'Specify $$WSI')
1+
-include ../config.mk
2+
-include ../config.tmpl.mk
23

34
PASS = $(shell find pass -name '*.asm' -o -name '*.bak')
45
FAIL = $(shell find fail -name '*.asm' -o -name '*.bak')
@@ -11,19 +12,19 @@ TIMEOUT = $(patsubst %.asm, %.timeout, $(patsubst %.bak, %.timeout, $(TIMEOUT_AS
1112
all: $(WS) $(ERR) $(TIMEOUT)
1213

1314
%.ws: %.asm
14-
$(WSI) --masm $< > $@
15+
$(PALAIOLOGOS_WSI) --masm $< > $@
1516
%.ws: %.bak
16-
$(WSI) --masm $< > $@
17+
$(PALAIOLOGOS_WSI) --masm $< > $@
1718

1819
%.err: %.asm
19-
! $(WSI) --masm $< 2> $@
20+
! $(PALAIOLOGOS_WSI) --masm $< 2> $@
2021
%.err: %.bak
21-
! $(WSI) --masm $< 2> $@
22+
! $(PALAIOLOGOS_WSI) --masm $< 2> $@
2223

2324
%.timeout: %.asm
24-
! timeout 2 $(WSI) --masm $< >/dev/null && touch $@
25+
! timeout $(TIMEOUT_SECS) $(PALAIOLOGOS_WSI) --masm $< >/dev/null && touch $@
2526
%.timeout: %.bak
26-
! timeout 2 $(WSI) --masm $< >/dev/null && touch $@
27+
! timeout $(TIMEOUT_SECS) $(PALAIOLOGOS_WSI) --masm $< >/dev/null && touch $@
2728

2829
.PHONY: clean
2930
clean:

tests/third_party/palaiologos/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
WSI = $(error 'Specify $$WSI')
1+
-include ../../config.mk
2+
-include ../../config.tmpl.mk
23

34
ASM = $(shell find . -name '*.asm' -o -name '*.bak')
45
WS = $(patsubst %.asm, %.ws, $(patsubst %.bak, %.ws, $(ASM)))
@@ -7,9 +8,9 @@ WS = $(patsubst %.asm, %.ws, $(patsubst %.bak, %.ws, $(ASM)))
78
all: $(WS)
89

910
%.ws: %.asm
10-
$(WSI) --masm $< > $@
11+
$(PALAIOLOGOS_WSI) --masm $< > $@
1112
%.ws: %.bak
12-
$(WSI) --masm $< > $@
13+
$(PALAIOLOGOS_WSI) --masm $< > $@
1314

1415
.PHONY: clean
1516
clean:

tests/third_party/voliva/Makefile

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
NODE = node
2-
WSA_DIR = $(error 'Specify $$WSA_DIR')
3-
CLI = $(WSA_DIR)/dist/cli.js
1+
-include ../../config.mk
2+
-include ../../config.tmpl.mk
43

54
PASS = $(filter-out $(FAIL), $(shell find . -name '*.wsa'))
65
FAIL =
@@ -11,14 +10,14 @@ ERR = $(FAIL:.wsa=.err)
1110
all: $(WS) $(ERR)
1211

1312
%.extensions.ws: %.extensions.wsa
14-
$(NODE) $(CLI) compile --extensions $< $@
13+
$(NODE) $(VOLIVA_CLI) compile --extensions $< $@
1514

1615
%.ws: %.wsa
17-
$(NODE) $(CLI) compile $< $@
16+
$(NODE) $(VOLIVA_CLI) compile $< $@
1817

1918
%.err: %.wsa
20-
! $(NODE) $(CLI) compile $< $(<:.wsa=.ws) 2> $@ >&2
21-
@sed -i.bak "s|$$(realpath $(WSA_DIR))|"'$$WSA|' $@
19+
! $(NODE) $(VOLIVA_CLI) compile $< $(<:.wsa=.ws) 2> $@ >&2
20+
@sed -i.bak "s|$$(realpath $(VOLIVA_WSA_DIR))|"'$$WSA|' $@
2221
@rm $@.bak
2322

2423
.PHONY: clean

tests/third_party/wconrad/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
RUBY = ruby
2-
ASM = $(error 'Specify $$ASM')
1+
-include ../../config.mk
2+
-include ../../config.tmpl.mk
33

44
WSA = $(shell find . -name '*.wsa')
55
WS = $(WSA:.wsa=.ws)
@@ -8,7 +8,7 @@ WS = $(WSA:.wsa=.ws)
88
all: $(WS)
99

1010
%.ws: %.wsa
11-
$(RUBY) $(ASM) $<
11+
$(RUBY) $(WCONRAD_ASM) $<
1212

1313
.PHONY: clean
1414
clean:

tests/voliva/Makefile

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
NODE = node
2-
WSA_DIR = $(error 'Specify $$WSA_DIR')
3-
CLI = $(WSA_DIR)/dist/cli.js
1+
-include ../config.mk
2+
-include ../config.tmpl.mk
43

54
PASS = $(shell find pass -name '*.wsa')
65
FAIL = $(shell find fail -name '*.wsa')
@@ -11,11 +10,11 @@ ERR = $(FAIL:.wsa=.err)
1110
all: $(WS) $(ERR)
1211

1312
%.ws: %.wsa
14-
$(NODE) $(CLI) compile --extensions $< $@
13+
$(NODE) $(VOLIVA_CLI) compile --extensions $< $@
1514

1615
%.err: %.wsa
17-
! $(NODE) $(CLI) compile --extensions $< $(<:.wsa=.ws) 2> $@ >&2
18-
@sed -i.bak "s|$$(realpath $(WSA_DIR))|"'$$WSA|' $@
16+
! $(NODE) $(VOLIVA_CLI) compile --extensions $< $(<:.wsa=.ws) 2> $@ >&2
17+
@sed -i.bak "s|$$(realpath $(VOLIVA_WSA_DIR))|"'$$WSA|' $@
1918
@rm $@.bak
2019

2120
.PHONY: clean

tests/wconrad/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
RUBY = ruby
2-
ASM = $(error 'Specify $$ASM')
1+
-include ../config.mk
2+
-include ../config.tmpl.mk
33

44
WSA = $(shell find . -name '*.wsa')
55
WS = $(WSA:.wsa=.ws)
@@ -8,7 +8,7 @@ WS = $(WSA:.wsa=.ws)
88
all: $(WS)
99

1010
%.ws: %.wsa
11-
$(RUBY) $(ASM) $<
11+
$(RUBY) $(WCONRAD_ASM) $<
1212

1313
.PHONY: clean
1414
clean:

tests/wsf/Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
WSF = wsf-assemble
2-
WSC = wsc-fork
1+
-include ../config.mk
2+
-include ../config.tmpl.mk
33

44
PASS = $(shell find pass -name '*.wsf')
55
FAIL = $(shell find fail -name '*.wsf')
@@ -11,13 +11,13 @@ ERR = $(FAIL:.wsf=.err)
1111
all: $(WSA) $(WS) $(ERR)
1212

1313
%.wsa: %.wsf
14-
$(WSF) $< $@
14+
$(WSF_ASSEMBLE) $< $@
1515

1616
%.ws: %.wsa
17-
$(WSC) -t -f asm -o $@ $<
17+
$(WSF_WSC) -t -f asm -o $@ $<
1818

1919
%.err: %.wsa
20-
! $(WSC) -t -f asm $< 2> $@
20+
! $(WSF_WSC) -t -f asm $< 2> $@
2121

2222
fail/hash_in_import.wsa fail/hash_in_export.wsa: fail/path\#with_hash.wsf
2323

0 commit comments

Comments
 (0)