Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
renombro a test
Browse files Browse the repository at this point in the history
  • Loading branch information
RaniAgus committed Mar 1, 2023
1 parent f111a35 commit 0545722
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions src/compilation.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Set prerrequisites
SRCS_C += $(shell find src/ -iname "*.c")
SRCS_H += $(shell find src/ -iname "*.h")
SPECS_C += $(shell find spec/ -iname "*.c")
SPECS_H += $(shell find spec/ -iname "*.h")
TESTS_C += $(shell find tests/ -iname "*.c")
TESTS_H += $(shell find tests/ -iname "*.h")
DEPS = $(foreach SHL,$(SHARED_LIBPATHS),$(SHL:%=%/bin/lib$(notdir $(SHL)).so)) \
$(foreach STL,$(STATIC_LIBPATHS),$(STL:%=%/bin/lib$(notdir $(STL)).a))

Expand All @@ -17,19 +17,19 @@ RUNDIRS = $(SHARED_LIBPATHS:%=$(shell cd . && pwd)/%/bin)

# Set intermediate objects
OBJS = $(patsubst src/%.c,obj/%.o,$(SRCS_C))
SPEC_OBJS = $(SPECS_C) $(filter-out $(SPEC_EXCLUDE), $(SRCS_C))
TEST_OBJS = $(TESTS_C) $(filter-out $(TEST_EXCLUDE), $(SRCS_C))

# Set binary targets
BIN = bin/$(call filename,$(shell cd . && pwd | xargs basename))
SPEC = bin/$(shell cd . && pwd | xargs basename)_specs.out
TEST = bin/$(shell cd . && pwd | xargs basename)_tests.out

.PHONY: all
all: CFLAGS = $(CDEBUG)
all: $(BIN) $(SPEC)
all: $(BIN) $(TEST)

.PHONY: release
release: CFLAGS = $(CRELEASE)
release: clean $(BIN) $(SPEC)
release: clean $(BIN) $(TEST)

.PHONY: clean
clean:
Expand All @@ -48,7 +48,7 @@ $(BIN): $(OBJS) | $(dir $(BIN))
obj/%.o: src/%.c $(SRCS_H) $(DEPS) | $(dir $(OBJS))
$(call compile_objs)

$(SPEC): $(SPEC_OBJS) | $(dir $(SPEC))
$(TEST): $(TEST_OBJS) | $(dir $(TEST))
gcc $(CFLAGS) -o "$@" $^ $(IDIRS:%=-I%) $(LIBDIRS:%=-L%) $(RUNDIRS:%=-Wl,-rpath,%) $(LIBS:%=-l%) -lcspecs

.SECONDEXPANSION:
Expand Down
2 changes: 1 addition & 1 deletion src/project/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "test",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/${workspaceFolderBasename}_specs.out",
"program": "${workspaceFolder}/bin/${workspaceFolderBasename}_tests.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
2 changes: 1 addition & 1 deletion src/project/settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ MEMCHECK_FLAGS=--track-origins=yes --log-file="memcheck.log"
HELGRIND_FLAGS=--log-file="helgrind.log"

# Source files (*.c) to be excluded from tests compilation
SPEC_EXCLUDE=src/main.c
TEST_EXCLUDE=src/main.c
File renamed without changes.
2 changes: 1 addition & 1 deletion src/shared/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "test",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/${workspaceFolderBasename}_specs.out",
"program": "${workspaceFolder}/bin/${workspaceFolderBasename}_tests.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
2 changes: 1 addition & 1 deletion src/shared/settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ CDEBUG=-g -Wall -DDEBUG
CRELEASE=-O3 -Wall -DNDEBUG

# Source files (*.c) to be excluded from tests compilation
SPEC_EXCLUDE=
TEST_EXCLUDE=
File renamed without changes.
2 changes: 1 addition & 1 deletion src/static/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "test",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/${workspaceFolderBasename}_specs.out",
"program": "${workspaceFolder}/bin/${workspaceFolderBasename}_tests.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
2 changes: 1 addition & 1 deletion src/static/settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ CDEBUG=-g -Wall -DDEBUG
CRELEASE=-O3 -Wall -DNDEBUG

# Source files (*.c) to be excluded from tests compilation
SPEC_EXCLUDE=
TEST_EXCLUDE=
File renamed without changes.
8 changes: 4 additions & 4 deletions src/testing.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.PHONY: test
test: all
valgrind --tool=none ./$(SPEC)
valgrind --tool=none ./$(TEST)

.PHONY: test-daemon
test-daemon:
@test $(shell which entr) || entr
while sleep 0.1; do \
find spec/ src/ | entr -d make test --no-print-directory; \
find tests/ src/ | entr -d make test --no-print-directory; \
done

.PHONY: test-memcheck
test-memcheck: all
valgrind --leak-check=full $(MEMCHECK_FLAGS) ./$(SPEC)
valgrind --leak-check=full $(MEMCHECK_FLAGS) ./$(TEST)

.PHONY: test-helgrind
test-helgrind: all
valgrind --tool=helgrind $(HELGRIND_FLAGS) ./$(SPEC)
valgrind --tool=helgrind $(HELGRIND_FLAGS) ./$(TEST)

0 comments on commit 0545722

Please sign in to comment.