Open rboston628 opened 5 months ago
I think the simplest solution is to only run the tests on unix, but run the builds on unix, macOS, and windows.
I've looked more into Catch. It looks simple enough, and I have done some work figuring out how to integrate it into a makefile build.
Consider this file tree
-|
|-- src/
| |-- model/
| | |-- classA.cpp
| | |-- classB.cpp
| | |-- classA.hpp
| | |-- classB.hpp
| |-- main.cpp
|-- tests/
| |-- test_classA.cpp
| |-- test_classB.cpp
|-- makefile
Then the makefile should be
# files to pull headers/source or to wite object code
IDIR=src
SDIR=src
ODIR=obj
# compiler and flags
CC=g++ --std=c++14
CFLAGS=-I$(IDIR) -Wall
## specify the needed files, separated as model and main
_MAIN = main
_MODEL = classA classB
# create path to class header/source
MODELDPS = $(patsubst %, $(IDIR)/model/%.hpp, $(_MODEL))
MODELSRC = $(patsubst %, $(SDIR)/model/%.cpp, $(_MODEL))
MAINSRC = $(patsubst %, $(SDIR)/%.cpp, $(_MAIN))
# object files
MODELOBJ = $(patsubst %, $(ODIR)/model/%.o, $(_MODEL))
MAINOBJ = $(patsubst %, $(ODIR)/%.o, $(_MAIN))
# specify code dependencies
MODELDEP = $(MODELDPS) $(MODELSRC)
MAINDEP = $(MAINSRC) $(MODELDEP)
## Main rule for creating the code base
## it will create model and main object files
code: $(MAINOBJ) $(MODELOBJ)
$(CC) -o $@ $^ $(CFLAGS)
## Rules for each subsection -- only update if their dependencies change
$(MODELOBJ): $(ODIR)/model/%.o: $(SDIR)/model/%.cpp $(MODELDEP)| obj/model/
$(CC) -c -o $@ $< $(CFLAGS)
$(MAINOBJ): $(ODIR)/%.o: $(SDIR)/%.cpp $(MAINDEP)| obj/
$(CC) -c -o $@ $< $(CFLAGS)
## create the tests
TEST = $(patsubst %, ./tests/test_%.cpp, $(_MODEL))
tests: code
$(CC) -o ./tests/tests.o $(MAINOBJ) $(MODELOBJ) $(TEST) $(CFLAGS) -l catch2
./tests/tests.o --success
## this rule creates an obj directory if none exists
obj/:
mkdir -p obj
obj/model/:
mkdir -p obj/model
I raised an issue on CxxTest about failing runs on macOS runners. Given their track record of responding in a timely manner to issues, I expect it will never be fixed.
For reasons unknown to me, all tests on github's macOS runners are failing with the following:
As shown, there are multiple syntax errors inside the python script
cxxtest_parser.py
usingis
for comparison of non-None
values, and then a failure to find thecxxtest/TestListener.h
header file.Given several other issues that have occurred with CxxTest, I should consider a new testing framework.