Files
stk/test/gmake.mk
T
anth64 d2bf8fb67a feat(test): add comprehensive test infrastructure
- Add test target to both bmake.mk and gmake.mk Makefiles
- Add test-related artifacts to .gitignore (excluding DLLs/shared libs)
- Create test directory with cross-platform Makefiles (bmake.mk, gmake.mk)
- Implement cross-platform test program with signal handling (test.c)
- Add test module source for compilation (test_mod.c)
- Set up automated test environment with mods/ directory
- Support both POSIX and Windows platforms

The test infrastructure allows running integration tests via 'make test'
and demonstrates stk library functionality with dynamic module loading.
Generated DLLs/shared libraries are excluded from version control.
2026-01-31 22:46:07 +01:00

44 lines
1.0 KiB
Makefile

CC := cc
CFLAGS = -Wall -Wpedantic -I../include -std=c89
LDFLAGS = -L../bin/debug -lstk
UNAME_S := $(shell uname -s)
ifeq ($(OS),Windows_NT)
MODULE_EXT = .dll
else
LDFLAGS += -Wl,-rpath,../bin/debug
MODULE_EXT = .so
endif
.PHONY: all test clean
all: test
test_program: test.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
test_mod$(MODULE_EXT): test_mod.c
$(CC) $(CFLAGS) -fPIC -shared -o $@ $<
setup:
@mkdir -p mods
@cp -f test_mod$(MODULE_EXT) mods/ 2>/dev/null || true
@echo " Test environment ready: mods/ directory with test_mod$(MODULE_EXT)"
run: test_program test_mod$(MODULE_EXT) setup
@echo "Running integration test (CTRL+C to exit)..."
@./test_program
test: test_program test_mod$(MODULE_EXT) setup
@echo "=== stk Integration Test ==="
@echo "1. Starting test program"
@echo "2. Will load test_mod$(MODULE_EXT) from mods/"
@echo "3. Press CTRL+C to exit"
@echo "============================="
@./test_program || echo "Test completed."
clean:
rm -f test_program test_mod$(MODULE_EXT)
rm -rf mods/