working on autogen of test suite object builders local_cpptest
authorKrista Bennett <krista@pep-project.org>
Wed, 02 May 2018 16:59:14 +0200
branchlocal_cpptest
changeset 26427dbfc6c3f3c8
parent 2641 f249c4bcc819
child 2644 271d7a25c8d3
working on autogen of test suite object builders
test/Makefile
test/src/SuiteMaker.cc
     1.1 --- a/test/Makefile	Wed May 02 11:07:57 2018 +0200
     1.2 +++ b/test/Makefile	Wed May 02 16:59:14 2018 +0200
     1.3 @@ -6,6 +6,8 @@
     1.4  
     1.5  include ../default.conf
     1.6  
     1.7 +PY_ENV := $(shell command -v python3 2> /dev/null)
     1.8 +
     1.9  HERE:=$(CURDIR)
    1.10  TEST_HOME=$(HERE)/pEp_test_home
    1.11  
    1.12 @@ -81,11 +83,19 @@
    1.13  
    1.14  CPPFLAGS += $(INC_FLAGS) -MMD -MP
    1.15  
    1.16 -all: $(TARGET) test_home_
    1.17 +all: suitemaker $(TARGET) test_home_
    1.18  	
    1.19  $(TARGET): $(OBJS)
    1.20  	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
    1.21  
    1.22 +.PHONY: suitemaker
    1.23 +suitemaker:
    1.24 +ifndef PY_ENV
    1.25 +	@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
    1.26 +else
    1.27 +	$(PY_ENV) gensuitemaker.py
    1.28 +endif
    1.29 +		
    1.30  .PHONY: test_home_
    1.31  test_home_: 
    1.32  	mkdir -p $(TEST_HOME)
     2.1 --- a/test/src/SuiteMaker.cc	Wed May 02 11:07:57 2018 +0200
     2.2 +++ b/test/src/SuiteMaker.cc	Wed May 02 16:59:14 2018 +0200
     2.3 @@ -1,3 +1,5 @@
     2.4 +// This file is under GNU General Public License 3.0
     2.5 +// see LICENSE.txt
     2.6  #include <cpptest.h>
     2.7  #include <cpptest-suite.h>
     2.8  #include <cpptest-textoutput.h>
     2.9 @@ -9,14 +11,21 @@
    2.10  #include "EngineTestSessionSuite.h"
    2.11  #include "SuiteMaker.h"
    2.12  
    2.13 -// Begin where we should generate stuff
    2.14 +// Begin where we generate stuff
    2.15  #include "DecorateTests.h"
    2.16 +#include "AppleMailTests.h"
    2.17 +
    2.18  
    2.19  using namespace std;
    2.20  
    2.21 +static const char* const all_suites[] = {
    2.22 +    "DecorateTests",
    2.23 +    "AppleMailTests",
    2.24 +};
    2.25 +
    2.26  void suitemaker_build(const char* test_class_name, const char* test_home, std::auto_ptr<Test::Suite>& test_suite) {
    2.27      if (strcmp(test_class_name, "DecorateTests") == 0)
    2.28          test_suite = auto_ptr<Test::Suite> (new DecorateTests(test_class_name, test_home));
    2.29      else if (strcmp(test_class_name, "AppleMailTests") == 0)
    2.30 -        test_suite = auto_ptr<Test::Suite> (new DecorateTests(test_class_name, test_home));    
    2.31 +        test_suite = auto_ptr<Test::Suite> (new AppleMailTests(test_class_name, test_home));
    2.32  }