chore: add more Make tasks for tests & benchmarks
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I5cabfcf1815588ffec6c8b865cd163176a6a6964
This commit is contained in:
parent
000258df5c
commit
e871307f6a
1 changed files with 29 additions and 5 deletions
34
Makefile
34
Makefile
|
|
@ -131,11 +131,12 @@ clean:
|
|||
@echo "Cleaning build artifacts..."
|
||||
rm -rf $(OBJDIR) $(BINDIR)
|
||||
rm -f $(PROTOCOL_HEADERS) $(PROTOCOL_SOURCES)
|
||||
rm -f "vcore.*"
|
||||
|
||||
# Format source code (requires clang-format)
|
||||
format:
|
||||
@echo "Formatting source code..."
|
||||
@find $(SRCDIR) $(INCDIR) -name "*.c" -o -name "*.h" | xargs clang-format -i
|
||||
@find $(SRCDIR) -name "*.c" -o -name "*.h" | xargs clang-format -i
|
||||
|
||||
# Static analysis (requires cppcheck)
|
||||
analyze:
|
||||
|
|
@ -147,10 +148,33 @@ analyze:
|
|||
$(SRCDIR)
|
||||
|
||||
# Run tests
|
||||
# FIXME: add tests
|
||||
test: $(TARGET)
|
||||
@echo "Running tests..."
|
||||
@echo "Tests not implemented yet."
|
||||
@echo "Running unit tests..."
|
||||
@$(CC) -o bin/test tests/test.c lib/test_common.c \
|
||||
-I./include -I./tests -I./tests/util -lm -std=c11 -D_GNU_SOURCE $(CFLAGS)
|
||||
@./bin/test
|
||||
|
||||
# Run benchmarks
|
||||
bench:
|
||||
@echo "Running performance benchmarks..."
|
||||
@$(CC) -o bin/bench benchmarks/bench.c lib/test_common.c \
|
||||
-I./include -I./tests -I./tests/util -lm -std=c11 -D_GNU_SOURCE $(CFLAGS)
|
||||
@./bin/bench
|
||||
|
||||
# Memory analysis tests
|
||||
test-memory:
|
||||
@echo "Building memory tests..."
|
||||
@$(CC) -o bin/test tests/test.c lib/test_common.c \
|
||||
-I./include -I./tests -I./tests/util -lm -std=c11 -D_GNU_SOURCE $(CFLAGS)
|
||||
@valgrind --leak-check=full --show-leak-kinds=all ./bin/test 2>&1 | tee tests/memory_report.txt
|
||||
@echo "Analysis complete. See tests/memory_report.txt"
|
||||
|
||||
# Generate memory profile CSVs
|
||||
profile-memory:
|
||||
@$(CC) -o bin/test tests/test.c lib/test_common.c \
|
||||
-I./include -I./tests -I./tests/util -lm -std=c11 -D_GNU_SOURCE $(CFLAGS)
|
||||
@./bin/test --profile
|
||||
@echo "CSV files generated in /tmp/"
|
||||
|
||||
# Version management targets
|
||||
bump-patch:
|
||||
|
|
@ -213,7 +237,7 @@ help:
|
|||
-include $(DEPENDS)
|
||||
|
||||
# Phony targets
|
||||
.PHONY: all debug static check-deps install uninstall systemd-service version-header sample-config clean distclean format analyze test help bump-patch bump-minor bump-major set-version
|
||||
.PHONY: all debug static check-deps install uninstall systemd-service version-header clean distclean format analyze test test-memory memory-report help bump-patch bump-minor bump-major set-version
|
||||
|
||||
# Print variables
|
||||
print-%:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue