Compiles, finally, after installing non-ubuntu cpptest. Same version and everything. Stupid. local_cpptest
authorKrista Bennett <krista@pep-project.org>
Mon, 30 Apr 2018 15:22:22 +0200
branchlocal_cpptest
changeset 263730db80f1a874
parent 2635 04e6df2957e8
child 2638 d52e41da942e
Compiles, finally, after installing non-ubuntu cpptest. Same version and everything. Stupid.
test/Makefile
test/include/DecorateTests.h
test/include/EngineTestIndividualSuite.h
test/include/EngineTestSessionSuite.h
test/include/EngineTestSuite.h
test/include/SuiteMaker.h
test/include/TestDriver.h
test/include/pEpEngine_test.h
test/include/test_util.h
test/pEpEngine_test.h
test/src/EngineTestIndividualSuite.cc
test/src/EngineTestSessionSuite.cc
test/src/SuiteMaker.cc
test/src/TestDriver.cc
test/src/engine_tests/DecorateTests.cc
     1.1 --- a/test/Makefile	Mon Apr 30 09:23:34 2018 +0200
     1.2 +++ b/test/Makefile	Mon Apr 30 15:22:22 2018 +0200
     1.3 @@ -1,120 +1,185 @@
     1.4 +
     1.5  # Copyright 2017, pEp Foundation
     1.6  # This file is part of pEpEngine
     1.7  # This file may be used under the terms of the GNU General Public License version 3
     1.8  # see LICENSE.txt
     1.9  
    1.10 -HERE:=$(CURDIR)
    1.11 -
    1.12  include ../default.conf
    1.13  
    1.14 -TARGET=pEpEngineTest
    1.15 +HERE:=$(CURDIR)
    1.16 +TEST_HOME=$(HERE)pEp_test_home
    1.17  
    1.18 -unexport GNUPGHOME
    1.19 -TEST_HOME=$(HERE)test_home
    1.20 -TEST_GNUPGHOME=$(TEST_HOME)/gnupg
    1.21 +SRC_DIRS := ./src ./src/util ./src/engine_tests
    1.22 +SRCS := src/EngineTestSuite.cc src/EngineTestIndividualSuite.cc src/EngineTestSessionSuite.cc $(wildcard src/*/*.cc) src/SuiteMaker.cc src/TestDriver.cc
    1.23 +OBJS := $(addsuffix .o,$(basename $(SRCS)))
    1.24 +DEPS := $(OBJS:.o=.d)
    1.25 +
    1.26 +INC_DIRS := ./include /usr/local/include #$(shell find $(SRC_DIRS) -type d) 
    1.27 +INC_FLAGS := $(addprefix -I,$(INC_DIRS))
    1.28 +
    1.29 +LDFLAGS += -L/usr/local/lib
    1.30 +
    1.31 +CFLAGS += -Wno-deprecated
    1.32 +CXXFLAGS += -Wno-deprecated
    1.33  
    1.34  LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -L../src
    1.35  LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
    1.36  
    1.37  ifeq ($(BUILD_FOR),Linux)
    1.38 -    LDLIBS+= -luuid
    1.39 +	LDLIBS+= -luuid
    1.40  endif
    1.41  
    1.42  ifeq ($(OPENPGP),NETPGP)
    1.43 -    LDLIBS+= -lnetpgp
    1.44 +	LDLIBS+= -lnetpgp
    1.45  endif
    1.46  
    1.47  ifdef SQLITE3_FROM_OS
    1.48 -    LDLIBS+= -lsqlite3
    1.49 +	LDLIBS+= -lsqlite3
    1.50  endif
    1.51  
    1.52  ifeq ($(shell uname),Darwin)
    1.53 -    LIBPATH=DYLD_LIBRARY_PATH
    1.54 -    LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
    1.55 +	LIBPATH=DYLD_LIBRARY_PATH
    1.56 +	LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
    1.57  else
    1.58 -    LIBPATH=LD_LIBRARY_PATH
    1.59 -    LLDB_BIN=lldb
    1.60 +	LIBPATH=LD_LIBRARY_PATH
    1.61 +	LLDB_BIN=lldb
    1.62  endif
    1.63  
    1.64 +LDLIBS += -lcpptest
    1.65 +
    1.66 +
    1.67  # Create a list of the extra library paths for the loader. I do not assume that the engine (and its dependencies) are installed for testing.
    1.68  # Note that += can not be used here, as it changes the amount of whitespace
    1.69  EXTRA_LIB_PATHS=../src:
    1.70  ifdef ETPAN_LIB
    1.71 -    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
    1.72 +	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
    1.73  endif
    1.74  ifdef GPGME_LIB
    1.75 -    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
    1.76 +	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
    1.77  endif
    1.78  ifdef NETPGP_LIB
    1.79 -    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
    1.80 +	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
    1.81  endif
    1.82 +
    1.83  # Remove trailing ':'
    1.84  EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
    1.85  
    1.86 -TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS) HOME=$(TEST_HOME) GNUPGHOME=$(TEST_GNUPGHOME)
    1.87 -
    1.88 -UNIT_TESTS_SOURCE=$(wildcard *_test.cc) 
    1.89 -UNIT_TESTS=$(subst .cc,,$(UNIT_TESTS_SOURCE))
    1.90 -UNIT_TESTS_RUN=$(subst .cc,_run,$(UNIT_TESTS_SOURCE))
    1.91 -
    1.92  CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
    1.93  ifneq ($(MAKECMDGOALS),clean)
    1.94 -    ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
    1.95 -        $(error The macro NDEBUG must not be defined for test compilation.)
    1.96 -    endif
    1.97 +	ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
    1.98 +		$(error The macro NDEBUG must not be defined for test compilation.)
    1.99 +	endif
   1.100  endif
   1.101  
   1.102  CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
   1.103  ifneq ($(MAKECMDGOALS),clean)
   1.104 -    ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
   1.105 -        $(error The macro NDEBUG must not be defined for test compilation.)
   1.106 -    endif
   1.107 +	ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
   1.108 +		$(error The macro NDEBUG must not be defined for test compilation.)
   1.109 +	endif
   1.110  endif
   1.111  
   1.112 -.PHONY: all
   1.113 -all: $(TARGET) $(UNIT_TESTS)
   1.114  
   1.115 -# don't delete .o files!
   1.116 -.PRECIOUS: %.o
   1.117 +CPPFLAGS += $(INC_FLAGS) -MMD -MP
   1.118  
   1.119 -.PHONY: test_home_
   1.120 -test_home_: 
   1.121 -	-GNUPGHOME=$(TEST_GNUPGHOME) gpgconf --kill gpg-agent
   1.122 -	rm -rf $(TEST_HOME)
   1.123 -	mkdir -p $(TEST_GNUPGHOME)/private-keys-v1.d
   1.124 -	$(GPG_CMD) --import --batch --homedir $(TEST_GNUPGHOME) 0x*.asc *_sec.asc
   1.125 +$(TARGET): $(OBJS)
   1.126 +	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS)
   1.127  
   1.128  .PHONY: clean
   1.129  clean:
   1.130 -	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) pep_Dokument_Titel.pdf msg4.asc msg_encrypt_for_self.asc
   1.131 -	rm -Rf *.dSYM $(TEST_HOME) pubring.gpg secring.gpg random_seed *.conf trustdb.gpg
   1.132 +	$(RM) $(TARGET) $(OBJS) $(DEPS)
   1.133  
   1.134 -.PHONY: test
   1.135 -test: $(TARGET) test_home_
   1.136 -	$(TEST_CMD_PFX) ./$<
   1.137 +-include $(DEPS)
   1.138  
   1.139 -%_test : %_test.o test_util.o
   1.140 -	$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@
   1.141  
   1.142 -%_run : % test_home_
   1.143 -	$(TEST_CMD_PFX) ./$<
   1.144 -
   1.145 -%_lldb : % test_home_
   1.146 -	$(TEST_CMD_PFX) $(LLDB_BIN) ./$<
   1.147 -
   1.148 -%_valgrind : % test_home_
   1.149 -	$(TEST_CMD_PFX) valgrind --leak-check=yes ./$<
   1.150 -
   1.151 -%_gdb : % test_home_
   1.152 -	$(TEST_CMD_PFX) gdb ./$<
   1.153 -
   1.154 -.PHONY: unit_tests
   1.155 -unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
   1.156 -
   1.157 -.PHONY: compile
   1.158 -compile: $(UNIT_TESTS) $(TARGET)
   1.159 -
   1.160 -# Installs the engine, not the test binaries
   1.161 -.PHONY: install
   1.162 -install:
   1.163 -	$(MAKE) -C .. install
   1.164 +# 
   1.165 +# TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS) #HOME=$(TEST_HOME) GNUPGHOME=$(TEST_GNUPGHOME)
   1.166 +# 
   1.167 +# 
   1.168 +# CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
   1.169 +# ifneq ($(MAKECMDGOALS),clean)
   1.170 +# 	ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
   1.171 +# 		$(error The macro NDEBUG must not be defined for test compilation.)
   1.172 +# 	endif
   1.173 +# endif
   1.174 +# 
   1.175 +# CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
   1.176 +# ifneq ($(MAKECMDGOALS),clean)
   1.177 +# 	ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
   1.178 +# 		$(error The macro NDEBUG must not be defined for test compilation.)
   1.179 +# 	endif
   1.180 +# endif
   1.181 +# 
   1.182 +# # .PHONY: all
   1.183 +# # all: main
   1.184 +# 
   1.185 +# # don't delete .o files!
   1.186 +# .PRECIOUS: %.o
   1.187 +# 
   1.188 +# 
   1.189 +# SRC_DIRS ?= ./src
   1.190 +# 
   1.191 +# SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
   1.192 +# OBJS := $(addsuffix .o,$(basename $(SRCS)))
   1.193 +# DEPS := $(OBJS:.o=.d)
   1.194 +# 
   1.195 +# CPPFLAGS += -I./include -MMD -MP
   1.196 +# 
   1.197 +# #	$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS)
   1.198 +# $(TARGET): $(OBJS)
   1.199 +# 	$(CXX) $(CXXFLAGS) $^ $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
   1.200 +# 
   1.201 +# 
   1.202 +# .PHONY: test_home_
   1.203 +# test_home_: 
   1.204 +# 	mkdir -p $(TEST_HOME)
   1.205 +# 
   1.206 +# # .PHONY: clean
   1.207 +# # clean:
   1.208 +# # 	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) msg4.asc msg_encrypt_for_self.asc
   1.209 +# 
   1.210 +# 
   1.211 +# .PHONY: clean
   1.212 +# clean:
   1.213 +# 	$(RM) $(TARGET) $(OBJS) $(DEPS)
   1.214 +# 
   1.215 +# -include $(DEPS)
   1.216 +# 
   1.217 +# # .PHONY: main
   1.218 +# # main: TestDriver
   1.219 +# # 	
   1.220 +# # TestDriver : src/TestDriver
   1.221 +# # 	$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS) $(TESTOBJ) $(SUITEOBJ) -o TestDriver
   1.222 +# # 
   1.223 +# # .PHONY: testfiles
   1.224 +# # testfiles : $(TESTOBJ)
   1.225 +# # 	$(CXX) -c $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS)
   1.226 +# # 
   1.227 +# # .PHONY: suitefiles	
   1.228 +# # suitefiles : $(SUITEOBJ)
   1.229 +# # 	$(CXX) -c $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS)
   1.230 +# #  
   1.231 +# # # %_test : %_test.o test_util.o
   1.232 +# # # 	$(CXX) $^ $(LDFLAGS) $(LDLIBS) -o $@
   1.233 +# # # 
   1.234 +# # # %_run : % test_home_
   1.235 +# # # 	$(TEST_CMD_PFX) ./$<
   1.236 +# # # 
   1.237 +# # # %_lldb : % test_home_
   1.238 +# # # 	$(TEST_CMD_PFX) $(LLDB_BIN) ./$<
   1.239 +# # # 
   1.240 +# # # %_valgrind : % test_home_
   1.241 +# # # 	$(TEST_CMD_PFX) valgrind --leak-check=yes ./$<
   1.242 +# # # 
   1.243 +# # # %_gdb : % test_home_
   1.244 +# # # 	$(TEST_CMD_PFX) gdb ./$<
   1.245 +# # 
   1.246 +# # # .PHONY: unit_tests
   1.247 +# # # unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
   1.248 +# # 
   1.249 +# # # .PHONY: compile
   1.250 +# # # compile: $(UNIT_TESTS) $(TARGET)
   1.251 +# # 
   1.252 +# # # Installs the engine, not the test binaries
   1.253 +# # .PHONY: install
   1.254 +# # install:
   1.255 +# # 	$(MAKE) -C .. install
     2.1 --- a/test/include/DecorateTests.h	Mon Apr 30 09:23:34 2018 +0200
     2.2 +++ b/test/include/DecorateTests.h	Mon Apr 30 15:22:22 2018 +0200
     2.3 @@ -1,3 +1,5 @@
     2.4 +#ifndef DECORATE_TESTS_H
     2.5 +#define DECORATE_TESTS_H
     2.6  // This file is under GNU General Public License 3.0
     2.7  // see LICENSE.txt
     2.8  
     2.9 @@ -7,6 +9,9 @@
    2.10  #include <iostream>
    2.11  #include <fstream>
    2.12  #include <sstream>
    2.13 +#include <cpptest.h>
    2.14 +#include <cpptest-suite.h>
    2.15 +#include <cpptest-textoutput.h>
    2.16  #include "mime.h"
    2.17  #include "message_api.h"
    2.18  #include "test_util.h"
    2.19 @@ -19,3 +24,5 @@
    2.20      private:
    2.21          void check_decorate();
    2.22  };
    2.23 +
    2.24 +#endif
     3.1 --- a/test/include/EngineTestIndividualSuite.h	Mon Apr 30 09:23:34 2018 +0200
     3.2 +++ b/test/include/EngineTestIndividualSuite.h	Mon Apr 30 15:22:22 2018 +0200
     3.3 @@ -1,16 +1,19 @@
     3.4 -#ifndef ENGINE_INDIVIDUAL_SESSION_SUITE_H
     3.5 -#define ENGINE_INDIVIDUAL_SESSION_SUITE_H
     3.6 +#ifndef ENGINE_TEST_INDIVIDUAL_SUITE_H
     3.7 +#define ENGINE_TEST_INDIVIDUAL_SUITE_H
     3.8  
     3.9 +#include <cpptest.h>
    3.10  #include <cpptest-suite.h>
    3.11 +#include <cpptest-textoutput.h>
    3.12  #include <string>
    3.13  #include "pEpEngine.h"
    3.14 +#include "EngineTestSuite.h"
    3.15  
    3.16  using namespace std;
    3.17  
    3.18  class EngineTestIndividualSuite : public EngineTestSuite {
    3.19      public:
    3.20 -        EngineIndividualTestSuite(string suitename, string test_home_dir);
    3.21 -        ~EngineIndividualTestSuite();
    3.22 +        EngineTestIndividualSuite(string suitename, string test_home_dir);
    3.23 +        ~EngineTestIndividualSuite();
    3.24      protected:
    3.25          virtual void setup();
    3.26          virtual void tear_down();
     4.1 --- a/test/include/EngineTestSessionSuite.h	Mon Apr 30 09:23:34 2018 +0200
     4.2 +++ b/test/include/EngineTestSessionSuite.h	Mon Apr 30 15:22:22 2018 +0200
     4.3 @@ -1,7 +1,9 @@
     4.4  #ifndef ENGINE_TEST_SESSION_SUITE_H
     4.5  #define ENGINE_TEST_SESSION_SUITE_H
     4.6  
     4.7 +#include <cpptest.h>
     4.8  #include <cpptest-suite.h>
     4.9 +#include <cpptest-textoutput.h>
    4.10  #include <string>
    4.11  #include "pEpEngine.h"
    4.12  
     5.1 --- a/test/include/EngineTestSuite.h	Mon Apr 30 09:23:34 2018 +0200
     5.2 +++ b/test/include/EngineTestSuite.h	Mon Apr 30 15:22:22 2018 +0200
     5.3 @@ -1,7 +1,9 @@
     5.4  #ifndef ENGINE_TEST_SUITE_H
     5.5  #define ENGINE_TEST_SUITE_H
     5.6  
     5.7 +#include <cpptest.h>
     5.8  #include <cpptest-suite.h>
     5.9 +#include <cpptest-textoutput.h>
    5.10  #include <string>
    5.11  #include "pEpEngine.h"
    5.12  
     6.1 --- a/test/include/SuiteMaker.h	Mon Apr 30 09:23:34 2018 +0200
     6.2 +++ b/test/include/SuiteMaker.h	Mon Apr 30 15:22:22 2018 +0200
     6.3 @@ -1,4 +1,9 @@
     6.4 +#ifndef SUITEMAKER_H
     6.5 +#define SUITEMAKER_H
     6.6 +
     6.7 +#include <cpptest.h>
     6.8  #include <cpptest-suite.h>
     6.9 +#include <cpptest-textoutput.h>
    6.10  #include <string>
    6.11  #include <sys/stat.h>
    6.12  #include <errno.h>
    6.13 @@ -9,8 +14,6 @@
    6.14  // Begin where we should generate stuff
    6.15  #include "DecorateTests.h"
    6.16  
    6.17 -class SuiteMaker {
    6.18 -    public:
    6.19 -        static EngineTestSuite* build(const char* test_class_name, 
    6.20 -                                      const char* test_home);
    6.21 -};
    6.22 +void suitemaker_build(const char* test_class_name, const char* test_home, std::auto_ptr<Test::Suite>& test_suite);
    6.23 +
    6.24 +#endif
     7.1 --- a/test/include/TestDriver.h	Mon Apr 30 09:23:34 2018 +0200
     7.2 +++ b/test/include/TestDriver.h	Mon Apr 30 15:22:22 2018 +0200
     7.3 @@ -1,6 +1,12 @@
     7.4 +#ifndef PEP_TEST_DRIVER_H
     7.5 +#define PEP_TEST_DRIVER_H
     7.6 +
     7.7 +#include <cpptest.h>
     7.8  #include <cpptest-suite.h>
     7.9 +#include <cpptest-textoutput.h>
    7.10  #include <string>
    7.11  #include <map>
    7.12 +#include "SuiteMaker.h"
    7.13  #include "EngineTestSuite.h"
    7.14  #include "EngineTestIndividualSuite.h"
    7.15  #include "EngineTestSessionSuite.h"
    7.16 @@ -9,3 +15,5 @@
    7.17  
    7.18  typedef map<string, EngineTestSuite> SuiteMap;
    7.19  typedef set<string> NameSet;
    7.20 +
    7.21 +#endif
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/test/include/pEpEngine_test.h	Mon Apr 30 15:22:22 2018 +0200
     8.3 @@ -0,0 +1,3 @@
     8.4 +#include <iomanip>
     8.5 +
     8.6 +#define ASSERT_STATUS(status) { cout << setfill('0') << "status: 0x" << hex << setw(4) << status << "\n"; assert(status == PEP_STATUS_OK); }
     9.1 --- a/test/include/test_util.h	Mon Apr 30 09:23:34 2018 +0200
     9.2 +++ b/test/include/test_util.h	Mon Apr 30 15:22:22 2018 +0200
     9.3 @@ -1,3 +1,6 @@
     9.4 +#ifndef PEP_TEST_UTILS_H
     9.5 +#define PEP_TEST_UTILS_H
     9.6 +
     9.7  #include <string>
     9.8  #include "pEpEngine.h"
     9.9  #include "message_api.h"
    9.10 @@ -27,3 +30,5 @@
    9.11  
    9.12  // Grabs a new uuid for your randomish string needs.
    9.13  char* get_new_uuid();
    9.14 +
    9.15 +#endif
    10.1 --- a/test/pEpEngine_test.h	Mon Apr 30 09:23:34 2018 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,3 +0,0 @@
    10.4 -#include <iomanip>
    10.5 -
    10.6 -#define ASSERT_STATUS(status) { cout << setfill('0') << "status: 0x" << hex << setw(4) << status << "\n"; assert(status == PEP_STATUS_OK); }
    11.1 --- a/test/src/EngineTestIndividualSuite.cc	Mon Apr 30 09:23:34 2018 +0200
    11.2 +++ b/test/src/EngineTestIndividualSuite.cc	Mon Apr 30 15:22:22 2018 +0200
    11.3 @@ -1,8 +1,13 @@
    11.4 +#include <cpptest.h>
    11.5 +#include <cpptest-suite.h>
    11.6 +#include <cpptest-textoutput.h>
    11.7  #include <stdlib.h>
    11.8  #include <unistd.h>
    11.9  #include <ftw.h>
   11.10  
   11.11 -#include "EngineTest.h"
   11.12 +#include "EngineTestSuite.h"
   11.13 +#include "EngineTestIndividualSuite.h"
   11.14 +
   11.15  using namespace std;
   11.16  
   11.17  void EngineTestIndividualSuite::setup() {
    12.1 --- a/test/src/EngineTestSessionSuite.cc	Mon Apr 30 09:23:34 2018 +0200
    12.2 +++ b/test/src/EngineTestSessionSuite.cc	Mon Apr 30 15:22:22 2018 +0200
    12.3 @@ -1,13 +1,18 @@
    12.4 +#include <cpptest.h>
    12.5 +#include <cpptest-suite.h>
    12.6 +#include <cpptest-textoutput.h>
    12.7  #include <stdlib.h>
    12.8  #include <unistd.h>
    12.9  #include <ftw.h>
   12.10  
   12.11  #include "EngineTestSuite.h"
   12.12 +#include "EngineTestSessionSuite.h"
   12.13 +
   12.14  using namespace std;
   12.15  
   12.16  // Constructor
   12.17 -EngineTestSessionSuite::EngineTestSessionSuite(string suitename, string test_home_dir) :
   12.18 -    EngineTestSuite::EngineTestSuite(suitename, test_home_dir) {
   12.19 +EngineTestSessionSuite::EngineTestSessionSuite(string suitename, string test_home_dir) 
   12.20 +    : EngineTestSuite(suitename, test_home_dir) {
   12.21      set_full_env();
   12.22  }
   12.23  
    13.1 --- a/test/src/SuiteMaker.cc	Mon Apr 30 09:23:34 2018 +0200
    13.2 +++ b/test/src/SuiteMaker.cc	Mon Apr 30 15:22:22 2018 +0200
    13.3 @@ -1,16 +1,20 @@
    13.4 +#include <cpptest.h>
    13.5  #include <cpptest-suite.h>
    13.6 +#include <cpptest-textoutput.h>
    13.7  #include <string>
    13.8  #include <sys/stat.h>
    13.9  #include <errno.h>
   13.10  #include "EngineTestSuite.h"
   13.11  #include "EngineTestIndividualSuite.h"
   13.12  #include "EngineTestSessionSuite.h"
   13.13 +#include "SuiteMaker.h"
   13.14  
   13.15  // Begin where we should generate stuff
   13.16  #include "DecorateTests.h"
   13.17  
   13.18 -static EngineTestSuite* build(const char* test_class_name, const char* test_home) {
   13.19 +using namespace std;
   13.20 +
   13.21 +void suitemaker_build(const char* test_class_name, const char* test_home, std::auto_ptr<Test::Suite>& test_suite) {
   13.22      if (strcmp(test_class_name, "DecorateTests") == 0)
   13.23 -        return new DecorateTests(test_class_name, test_home);
   13.24 -    return NULL;
   13.25 +        test_suite = auto_ptr<Test::Suite> (new DecorateTests(test_class_name, test_home));
   13.26  }
    14.1 --- a/test/src/TestDriver.cc	Mon Apr 30 09:23:34 2018 +0200
    14.2 +++ b/test/src/TestDriver.cc	Mon Apr 30 15:22:22 2018 +0200
    14.3 @@ -1,10 +1,13 @@
    14.4 +#include <cpptest.h>
    14.5  #include <cpptest-suite.h>
    14.6 +#include <cpptest-textoutput.h>
    14.7  #include <string>
    14.8  #include <sys/stat.h>
    14.9  #include <errno.h>
   14.10  #include "EngineTestSuite.h"
   14.11  #include "EngineTestIndividualSuite.h"
   14.12  #include "EngineTestSessionSuite.h"
   14.13 +#include "SuiteMaker.h"
   14.14  
   14.15  using namespace std;
   14.16  
   14.17 @@ -14,10 +17,6 @@
   14.18      throw "Bad usage. Fix me, you loser developer.";
   14.19  }
   14.20  
   14.21 -EngineTestSuite* 
   14.22 -
   14.23 -
   14.24 -
   14.25  int main(int argc, char** argv) {
   14.26      const int MIN_ARGC = 1;
   14.27      if (argc < MIN_ARGC)
   14.28 @@ -46,7 +45,7 @@
   14.29              throw ("The test directory, " + common_test_home + "exists, but is not a directory.").c_str(); 
   14.30      }
   14.31      else if (common_test_home.compare("~/pEp_tests")) {
   14.32 -        int errchk = mkdir(common_test_home);
   14.33 +        int errchk = mkdir(common_test_home.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
   14.34          if (errchk != 0)
   14.35              throw "Error creating a test directory.";
   14.36      }
   14.37 @@ -54,18 +53,18 @@
   14.38          throw "Test directory does not exist. Test directories from the command line must be created first. Because we're lazy.";
   14.39          
   14.40              
   14.41 -    EngineTestSuite* test_runner = new EngineTestSuite("MainTestDriver", test_home);
   14.42 +    EngineTestSuite* test_runner = new EngineTestSuite("MainTestDriver", common_test_home);
   14.43          
   14.44      for (int i = start_index; i < argc; i++) {
   14.45          char* curr_arg = argv[i];
   14.46 -        EngineTestSuite* test_suite = SuiteMaker.build(argv[i], common_test_home);
   14.47 -        if (!test_suite)
   14.48 +        auto_ptr<Test::Suite> test_suite;
   14.49 +        suitemaker_build(argv[i], common_test_home.c_str(), test_suite);
   14.50 +        if (test_suite.get() == NULL)
   14.51              throw "Could not create a test suite instance."; // FIXME, better error, cleanup, obviously
   14.52 -        test_runner.add(test_suite);
   14.53 -        test_suite = NULL;
   14.54 +        test_runner->add(test_suite);
   14.55      }
   14.56  
   14.57      Test::TextOutput output(Test::TextOutput::Terse);
   14.58 -    return test_runner.run(output) ? 1 : 0;
   14.59 +    return test_runner->run(output) ? 1 : 0;
   14.60      
   14.61  }
    15.1 --- a/test/src/engine_tests/DecorateTests.cc	Mon Apr 30 09:23:34 2018 +0200
    15.2 +++ b/test/src/engine_tests/DecorateTests.cc	Mon Apr 30 15:22:22 2018 +0200
    15.3 @@ -1,17 +1,24 @@
    15.4  // This file is under GNU General Public License 3.0
    15.5  // see LICENSE.txt
    15.6  
    15.7 +#include <cpptest.h>
    15.8 +#include <cpptest-suite.h>
    15.9 +#include <cpptest-textoutput.h>
   15.10  #include <stdlib.h>
   15.11  #include <string.h>
   15.12  #include "platform.h"
   15.13  #include <iostream>
   15.14  #include <fstream>
   15.15 -#include <TEST_ASSERT.h>
   15.16 +#include <assert.h>
   15.17  #include <sstream>
   15.18  #include "mime.h"
   15.19  #include "message_api.h"
   15.20  #include "test_util.h"
   15.21  
   15.22 +#include "EngineTestSuite.h"
   15.23 +#include "EngineTestSessionSuite.h"
   15.24 +#include "DecorateTests.h"
   15.25 +
   15.26  using namespace std;
   15.27  
   15.28  DecorateTests::DecorateTests(string suitename, string test_home_dir) :