Added a test option to the makefile
This commit is contained in:
parent
72a56a15d7
commit
3e450b5909
1 changed files with 22 additions and 1 deletions
23
makefile
23
makefile
|
|
@ -25,7 +25,7 @@ FLAGS += -Wdisabled-optimization
|
||||||
FLAGS += -fanalyzer
|
FLAGS += -fanalyzer
|
||||||
# These flags are because of the compiler otherwise giving too much warning
|
# These flags are because of the compiler otherwise giving too much warning
|
||||||
FLAGS += -Wno-sign-conversion
|
FLAGS += -Wno-sign-conversion
|
||||||
#FLAGS += -Wformat-truncation=0
|
FLAGS += -Wformat-truncation=0
|
||||||
|
|
||||||
# Compile flag for defining GITHASH to put at the end of the version string
|
# Compile flag for defining GITHASH to put at the end of the version string
|
||||||
GITFLAG = -D'GITHASH=$(shell git rev-parse --short=1 HEAD)'
|
GITFLAG = -D'GITHASH=$(shell git rev-parse --short=1 HEAD)'
|
||||||
|
|
@ -37,6 +37,7 @@ OUTDIR = out
|
||||||
# The UI to compile for by default using make run
|
# The UI to compile for by default using make run
|
||||||
#UI_TARGET = vt100
|
#UI_TARGET = vt100
|
||||||
UI_TARGET = ncurses
|
UI_TARGET = ncurses
|
||||||
|
UI_TESTING = stub
|
||||||
|
|
||||||
# The URL of the plaintext version of the lisence, for the --license option
|
# The URL of the plaintext version of the lisence, for the --license option
|
||||||
LICENSEURL = https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
LICENSEURL = https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||||
|
|
@ -44,6 +45,10 @@ LICENSEURL = https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||||
# C compiler
|
# C compiler
|
||||||
CC = cc
|
CC = cc
|
||||||
|
|
||||||
|
# Test options
|
||||||
|
TEST_COLUMNS = 1000
|
||||||
|
TEST_ROWS = 30
|
||||||
|
|
||||||
.NOTINTERMEDIATE:
|
.NOTINTERMEDIATE:
|
||||||
|
|
||||||
# Messages to print during different steps in making
|
# Messages to print during different steps in making
|
||||||
|
|
@ -65,6 +70,22 @@ run: $(OUTDIR)/connect4_$(UI_TARGET).elf
|
||||||
run_%: $(OUTDIR)/connect4_%.elf
|
run_%: $(OUTDIR)/connect4_%.elf
|
||||||
./$<
|
./$<
|
||||||
|
|
||||||
|
# Show result of test
|
||||||
|
test: test.diff
|
||||||
|
|
||||||
|
# Diff between the tests
|
||||||
|
test.diff: test.log test.log.slow
|
||||||
|
diff -y $^ > $@ || tail $@
|
||||||
|
diff -q $^
|
||||||
|
|
||||||
|
# Log of testing fast logic
|
||||||
|
test.log: $(OUTDIR)/connect4_$(UI_TESTING).elf
|
||||||
|
./$< -o $@ -c $(TEST_COLUMNS) -r $(TEST_ROWS) --random-moves
|
||||||
|
|
||||||
|
# Log of testing slow logic
|
||||||
|
test.log.slow: $(OUTDIR)/connect4_$(UI_TESTING).elf
|
||||||
|
./$< -o $@ -c $(TEST_COLUMNS) -r $(TEST_ROWS) --random-moves --slow-calcWins
|
||||||
|
|
||||||
# Compile specifically the ncurses version
|
# Compile specifically the ncurses version
|
||||||
# This one's special because it needs -lncursesw
|
# This one's special because it needs -lncursesw
|
||||||
$(OUTDIR)/connect4_ncurses.elf: $(addprefix $(OBJDIR)/,ui_ncurses.o logic.o connect4.o LICENSE.o)
|
$(OUTDIR)/connect4_ncurses.elf: $(addprefix $(OBJDIR)/,ui_ncurses.o logic.o connect4.o LICENSE.o)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue