aboutsummaryrefslogtreecommitdiff
path: root/tests/Makefile
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2024-01-07 12:35:56 +0200
committerSyndamia <kamen@syndamia.com>2024-01-07 12:35:56 +0200
commit43de4b0bfa52a7b3bf6b92df344bd76a97200e18 (patch)
treea1afbc56e524b7a87c9091e6fd0a01f4c5641472 /tests/Makefile
parentf5adcdd552f743d372a62a4c30184c4c8cd98cfd (diff)
downloadpico-web-43de4b0bfa52a7b3bf6b92df344bd76a97200e18.tar
pico-web-43de4b0bfa52a7b3bf6b92df344bd76a97200e18.tar.gz
pico-web-43de4b0bfa52a7b3bf6b92df344bd76a97200e18.zip
(tests) Setup mocking, everything is now ready for tests
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile23
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 4c6f82b..a3b95cd 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,17 +1,26 @@
RUBY=ruby
UNITY_DIR=./Unity
+CMOCK_DIR=./CMock
+
CC=gcc
-CFLAGS=-I$(UNITY_DIR)/src
+CFLAGS=-I$(UNITY_DIR)/src -I$(CMOCK_DIR)/src -I../src -I./mocks
+UNILFILES=../src/sds/sds.c
.PHONY: all
all: build run
.PHONY: build
build:
- for testfile in $$(find . -type f -name "*.tests.c") ;\
- do \
- $(RUBY) $(UNITY_DIR)/auto/generate_test_runner.rb $$testfile ;\
- $(CC) $(CFLAGS) -o $${testfile%.c} $(UNITY_DIR)/src/unity.c $$testfile $${testfile%.c}_Runner.c ;\
+ $(RUBY) $(CMOCK_DIR)/lib/cmock.rb -oCMock.yml $$(find ../src -type f -name "*.h" -not -path "../src/sds/*")
+ for testfile in $$(find . -type f -name "*.tests.c") ;\
+ do \
+ $(RUBY) $(UNITY_DIR)/auto/generate_test_runner.rb $$testfile ;\
+ includelist=$$(head -1 browser-net.tests.c | cut -c3-) ;\
+ $(CC) $(CFLAGS) -o $${testfile%.c} \
+ $(UNILFILES) $$(find ./mocks -type f -name "*.c" | grep -Fv $$(echo "$$includelist" | sed 's/ / -e /g')) \
+ $$(echo "$$includelist" | sed 's/ / ..\/src\//g') \
+ helpers.c $(UNITY_DIR)/src/unity.c $(CMOCK_DIR)/src/cmock.c \
+ $$testfile $${testfile%.c}_Runner.c ;\
done
.PHONY: run
@@ -20,3 +29,7 @@ run:
do \
$$runner || exit ;\
done
+
+.PHONY: clean
+clean:
+ $(RM) *.tests *.tests_Runner.c