Skip to content

Commit 18375c5

Browse files
committed
move platform-specific tests into their own spot
1 parent ed61495 commit 18375c5

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

CppUTest/build/MakefileWorker.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ OBJ = $(call src_to_o,$(SRC))
192192

193193
STUFF_TO_CLEAN += $(OBJ)
194194

195-
TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS))
195+
TEST_SRC = $(call get_src_from_dir_list, $(TEST_SRC_DIRS)) $(TEST_SRC_FILES)
196196
TEST_OBJS = $(call src_to_o,$(TEST_SRC))
197197
STUFF_TO_CLEAN += $(TEST_OBJS)
198198

@@ -287,10 +287,10 @@ $(TARGET_LIB): $(OBJ)
287287
$(SILENCE)$(AR) $(ARFLAGS) $@ $^
288288
$(SILENCE)ranlib $@
289289

290-
test: $(TEST_TARGET)
290+
test_platform: $(TEST_TARGET)
291291
$(RUN_TEST_TARGET)
292292

293-
vtest: $(TEST_TARGET)
293+
vtest_platform: $(TEST_TARGET)
294294
$(RUN_TEST_TARGET) -v
295295

296296
$(CPPUTEST_OBJS_DIR)/%.o: %.cpp

Makefile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
#Set this to @ to keep the makefile quiet
44
SILENCE = @
55

6+
ifdef PLATFORM
7+
COMPONENT_NAME = "$(PLATFORM)_"
8+
SRC_FILES = src/tempodb/platform/$(PLATFORM).c
9+
TEST_SRC_FILES = tests/TempoDb/platform/$(PLATFORM)_test.c
10+
MOCKS_SRC_DIRS = mocks/$(PLATFORM)
11+
endif
12+
613
#---- Outputs ----#
714
COMPONENT_NAME = tempodb
815

@@ -11,25 +18,23 @@ CPPUTEST_HOME = CppUTest
1118
CPP_PLATFORM = Gcc
1219
PROJECT_HOME_DIR = .
1320

14-
SRC_DIRS = \
15-
src/tempodb\
16-
src/tempodb/platform
21+
SRC_DIRS += \
22+
src/tempodb
1723

18-
TEST_SRC_DIRS = \
24+
TEST_SRC_DIRS += \
1925
.\
2026
mocks\
2127
tests/TempoDb\
22-
tests\
23-
28+
tests
2429

2530
INCLUDE_DIRS =\
2631
.\
2732
$(CPPUTEST_HOME)/include\
2833
mocks\
2934
include/tempodb
3035

31-
MOCKS_SRC_DIRS = \
32-
mocks\
36+
MOCKS_SRC_DIRS += \
37+
mocks
3338

3439
CPPUTEST_WARNINGFLAGS = -Wall -Wswitch-default -Werror
3540
#CPPUTEST_CFLAGS = -std=c89
@@ -59,4 +64,11 @@ objs/platform/posix.o:
5964
CppUTest/lib/libCppUTest.a:
6065
cd CppUTest && make lib/libCppUTest.a
6166

67+
vtest_posix:
68+
$(SILENCE)echo ">>> Running Posix Tests"
69+
$(SILENCE)PLATFORM="posix" make vtest_platform
70+
$(SILENCE)echo "<<< Finished Posix Tests"
71+
72+
vtest: vtest_posix
73+
6274
include $(CPPUTEST_HOME)/build/MakefileWorker.mk

mocks/TCPSocketStub.c renamed to mocks/posix/posix_mock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "TCPSocketStub.h"
1+
#include "posix_mock.h"
22
#include <stdio.h>
33

44
static struct hostent *hent;

mocks/TCPSocketStub.h renamed to mocks/posix/posix_mock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef TCPSocketStub_H
2-
#define TCPSocketStub_H
1+
#ifndef TEMPODB_PLATFORM_POSIX_MOCK_H
2+
#define TEMPODB_PLATFORM_POSIX_MOCK_H
33

44
#include <arpa/inet.h>
55
#include <netdb.h>

tests/TempoDb/TempoDbTest.cpp renamed to tests/TempoDb/platform/posix_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern "C" {
44
#include "tempodb.h"
55
#include <sys/socket.h>
66
#include <netinet/in.h>
7-
#include "TCPSocketStub.h"
7+
#include "posix_mock.h"
88
#include <string.h>
99
}
1010

0 commit comments

Comments
 (0)