Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mod
104 changes: 104 additions & 0 deletions test/app/rev2/math_sdr/Makefile

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cr: If this file lives in mod, its test should too. I can help get the submodule set up if you'd like.

That means this PR may not be needed. We can close it out unmerged once we get that ready.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the math_sdr unit tests into the mod repository and added the SDR test framework as a submodule. The migrated tests pass locally with 26 passes and 0 failures. We can close this PR unmerged as suggested once the mod PR is ready.

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
################################################################
#
# math_sdr unit tests (based on gcc)
#
################################################################

################################################################
# target
################################################################
TARGET = math_sdr

################################################################
# build variables
################################################################
DEBUG ?= 0
OPT = -Og

################################################################
# paths
################################################################
BUILD_DIR = build
ROOT_DIR = ../../../..
MOD_DIR = $(ROOT_DIR)/mod

################################################################
# source
################################################################
TEST_SOURCES = \
test_math_sdr.c

COV_C_SOURCES = \
$(MOD_DIR)/math_sdr/math_sdr.c

FRAMEWORK_SOURCES = \
$(ROOT_DIR)/test/framework/src/test_assert.c \
$(ROOT_DIR)/test/framework/src/test_runner.c

C_SOURCES = $(TEST_SOURCES) $(COV_C_SOURCES) $(FRAMEWORK_SOURCES)

################################################################
# compiler
################################################################
CC = gcc

################################################################
# C flags
################################################################
C_INCLUDES = \
-I. \
-I$(MOD_DIR)/math_sdr \
-I$(ROOT_DIR)/test/framework/src

C_DEFS = \
-DUNIT_TEST

CFLAGS = $(C_INCLUDES) $(C_DEFS) $(OPT) -Wall -g

CFLAGS += -Wno-unused-function
CFLAGS += -Wno-unused-variable
CFLAGS += -ftest-coverage
CFLAGS += -fprofile-arcs
ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG
else
CFLAGS += -DRELBLD
endif

################################################################
# build
################################################################
all: clean $(BUILD_DIR)/$(TARGET)

OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))

$(BUILD_DIR)/%.o: %.c $(BUILD_DIR)
$(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ -lgcov -lm

$(BUILD_DIR):
mkdir $@

################################################################
# test
################################################################
test:
@echo THIS TEST MUST BE EXECUTED IN A BASH TERMINAL. CMD/PS do not work.
-rm -fR $(BUILD_DIR)
$(MAKE) all
$(BUILD_DIR)/$(TARGET)
tail -n 7 "results.txt"
mkdir -p coverage
gcovr $(BUILD_DIR) \
--filter $(COV_C_SOURCES) \
--html-details coverage/coverage.html \
--json coverage/coverage.json

################################################################
# clean
################################################################
clean:
-rm -fR $(BUILD_DIR)
8 changes: 8 additions & 0 deletions test/app/rev2/math_sdr/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef TEST_MATH_SDR_MAIN_H
#define TEST_MATH_SDR_MAIN_H

#include <math.h>
#include <stddef.h>
#include <stdint.h>

#endif /* TEST_MATH_SDR_MAIN_H */
Loading
Loading