mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Script tests re-added, all tests can run under gdb
Also fixed a minor bug with printing, and removed the ability to configure the parser. Added and updated QUICKSTART.md as a quick way to get people started. There's some broken scripts under 'scripts/' that require functions to work properly.
This commit is contained in:
52
tests/scripts/makefile
Normal file
52
tests/scripts/makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#compiler settings
|
||||
CC=gcc
|
||||
CFLAGS+=-std=c17 -g -Wall -Werror -Wextra -Wpedantic -Wformat=2 -Wno-newline-eof
|
||||
LIBS+=-lm
|
||||
LDFLAGS+=
|
||||
|
||||
ifeq ($(shell uname),Linux)
|
||||
LDFLAGS=-Wl,--gc-sections
|
||||
else ifeq ($(shell uname),NetBSD)
|
||||
LDFLAGS=-Wl,--gc-sections
|
||||
else ifeq ($(OS),Windows_NT)
|
||||
LDFLAGS=-Wl,--gc-sections
|
||||
else ifeq ($(shell uname),Darwin)
|
||||
LDFLAGS=-Wl,-dead_strip
|
||||
else
|
||||
@echo "LDFLAGS set failed - what platform is this?"
|
||||
endif
|
||||
|
||||
#directories
|
||||
TEST_ROOTDIR=../..
|
||||
TEST_SOURCEDIR=$(TEST_ROOTDIR)/$(TOY_SOURCEDIR)
|
||||
TEST_REPLDIR=$(TEST_ROOTDIR)/$(TOY_REPLDIR)
|
||||
TEST_SCRIPTDIR=.
|
||||
|
||||
#file names
|
||||
TEST_SCRIPTFILES=$(wildcard $(TEST_SCRIPTDIR)/test_*.toy)
|
||||
|
||||
#build the source and repl, copy to the local dir, and run
|
||||
all: source repl copy run
|
||||
|
||||
#compile the source and repl first
|
||||
source:
|
||||
$(MAKE) -C $(TEST_SOURCEDIR)
|
||||
|
||||
repl: source
|
||||
$(MAKE) -C $(TEST_REPLDIR)
|
||||
|
||||
copy:
|
||||
cp -r $(TEST_ROOTDIR)/$(TOY_OUTDIR) .
|
||||
|
||||
run: $(TEST_SCRIPTFILES:.toy=.toy-run)
|
||||
|
||||
%.toy-run: %.toy
|
||||
find -name repl* -type f -exec {} -f ../$< --verbose \;
|
||||
|
||||
#using gdb
|
||||
gdb: source repl copy run-gdb
|
||||
|
||||
run-gdb: $(TEST_SCRIPTFILES:.toy=.toy-run-gdb)
|
||||
|
||||
%.toy-run-gdb: %.toy
|
||||
gdb $(TEST_OUTDIR)/$(TEST_REPLNAME) -ix gdb_init -ex=run --batch --return-child-result --args "out/repl.out" "-f" "../$<" "--verbose"
|
||||
Reference in New Issue
Block a user