Skip to content

Commit

Permalink
fix(test): rerun tests when lox_assert.h changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vegerot committed Nov 2, 2024
1 parent 6c3ad2c commit be22fb0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bytecode-vm-compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SHELL=/bin/bash
CC ?= cc
CFLAGS ?= -std=gnu2x -g -Wall -Wextra -Wpedantic -Wimplicit-fallthrough -Werror -Wno-gnu-statement-expression -Wno-strict-prototypes -Wno-unused-parameter
SRC_FILES= src/chunk.c src/compiler.c src/debug.c src/memory.c src/object.c src/scanner.c src/stack.c src/value.c src/vm.c
COMMON_TEST_FILES= src/lox_assert.h

lox: src/main.c $(SRC_FILES) src/*.h
$(CC) $(CFLAGS) -DDEBUG_TRACE_EXECUTION -DDEBUG_PRINT_CODE -fsanitize=address src/main.c $(SRC_FILES) -o lox
Expand All @@ -12,19 +13,19 @@ all: format lint ci
ci: lox test clangd lint-check # do not run format-check because GH A uses an incompatible version of clang-format

test: test/test-stack test/test-vm test/test-scanner test/test-compiler test/test-table
test/test-vm: test/test-vm.c src/vm.h src/vm.c src/chunk.h src/chunk.c src/value.h src/value.c src/compiler.h src/compiler.c
test/test-vm: $(COMMON_TEST_FILES) test/test-vm.c src/vm.h src/vm.c src/chunk.h src/chunk.c src/value.h src/value.c src/compiler.h src/compiler.c
$(CC) -fsanitize=address $(CFLAGS) -Wno-error test/test-vm.c $(SRC_FILES) -o test/test-vm
test/test-vm || (mv test/test-vm test/test-vm.failed && false)
test/test-stack: test/test-stack.c src/stack.h src/stack.c
test/test-stack: $(COMMON_TEST_FILES) test/test-stack.c src/stack.h src/stack.c
$(CC) -fsanitize=address $(CFLAGS) -Wno-error test/test-stack.c $(SRC_FILES) -o test/test-stack
test/test-stack
test/test-scanner: test/test-scanner.c src/scanner.h src/scanner.c src/lox_assert.h
test/test-scanner: $(COMMON_TEST_FILES) test/test-scanner.c src/scanner.h src/scanner.c src/lox_assert.h
$(CC) -fsanitize=address $(CFLAGS) -Wno-error test/test-scanner.c $(SRC_FILES) -o test/test-scanner
test/test-scanner || mv test/test-scanner test/test-scanner.failed
test/test-compiler: test/test-compiler.c src/compiler.h src/compiler.c src/scanner.h src/scanner.c src/chunk.h src/chunk.c src/value.h src/value.c
test/test-compiler: $(COMMON_TEST_FILES) test/test-compiler.c src/compiler.h src/compiler.c src/scanner.h src/scanner.c src/chunk.h src/chunk.c src/value.h src/value.c
$(CC) -DDEBUG_TRACE_EXECUTION -fsanitize=address $(CFLAGS) -Wno-error test/test-compiler.c $(SRC_FILES) -o test/test-compiler
test/test-compiler || mv -v test/test-compiler test/test-compiler.failed
test/test-table: test/test-table.c test/test-vm
test/test-table: $(COMMON_TEST_FILES) test/test-table.c test/test-vm
$(CC) $(CFLAGS) -fsanitize=address $(EXTRA_CFLAGS) -Wno-error test/test-table.c $(SRC_FILES) -o test/test-table
test/test-table || mv test/test-table test/test-table.failed

Expand Down

0 comments on commit be22fb0

Please sign in to comment.