git subrepo clone git@github.com:compihu/platform-test-f4-ll.git platforms/platform-test-f4-ll
subrepo: subdir: "platforms/platform-test-f4-ll" merged: "bc41134" upstream: origin: "git@github.com:compihu/platform-test-f4-ll.git" branch: "master" commit: "bc41134" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "87ee373"
This commit is contained in:
parent
46ce55c6a0
commit
95af4ce0d8
460 changed files with 84105 additions and 0 deletions
|
@ -0,0 +1,10 @@
|
|||
#include "ClassName.h"
|
||||
|
||||
ClassName::ClassName()
|
||||
{
|
||||
}
|
||||
|
||||
ClassName::~ClassName()
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ClassName is responsible for ...
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ClassName
|
||||
{
|
||||
public:
|
||||
explicit ClassName();
|
||||
virtual ~ClassName();
|
||||
|
||||
private:
|
||||
|
||||
ClassName(const ClassName&);
|
||||
ClassName& operator=(const ClassName&);
|
||||
|
||||
};
|
||||
|
||||
#endif // D_ClassName_H
|
|
@ -0,0 +1,16 @@
|
|||
#include "ClassName.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
//static local variables
|
||||
|
||||
|
||||
void ClassName_Create(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassName_Destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ClassName is responsible for ...
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void ClassName_Create(void);
|
||||
void ClassName_Destroy(void);
|
||||
|
||||
#endif // D_ClassName_H
|
|
@ -0,0 +1,23 @@
|
|||
#include "ClassName.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
//static local variables
|
||||
typedef struct _ClassName
|
||||
{
|
||||
int placeHolderForHiddenStructElements;
|
||||
};
|
||||
|
||||
ClassName* ClassName_Create(void)
|
||||
{
|
||||
ClassName* self = malloc(sizeof(ClassName));
|
||||
memset(self, 0, sizeof(ClassName));
|
||||
return self;
|
||||
}
|
||||
|
||||
void ClassName_Destroy(ClassName* self)
|
||||
{
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ClassName is responsible for ...
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _ClassName Classname;
|
||||
|
||||
ClassName* ClassName_Create(void);
|
||||
void ClassName_Destroy(ClassName*);
|
||||
void ClassName_VirtualFunction_impl(ClassName*);
|
||||
|
||||
#endif // D_ClassName_H
|
|
@ -0,0 +1,41 @@
|
|||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
static int fakeRan = 0;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
void virtualFunction_renameThis_fake(ClassName*)
|
||||
{
|
||||
fakeRan = 1;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
ClassName* aClassName;
|
||||
|
||||
void setup()
|
||||
{
|
||||
aClassName = ClassName_Create();
|
||||
fakeRan = 0;
|
||||
aClassName->virtualFunction_renameThis = virtualFunction_renameThis_fake;
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy(aClassName);
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Fake)
|
||||
{
|
||||
aClassName->virtualFunction_renameThis(aClassName);
|
||||
LONGS_EQUAL(1, fakeRan);
|
||||
}
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include "ClassName.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
//static local variables
|
||||
typedef struct _ClassName
|
||||
{
|
||||
int placeHolderForHiddenStructElements;
|
||||
};
|
||||
|
||||
ClassName* ClassName_Create(void)
|
||||
{
|
||||
ClassName* self = malloc(sizeof(ClassName));
|
||||
memset(self, 0, sizeof(ClassName));
|
||||
return self;
|
||||
}
|
||||
|
||||
void ClassName_Destroy(ClassName* self)
|
||||
{
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ClassName is responsible for ...
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct _ClassName ClassnamePiml;
|
||||
|
||||
|
||||
|
||||
ClassName* ClassName_Create(void);
|
||||
void ClassName_Destroy(ClassName*);
|
||||
void ClassName_VirtualFunction_impl(ClassName*);
|
||||
|
||||
#endif // D_ClassName_H
|
|
@ -0,0 +1,25 @@
|
|||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#include <cppunit/config/SourcePrefix.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "ClassName.h"
|
||||
|
||||
class ClassNameTest: public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(ClassNameTest);
|
||||
CPPUNIT_TEST(testCreate);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
ClassName* aClassName;
|
||||
|
||||
public:
|
||||
|
||||
void setUp()
|
||||
{
|
||||
aClassName = new ClassName();
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
delete aClassName;
|
||||
}
|
||||
|
||||
void testCreate()
|
||||
{
|
||||
CPPUNIT_FAIL("Start here");
|
||||
}
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ClassNameTest);
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "FakeClassName.h"
|
||||
}
|
||||
|
||||
TEST_GROUP(FakeClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(FakeClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#include <cppunit/config/SourcePrefix.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "ClassName.h"
|
||||
#include "MockClassName.h"
|
||||
|
||||
class MockClassNameTest: public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(MockClassNameTest);
|
||||
CPPUNIT_TEST(testCreate);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
ClassName* aClassName;
|
||||
MockClassName* mockClassName;
|
||||
|
||||
public:
|
||||
|
||||
void setUp()
|
||||
{
|
||||
mockClassName = new MockClassName();
|
||||
aClassName = mockClassName;
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
delete aClassName;
|
||||
}
|
||||
|
||||
void testCreate()
|
||||
{
|
||||
CPPUNIT_FAIL("Start here");
|
||||
}
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(MockClassNameTest);
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef D_MockClassName_H
|
||||
#define D_MockClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MockClassName.h
|
||||
//
|
||||
// MockClassName is responsible for providing a test stub for ClassName
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "ClassName.h"
|
||||
|
||||
|
||||
class MockClassName : public ClassName
|
||||
{
|
||||
public:
|
||||
explicit MockClassName()
|
||||
{}
|
||||
virtual ~MockClassName()
|
||||
{}
|
||||
|
||||
private:
|
||||
|
||||
MockClassName(const MockClassName&);
|
||||
MockClassName& operator=(const MockClassName&);
|
||||
|
||||
};
|
||||
|
||||
#endif // D_MockClassName_H
|
|
@ -0,0 +1,16 @@
|
|||
#include "ClassName.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
//static local variables
|
||||
|
||||
|
||||
void ClassName_Create(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassName_Destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef D_FakeClassName_H
|
||||
#define D_FakeClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FakeClassName.h
|
||||
//
|
||||
// FakeClassName is responsible for providing a test stub for ClassName
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "ClassName.h"
|
||||
|
||||
#endif // D_FakeClassName_H
|
|
@ -0,0 +1,48 @@
|
|||
#Set this to @ to keep the makefile quiet
|
||||
SILENCE = @
|
||||
|
||||
#---- Outputs ----#
|
||||
COMPONENT_NAME = Project
|
||||
TARGET_LIB = \
|
||||
lib/lib$(COMPONENT_NAME).a
|
||||
|
||||
TEST_TARGET = \
|
||||
$(COMPONENT_NAME)_tests
|
||||
|
||||
#--- Inputs ----#
|
||||
PROJECT_HOME_DIR = .
|
||||
CPPUTEST_HOME = ../CppUTest
|
||||
CPPUNIT_HOME = ../cppunit
|
||||
CPP_PLATFORM = Gcc
|
||||
|
||||
#CFLAGS are set to override malloc and free to get memory leak detection in C programs
|
||||
CFLAGS = -Dmalloc=cpputest_malloc -Dfree=cpputest_free
|
||||
CPPFLAGS =
|
||||
#GCOVFLAGS = -fprofile-arcs -ftest-coverage
|
||||
|
||||
#SRC_DIRS is a list of source directories that make up the target library
|
||||
#If test files are in these directories, their IMPORT_TEST_GROUPs need
|
||||
#to be included in main to force them to be linked in. By convention
|
||||
#put them into an AllTests.h file in each directory
|
||||
SRC_DIRS = \
|
||||
src/util
|
||||
|
||||
#TEST_SRC_DIRS is a list of directories including
|
||||
# - A test main (AllTests.cpp by convention)
|
||||
# - OBJ files in these directories are included in the TEST_TARGET
|
||||
# - Consequently - AllTests.h containing the IMPORT_TEST_GROUPS is not needed
|
||||
# -
|
||||
TEST_SRC_DIRS = \
|
||||
tests \
|
||||
tests/util
|
||||
|
||||
#includes for all compiles
|
||||
INCLUDES =\
|
||||
-I.\
|
||||
-Iinclude/util\
|
||||
-I$(CPPUTEST_HOME)/include/
|
||||
|
||||
#Flags to pass to ld
|
||||
LDFLAGS += $(CPPUNIT_HOME)/lib/libcppunit.a
|
||||
|
||||
include $(CPPUTEST_HOME)/build/ComponentMakefile
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef D_ProjectBuildTime_H
|
||||
#define D_ProjectBuildTime_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ProjectBuildTime is responsible for recording and reporting when
|
||||
// this project library was built
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ProjectBuildTime
|
||||
{
|
||||
public:
|
||||
explicit ProjectBuildTime();
|
||||
virtual ~ProjectBuildTime();
|
||||
|
||||
const char* GetDateTime();
|
||||
|
||||
private:
|
||||
|
||||
const char* dateTime;
|
||||
|
||||
ProjectBuildTime(const ProjectBuildTime&);
|
||||
ProjectBuildTime& operator=(const ProjectBuildTime&);
|
||||
|
||||
};
|
||||
|
||||
#endif // D_ProjectBuildTime_H
|
|
@ -0,0 +1,16 @@
|
|||
#include "ProjectBuildTime.h"
|
||||
|
||||
ProjectBuildTime::ProjectBuildTime()
|
||||
: dateTime(__DATE__ " " __TIME__)
|
||||
{
|
||||
}
|
||||
|
||||
ProjectBuildTime::~ProjectBuildTime()
|
||||
{
|
||||
}
|
||||
|
||||
const char* ProjectBuildTime::GetDateTime()
|
||||
{
|
||||
return dateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
#include "CppUTest/CommandLineTestRunner.h"
|
||||
|
||||
int main(int ac, char** av)
|
||||
{
|
||||
return CommandLineTestRunner::RunAllTests(ac, av);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#include "CppUTest/TestHarness.h"
|
||||
#include "ProjectBuildTime.h"
|
||||
|
||||
TEST_GROUP(ProjectBuildTime)
|
||||
{
|
||||
ProjectBuildTime* projectBuildTime;
|
||||
|
||||
void setup()
|
||||
{
|
||||
projectBuildTime = new ProjectBuildTime();
|
||||
}
|
||||
void teardown()
|
||||
{
|
||||
delete projectBuildTime;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ProjectBuildTime, Create)
|
||||
{
|
||||
CHECK(0 != projectBuildTime->GetDateTime());
|
||||
}
|
||||
|
94
platforms/platform-test-f4-ll/cpputest/scripts/GenerateSrcFiles.sh
Executable file
94
platforms/platform-test-f4-ll/cpputest/scripts/GenerateSrcFiles.sh
Executable file
|
@ -0,0 +1,94 @@
|
|||
#!/bin/bash -x
|
||||
#$1 is the template root file name
|
||||
#$2 is the kind of file to create (c or cpp)
|
||||
#$3 is Mock if a mock version should be created, Fake for a fake C version
|
||||
#$4 is the class/module name
|
||||
#$5 is the package name
|
||||
|
||||
#Test for env var set.
|
||||
checkForCppUTestToolsEnvVariable() {
|
||||
if [ -z "$CPPUTEST_HOME" ] ; then
|
||||
echo "CPPUTEST_HOME not set. You must set CPPUTEST_HOME to the top level CppUTest directory"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$CPPUTEST_HOME" ] ; then
|
||||
echo "CPPUTEST_HOME not set to a directory. You must set CPPUTEST_HOME to the top level CppUTest directory"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
checkForCppUTestToolsEnvVariable
|
||||
|
||||
templateRootName=$1
|
||||
srcSuffix=$2
|
||||
mock=$3
|
||||
className=$4
|
||||
packageName=$5
|
||||
testSuffix=Test
|
||||
|
||||
#CPP_SOURCE_TEMPLATES can point to templates you write
|
||||
#identify the template files
|
||||
if [ "$CPP_SOURCE_TEMPLATES" == "" ]
|
||||
then
|
||||
TEMPLATE_DIR=$CPPUTEST_HOME/scripts/templates
|
||||
else
|
||||
TEMPLATE_DIR=$CPP_SOURCE_TEMPLATES
|
||||
fi
|
||||
|
||||
templateHFile=$TEMPLATE_DIR/$templateRootName.h
|
||||
templateSrcFile=$TEMPLATE_DIR/$templateRootName.$srcSuffix
|
||||
if [ "$mock" == "Mock" ] ; then
|
||||
templateTestFile=$TEMPLATE_DIR/Interface$testSuffix.cpp
|
||||
elif [ "$mock" == "Fake" ] ; then
|
||||
templateTestFile=$TEMPLATE_DIR/InterfaceC$testSuffix.cpp
|
||||
else
|
||||
templateTestFile=$TEMPLATE_DIR/$templateRootName$testSuffix.cpp
|
||||
fi
|
||||
templateMockFile=$TEMPLATE_DIR/Mock$templateRootName.h
|
||||
|
||||
#indentify the class and instance names
|
||||
instanceName=$(echo $className | cut -c1 | tr A-Z a-z)$(echo $className | cut -c 2-)
|
||||
className=$(echo $className | cut -c1 | tr a-z A-Z)$(echo $className | cut -c 2-)
|
||||
|
||||
#if a package is specified, set the directories
|
||||
if [ ! "$packageName" == "" ]
|
||||
then
|
||||
srcDir=src/$packageName/
|
||||
includeDir=include/$packageName/
|
||||
testsDir=tests/$packageName/
|
||||
fi
|
||||
|
||||
#identify the files being created
|
||||
hFile=${includeDir}${className}.h
|
||||
srcFile=${srcDir}${className}.${srcSuffix}
|
||||
testFile=${testsDir}${className}${testSuffix}.cpp
|
||||
if [ "$mock" != "NoMock" ] ; then
|
||||
mockFile=${testsDir}${mock}${className}.h
|
||||
testFile=${testsDir}${mock}${className}${testSuffix}.cpp
|
||||
if [ "$srcSuffix" == "c" ] ; then
|
||||
srcFile=${testsDir}${mock}${className}.${srcSuffix}
|
||||
fi
|
||||
else
|
||||
mockFile=
|
||||
fi
|
||||
|
||||
sedCommands="-e s/aClassName/$instanceName/g -e s/ClassName/$className/g"
|
||||
|
||||
generateFileIfNotAlreadyThere() {
|
||||
if [ -e $2 ]
|
||||
then
|
||||
echo "${2} already exists, skipping"
|
||||
else
|
||||
echo "creating ${2}"
|
||||
sed $sedCommands $1 | tr -d "\r" >$2
|
||||
fi
|
||||
}
|
||||
|
||||
generateFileIfNotAlreadyThere $templateHFile $hFile
|
||||
generateFileIfNotAlreadyThere $templateSrcFile $srcFile
|
||||
generateFileIfNotAlreadyThere $templateTestFile $testFile
|
||||
if [ "$mock" != "NoMock" ] ; then
|
||||
generateFileIfNotAlreadyThere $templateMockFile $mockFile
|
||||
# sed $sedCommands $templateMockFile | tr -d "\r" >$mockFile
|
||||
fi
|
||||
|
20
platforms/platform-test-f4-ll/cpputest/scripts/InstallScripts.sh
Executable file
20
platforms/platform-test-f4-ll/cpputest/scripts/InstallScripts.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash -x
|
||||
FirstLetter=${0:0:1}
|
||||
if [[ $FirstLetter == "/" ]] ; then
|
||||
CPPUTEST_HOME=${0%/scripts/*}
|
||||
else
|
||||
file=$(pwd)/${0}
|
||||
CPPUTEST_HOME="${file%/scripts/*}"
|
||||
fi
|
||||
|
||||
EXE_DIR=${EXE_DIR:-/usr/local/bin}
|
||||
test -f ${EXE_DIR} || mkdir -p ${EXE_DIR}
|
||||
|
||||
NEW_SCRIPTS="NewCIoDriver NewClass NewInterface NewCModule NewCmiModule NewProject NewLibrary NewPackageDirs NewCInterface NewCFunction NewHelp"
|
||||
|
||||
|
||||
for file in $NEW_SCRIPTS ; do
|
||||
rm -f ${EXE_DIR}/${file}
|
||||
ln -s ${CPPUTEST_HOME}/scripts/${file}.sh ${EXE_DIR}/${file}
|
||||
chmod a+x ${EXE_DIR}/${file}
|
||||
done
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCBaseModule.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCBaseModule.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassNameC c NoMock $1 $2
|
||||
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCFunction.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCFunction.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh FunctionNameC c NoMock $1 $2
|
||||
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCInterface.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCInterface.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassNameC c Fake $1 $2
|
||||
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCIoDriver.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCIoDriver.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassNameCIoDriver c NoMock $1 $2
|
||||
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCModule.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCModule.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassNameC c NoMock $1 $2
|
||||
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewClass.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewClass.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassName cpp NoMock $1 $2
|
||||
|
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCmiModule.sh
Executable file
4
platforms/platform-test-f4-ll/cpputest/scripts/NewCmiModule.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassNameCMultipleInstance c NoMock $1 $2
|
||||
|
16
platforms/platform-test-f4-ll/cpputest/scripts/NewHelp.sh
Executable file
16
platforms/platform-test-f4-ll/cpputest/scripts/NewHelp.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
NEW_SCRIPTS=" \
|
||||
NewClass \
|
||||
NewInterface \
|
||||
NewCModule \
|
||||
NewCmiModule \
|
||||
NewCInterface \
|
||||
NewCFunction"
|
||||
|
||||
for file in $NEW_SCRIPTS ; do
|
||||
echo ${file} name package
|
||||
rm -f ${EXE_DIR}/${file}
|
||||
ln -s ${CPPUTEST_HOME}/scripts/${file}.sh ${EXE_DIR}/${file}
|
||||
chmod a+x ${EXE_DIR}/${file}
|
||||
done
|
||||
|
3
platforms/platform-test-f4-ll/cpputest/scripts/NewInterface.sh
Executable file
3
platforms/platform-test-f4-ll/cpputest/scripts/NewInterface.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
source ${CPPUTEST_HOME}/scripts/GenerateSrcFiles.sh ClassName cpp Mock $1 $2
|
35
platforms/platform-test-f4-ll/cpputest/scripts/NewLibrary.sh
Executable file
35
platforms/platform-test-f4-ll/cpputest/scripts/NewLibrary.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash -x
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
LIBRARY=$1
|
||||
|
||||
if [ -e ${LIBRARY} ] ; then
|
||||
echo "The directory ${LIBRARY} already exists"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Copy template project to ${LIBRARY}"
|
||||
cp -R ${TEMPLATE_DIR}/ProjectTemplate/Project ${LIBRARY}
|
||||
find ${LIBRARY} -name \.svn | xargs rm -rf
|
||||
|
||||
echo "Update to the new LIBRARY name"
|
||||
substituteProjectName="-e s/Project/${LIBRARY}/g -i .bak"
|
||||
|
||||
cd ${LIBRARY}
|
||||
|
||||
sed ${substituteProjectName} *.*
|
||||
sed ${substituteProjectName} Makefile
|
||||
|
||||
for name in BuildTime.h BuildTime.cpp BuildTimeTest.cpp ; do
|
||||
mv Project${name} ${LIBRARY}${name}
|
||||
done
|
||||
|
||||
cd ..
|
||||
|
||||
sed -e "s/DIRS = /DIRS = ${LIBRARY} /g" -i .bak Makefile
|
||||
|
||||
find ${LIBRARY} -name \*.bak | xargs rm -f
|
||||
|
||||
echo "#include \"../${LIBRARY}/AllTests.h\"" >> AllTests/AllTests.cpp
|
||||
|
||||
echo "You have to manually add the library reference to the AllTests Makefile"
|
||||
echo "and maybe change the order of the library builds in the main Makefile"
|
11
platforms/platform-test-f4-ll/cpputest/scripts/NewPackageDirs.sh
Executable file
11
platforms/platform-test-f4-ll/cpputest/scripts/NewPackageDirs.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
package=$1
|
||||
|
||||
for dir in src include tests ; do
|
||||
packageDir=${dir}/${package}
|
||||
if [ ! -d "$packageDir" ] ; then
|
||||
echo "creating $packageDir"
|
||||
mkdir $packageDir
|
||||
fi
|
||||
done
|
||||
|
37
platforms/platform-test-f4-ll/cpputest/scripts/NewProject.sh
Normal file
37
platforms/platform-test-f4-ll/cpputest/scripts/NewProject.sh
Normal file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
PROJECT_NAME=$1
|
||||
CODE_LEGAL_PROJECT_NAME=$(echo $PROJECT_NAME | sed 's/-/_/g')
|
||||
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
|
||||
ORIGINAL_DIR=$(pwd)
|
||||
|
||||
if [ -e ${PROJECT_NAME} ] ; then
|
||||
echo "The directory ${PROJECT_NAME} already exists"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Copy template project"
|
||||
cp -R ${TEMPLATE_DIR}/ProjectTemplate ${PROJECT_NAME}
|
||||
find ${PROJECT_NAME} -name \.svn | xargs rm -rf
|
||||
|
||||
cd ${PROJECT_NAME}
|
||||
|
||||
ls
|
||||
|
||||
changeProjectName() {
|
||||
echo Change Name $1/Project$2 to $3$2
|
||||
sed "-e s/Project/$3/g" $1/Project$2 | tr -d "\r" >$1/$3$2
|
||||
rm $1/Project$2
|
||||
}
|
||||
|
||||
changeProjectName . Makefile ${CODE_LEGAL_PROJECT_NAME}
|
||||
changeProjectName . .project ${PROJECT_NAME}
|
||||
changeProjectName src/util BuildTime.cpp ${CODE_LEGAL_PROJECT_NAME}
|
||||
changeProjectName include/util BuildTime.h ${CODE_LEGAL_PROJECT_NAME}
|
||||
changeProjectName tests/util BuildTimeTest.cpp ${CODE_LEGAL_PROJECT_NAME}
|
||||
mv ${CODE_LEGAL_PROJECT_NAME}Makefile Makefile
|
||||
mv ${PROJECT_NAME}.project .project
|
||||
mv Project.cproject .cproject
|
||||
|
||||
cd ${ORIGINAL_DIR}
|
||||
echo "You might want to modify the path for CPPUTEST_HOME in the Makefile."
|
30
platforms/platform-test-f4-ll/cpputest/scripts/README.txt
Normal file
30
platforms/platform-test-f4-ll/cpputest/scripts/README.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
The New*.sh scripts are helpful for creating the initial files for a new class...
|
||||
NewClass.sh - for TDDing a new C++ class
|
||||
NewInterface.sh - for TDDing a new interface along with its Mock
|
||||
NewCModule.sh - for TDDing a C module
|
||||
NewCmiModule.sh - for TDDing a C module where there will be multiple
|
||||
instances of the module's data structure
|
||||
|
||||
Run InstallScripts.sh to
|
||||
1) Copy the scripts to /usr/local/bin
|
||||
2) Define symbolic links for each of the scripts
|
||||
|
||||
Like this:
|
||||
./scripts/InstallScripts.sh
|
||||
|
||||
You might have to add the execute privilege to the shell scripts.
|
||||
Like this:
|
||||
chmod +x *.sh
|
||||
|
||||
Using NewClass for example:
|
||||
cd to the directory where you want the files located
|
||||
NewClass SomeClass
|
||||
|
||||
The script gets you ready for TDD and saves a lot of tedious typing
|
||||
Creates SomeClass.h SomeClass.cpp SomeClassTest.cpp
|
||||
with the class and test essentials in place
|
||||
(If the file already exists, no file is generated)
|
||||
|
||||
|
||||
These scripts are written in bash.
|
||||
|
75
platforms/platform-test-f4-ll/cpputest/scripts/RefactorRenameIncludeFile.sh
Executable file
75
platforms/platform-test-f4-ll/cpputest/scripts/RefactorRenameIncludeFile.sh
Executable file
|
@ -0,0 +1,75 @@
|
|||
#!/bin/bash +x
|
||||
dirs_to_look_in="src tests include mocks"
|
||||
from_name=$1
|
||||
to_name=$2
|
||||
SVN=svn
|
||||
|
||||
findFilesWithInclude()
|
||||
{
|
||||
files_with_include=$(find $dirs_to_look_in -name "*.[hc]" -o -name "*.cpp" | xargs grep -l "#include \"$1\"")
|
||||
if [ "$files_with_include" != "" ]
|
||||
then
|
||||
files_with_include+=" "
|
||||
fi
|
||||
|
||||
files_with_include+=$(find $dirs_to_look_in -name "*.[hc]" -o -name "*.cpp" | xargs grep -l "#include <$1>")
|
||||
echo $files_with_include
|
||||
}
|
||||
|
||||
checkForPriorNameUseIncludes()
|
||||
{
|
||||
files=$(findFilesWithInclude $1)
|
||||
|
||||
if [ "$files" != "" ]
|
||||
then
|
||||
echo "name already included: $1 included in ${files}"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
checkForFileNameExists()
|
||||
{
|
||||
files=$(find $dirs_to_look_in -name $1)
|
||||
if [ "$files" != "" ]
|
||||
then
|
||||
echo "name already in use: $1 found in ${files}"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
searchAndReplaceIncludes()
|
||||
{
|
||||
files=$(findFilesWithInclude $1)
|
||||
if [ "$files" = "" ]
|
||||
then
|
||||
echo "No files found including $1"
|
||||
exit
|
||||
fi
|
||||
echo "Changing include $1 to $2 in: $files"
|
||||
set -x
|
||||
sed -i "" -e "s/#include \"$1\"/#include \"$2\"/g" $files
|
||||
sed -i "" -e "s/#include <$1>/#include <$2>/g" $files
|
||||
set +x
|
||||
}
|
||||
|
||||
renameIncludeFile()
|
||||
{
|
||||
file=$(find $dirs_to_look_in -name $1)
|
||||
if [ $(echo $file | wc -l) != 1 ]
|
||||
then
|
||||
echo "More than one potential file to rename $file"
|
||||
exit
|
||||
fi
|
||||
set -x
|
||||
from_module_name=$(basename $1 .h)
|
||||
to_module_name=$(basename $2 .h)
|
||||
sed -i "" -e "s/$from_module_name/$to_module_name/g" $file
|
||||
path=$(dirname $file)
|
||||
$SVN mv $file $path/$2
|
||||
set +x
|
||||
}
|
||||
|
||||
checkForFileNameExists $to_name
|
||||
checkForPriorNameUseIncludes $to_name
|
||||
searchAndReplaceIncludes $from_name $to_name
|
||||
renameIncludeFile $1 $2
|
108
platforms/platform-test-f4-ll/cpputest/scripts/ReleaseCppUTest.sh
Executable file
108
platforms/platform-test-f4-ll/cpputest/scripts/ReleaseCppUTest.sh
Executable file
|
@ -0,0 +1,108 @@
|
|||
#!/bin/bash
|
||||
#source in release generator script
|
||||
|
||||
echo "Do not use this anymore, please use \"configure; make dist\""
|
||||
exit
|
||||
|
||||
if [ ! -d "scripts" ]; then
|
||||
echo "You have to run this script from the CPPUTEST_HOME directory!";
|
||||
exit
|
||||
fi
|
||||
|
||||
GENERATED_FILES=""
|
||||
release_dir=Releases
|
||||
scripts_dir=scripts
|
||||
version=v3.3
|
||||
zip_root=CppUTest-${version}
|
||||
tar_root=CppUTest-${version}_tar
|
||||
clean_unzip_root=${zip_root}_clean_unzip
|
||||
clean_untar_root=${zip_root}_clean_untar
|
||||
zip_file=${zip_root}.zip
|
||||
tar_file=${zip_root}.tar.gz
|
||||
|
||||
exitIfFileExists() {
|
||||
if [ -e $1 ]
|
||||
then
|
||||
echo "${1} already exists, exiting."
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
generateMakeScript() {
|
||||
filename=$1
|
||||
dateTime=$2
|
||||
version=$3
|
||||
target=$4
|
||||
exitIfFileExists $filename.sh
|
||||
echo "#Generated file - ${filename}.sh" >$filename.sh
|
||||
echo "echo \"Running ${filename} for CppUTest ${version} created on ${dateTime}\"" >>$filename.sh
|
||||
echo "export CPPUTEST_HOME=\$(pwd)" >>$filename.sh
|
||||
echo "echo \"export CPPUTEST_HOME=\$(pwd)/\"" >>$filename.sh
|
||||
echo "make $target" >>$filename.sh
|
||||
|
||||
chmod +x $filename.sh
|
||||
GENERATED_FILES+=" $filename.sh"
|
||||
}
|
||||
|
||||
generateVersionFile() {
|
||||
version=$1
|
||||
dateTime=$2
|
||||
versionFile=version.txt
|
||||
echo "CppUTest ${version} created on ${dateTime}" > $versionFile
|
||||
GENERATED_FILES+=$versionFile
|
||||
}
|
||||
|
||||
zipIt() {
|
||||
mkdir -p ${release_dir}
|
||||
zip -r ${release_dir}/${zip_file} \
|
||||
$GENERATED_FILES \
|
||||
.\
|
||||
-x@${scripts_dir}/zipExclude.txt
|
||||
tar -cvpzf ${release_dir}/${tar_file} \
|
||||
-X ./${scripts_dir}/zipExclude.txt \
|
||||
$GENERATED_FILES \
|
||||
.
|
||||
}
|
||||
|
||||
cleanUp() {
|
||||
rm -f $GENERATED_FILES
|
||||
}
|
||||
|
||||
generateCppUTestRelease() {
|
||||
dateTime=$(date +%F-%H-%M)
|
||||
generateVersionFile $version $dateTime
|
||||
generateMakeScript makeAll $dateTime $version everythingInstall
|
||||
generateMakeScript cleanAll $dateTime $version cleanEverythingInstall
|
||||
zipIt $version
|
||||
cleanUp
|
||||
}
|
||||
|
||||
openAndMakeRelease()
|
||||
{
|
||||
cd ${release_dir}
|
||||
|
||||
# unzip and untar the code and make sure it is the same
|
||||
rm -rf ${clean_unzip_root}
|
||||
unzip ${zip_file} -d ${clean_unzip_root}
|
||||
rm -rf ${clean_untar_root}
|
||||
mkdir ${clean_untar_root}
|
||||
tar -xvzpf ${tar_file} -C ${clean_untar_root}
|
||||
|
||||
rm -rf ${zip_root}
|
||||
unzip ${zip_file} -d ${zip_root}
|
||||
cd ${zip_root}
|
||||
./makeAll.sh
|
||||
cd ..
|
||||
|
||||
rm -rf ${tar_root}
|
||||
mkdir ${tar_root}
|
||||
tar -xvzpf ${tar_file} -C ${tar_root}
|
||||
cd ${tar_root}
|
||||
./makeAll.sh
|
||||
cd ../..
|
||||
}
|
||||
|
||||
|
||||
#Main
|
||||
generateCppUTestRelease
|
||||
openAndMakeRelease
|
|
@ -0,0 +1,28 @@
|
|||
extern "C" {
|
||||
#include "ClassName.h"
|
||||
#include "MockIO.h"
|
||||
}
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
Reset_Mock_IO();
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
Assert_No_Unused_Expectations();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
ClassName aClassName;
|
||||
|
||||
void setup()
|
||||
{
|
||||
aClassName = ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy(aClassName);
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "FakeClassName.h"
|
||||
}
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<CPPUTEST_INCLUDE_PATHS>$(CPPUTEST_HOME)\include;$(CPPUTEST_HOME)\include\CppUTestExt\CppUTestGTest;$(CPPUTEST_HOME)\include\CppUTestExt\CppUTestGMock;$(CPPUTEST_HOME)\include\Platforms\VisualCpp</CPPUTEST_INCLUDE_PATHS>
|
||||
<CPPUTEST_LIB_PATHS>$(CPPUTEST_HOME)\lib</CPPUTEST_LIB_PATHS>
|
||||
<CPPUTEST_FORCED_INCLUDES>$(CPPUTEST_HOME)\include\Platforms\VisualCpp\Platform.h;$(CPPUTEST_HOME)\include\CppUTest\MemoryLeakDetectorMallocMacros.h;</CPPUTEST_FORCED_INCLUDES>
|
||||
<CPPUTEST_LIB_DEPENDENCIES>CppUTest.lib</CPPUTEST_LIB_DEPENDENCIES>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(CPPUTEST_INCLUDE_PATHS);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<ForcedIncludeFiles>$(CPPUTEST_FORCED_INCLUDES);%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(CPPUTEST_LIB_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(CPPUTEST_LIB_PATHS);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>$(TargetPath)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="CPPUTEST_HOME">
|
||||
<Value>$(CPPUTEST_HOME)</Value>
|
||||
<EnvironmentVariable>true</EnvironmentVariable>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="CPPUTEST_INCLUDE_PATHS">
|
||||
<Value>$(CPPUTEST_INCLUDE_PATHS)</Value>
|
||||
<EnvironmentVariable>true</EnvironmentVariable>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="CPPUTEST_LIB_PATHS">
|
||||
<Value>$(CPPUTEST_LIB_PATHS)</Value>
|
||||
<EnvironmentVariable>true</EnvironmentVariable>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="CPPUTEST_FORCED_INCLUDES">
|
||||
<Value>$(CPPUTEST_FORCED_INCLUDES)</Value>
|
||||
<EnvironmentVariable>true</EnvironmentVariable>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="CPPUTEST_LIB_DEPENDENCIES">
|
||||
<Value>$(CPPUTEST_LIB_DEPENDENCIES)</Value>
|
||||
<EnvironmentVariable>true</EnvironmentVariable>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,8 @@
|
|||
**Intro**
|
||||
The CppUTest_VS2010.props property sheet sets the needed compiler and linker options for your unit test project.
|
||||
|
||||
**Instructions**
|
||||
1) Create a system environment variable, CPPUTEST_HOME and set it to the path of your CppUTest distribution.
|
||||
2) Add the CppUTest_VS2010.props property sheet to your unit test project and you are good to go.
|
||||
3) See the WalkThrough_VS2010 guide in the docs section for details.
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
|
||||
# Load functions from the helper file
|
||||
. (Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'appveyor_helpers.ps1')
|
||||
|
||||
function Invoke-BuildCommand($command, $directory = '.')
|
||||
{
|
||||
$command_wrapped = "$command;`$err = `$?"
|
||||
Write-Host $command
|
||||
|
||||
Push-Location $directory
|
||||
Invoke-Expression $command_wrapped
|
||||
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
Pop-Location
|
||||
Write-Host "Command Returned error: $LASTEXITCODE"
|
||||
Exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
function Invoke-CygwinCommand($command, $directory = '.')
|
||||
{
|
||||
# Assume cygwin is located at C:\cygwin on x86 and C:\cygwin64 on x64 for now
|
||||
$cygwin_bin = Get-CygwinBin
|
||||
|
||||
$cygwin_directory = (. "${cygwin_bin}\cygpath.exe" (Resolve-Path $directory))
|
||||
$command_wrapped = "${cygwin_bin}\bash.exe --login -c 'cd $cygwin_directory ; $command'"
|
||||
|
||||
Write-Host "Executing <$command> in <$cygwin_directory>"
|
||||
Invoke-Expression $command_wrapped
|
||||
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
Write-Host "Command Returned error: $LASTEXITCODE"
|
||||
Exit $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
|
||||
# The project files that will get built
|
||||
$VS2008ProjectFiles = @( 'CppUTest.vcproj' , 'tests\AllTests.vcproj' )
|
||||
$VS2010ProjectFiles = @( 'CppUTest.vcxproj', 'tests\AllTests.vcxproj' )
|
||||
|
||||
if ($env:APPVEYOR)
|
||||
{
|
||||
$logger_arg = '/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"'
|
||||
}
|
||||
else
|
||||
{
|
||||
$logger_arg = ''
|
||||
}
|
||||
|
||||
# Clean up some paths for any configuration
|
||||
Remove-PathFolder "C:\MinGW\bin"
|
||||
Remove-PathFolder "C:\Program Files\Git\bin"
|
||||
Remove-PathFolder "C:\Program Files\Git\cmd"
|
||||
Remove-PathFolder "C:\Program Files\Git\usr\bin"
|
||||
Remove-PathFolder "C:\Program Files (x86)\Git\bin"
|
||||
Remove-PathFolder "C:\Program Files (x86)\Git\cmd"
|
||||
Remove-PathFolder "C:\Program Files (x86)\Git\usr\bin"
|
||||
|
||||
switch -Wildcard ($env:Platform)
|
||||
{
|
||||
'Cygwin*'
|
||||
{
|
||||
Invoke-CygwinCommand "autoreconf -i .." "cpputest_build"
|
||||
Invoke-CygwinCommand "../configure" "cpputest_build"
|
||||
Invoke-CygwinCommand "make CppUTestTests.exe CppUTestExtTests.exe" "cpputest_build"
|
||||
}
|
||||
|
||||
'MinGW*'
|
||||
{
|
||||
$mingw_path = Get-MinGWBin
|
||||
|
||||
if ($env:Platform -like 'MinGWClang*')
|
||||
{
|
||||
$toolchain_filename = Get-ClangToolchainFilename
|
||||
$toolchain_path = (Join-Path (Split-Path $MyInvocation.MyCommand.Path) "..\cmake\$toolchain_filename")
|
||||
$toolchain = "-DCMAKE_TOOLCHAIN_FILE=$toolchain_path"
|
||||
}
|
||||
|
||||
# Add mingw to the path
|
||||
Add-PathFolder $mingw_path
|
||||
|
||||
Invoke-BuildCommand "cmake --version"
|
||||
Invoke-BuildCommand "cmake -G 'MinGW Makefiles' -DCMAKE_CXX_STANDARD=17 $toolchain .." 'cpputest_build'
|
||||
Invoke-BuildCommand "mingw32-make all" 'cpputest_build'
|
||||
|
||||
Remove-PathFolder $mingw_path
|
||||
}
|
||||
|
||||
default # Assume that anything else uses Visual C++
|
||||
{
|
||||
if ($env:PlatformToolset -eq 'v90')
|
||||
{
|
||||
# Load environment variables from vsvars32.bat
|
||||
$vsvarspath = Join-Path $env:VS90COMNTOOLS vsvars32.bat
|
||||
Get-BatchFile($vsvarspath)
|
||||
|
||||
$VS2008ProjectFiles | foreach {
|
||||
Invoke-BuildCommand "vcbuild /upgrade $_"
|
||||
}
|
||||
|
||||
$VS2008ProjectFiles | foreach {
|
||||
Invoke-BuildCommand "vcbuild $_ $env:CONFIGURATION"
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$VS2010ProjectFiles | foreach {
|
||||
Invoke-BuildCommand "msbuild /ToolsVersion:14.0 $logger_arg $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
|
||||
# Load functions from the helper file
|
||||
. (Join-Path (Split-Path $MyInvocation.MyCommand.Path) 'appveyor_helpers.ps1')
|
||||
|
||||
function Publish-TestResults($files)
|
||||
{
|
||||
$anyFailures = $FALSE
|
||||
|
||||
# Upload results to AppVeyor one by one
|
||||
$files | foreach {
|
||||
$testsuite = ([xml](get-content $_.Name)).testsuite
|
||||
|
||||
foreach ($testcase in $testsuite.testcase) {
|
||||
if ($testcase.failure) {
|
||||
Add-AppveyorTest $testcase.name -Outcome Failed -FileName $testsuite.name -ErrorMessage $testcase.failure.message
|
||||
Add-AppveyorMessage "$($testcase.name) failed" -Category Error
|
||||
$anyFailures = $TRUE
|
||||
}
|
||||
elseif ($testcase.skipped) {
|
||||
Add-AppveyorTest $testcase.name -Outcome Ignored -Filename $testsuite.name
|
||||
}
|
||||
else {
|
||||
Add-AppveyorTest $testcase.name -Outcome Passed -FileName $testsuite.name
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Item $_.Name
|
||||
}
|
||||
|
||||
if ($anyFailures -eq $TRUE){
|
||||
write-host "Failing build as there are broken tests"
|
||||
$host.SetShouldExit(1)
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-Tests($executable)
|
||||
{
|
||||
# Run tests and output the results using junit
|
||||
$TestCommand = "$executable -ojunit"
|
||||
Write-Host $TestCommand -NoNewline
|
||||
Invoke-Expression $TestCommand
|
||||
Write-Host " - return code: $LASTEXITCODE"
|
||||
if ($LASTEXITCODE -lt 0) {
|
||||
Write-Error "Runtime Exception during test execution"
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-CygwinTests($executable)
|
||||
{
|
||||
# Assume cygwin is located at C:\cygwin for now
|
||||
$cygwin_bin = Get-CygwinBin
|
||||
|
||||
# Get the full path to the executable
|
||||
$cygwin_folder = . "${cygwin_bin}\cygpath.exe" (Resolve-Path ".")
|
||||
$cygwin_exe = . "${cygwin_bin}\cygpath.exe" $executable
|
||||
|
||||
# Run tests from the cygwin prompt
|
||||
$test_command = "${cygwin_exe} -ojunit"
|
||||
$cygwin_command = "${cygwin_bin}\bash.exe --login -c 'cd ${cygwin_folder} ; ${test_command}'"
|
||||
|
||||
Write-Host $test_command
|
||||
Invoke-Expression $cygwin_command
|
||||
}
|
||||
|
||||
$TestCount = 0
|
||||
|
||||
if (-not $env:APPVEYOR)
|
||||
{
|
||||
function Add-AppVeyorTest()
|
||||
{
|
||||
# Wacky way to access a script variable, but it works
|
||||
$count = Get-Variable -Name TestCount -Scope script
|
||||
Set-Variable -Name TestCount -Scope script -Value ($count.Value + 1)
|
||||
}
|
||||
|
||||
function Add-AppVeyorMessage($Message, $Category)
|
||||
{
|
||||
if ($Category -eq 'Error')
|
||||
{
|
||||
Write-Error $Message
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host $Message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch -Wildcard ($env:Platform)
|
||||
{
|
||||
'Cygwin*'
|
||||
{
|
||||
Invoke-CygwinTests 'cpputest_build\CppUTestTests.exe'
|
||||
Invoke-CygwinTests 'cpputest_build\CppUTestExtTests.exe'
|
||||
}
|
||||
|
||||
'MinGW*'
|
||||
{
|
||||
$mingw_path = Get-MinGWBin
|
||||
|
||||
Set-Path "$mingw_path;C:\Windows;C:\Windows\System32"
|
||||
Invoke-Tests '.\cpputest_build\tests\CppUTest\CppUTestTests.exe'
|
||||
Invoke-Tests '.\cpputest_build\tests\CppUTestExt\CppUTestExtTests.exe'
|
||||
Restore-Path
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
Invoke-Tests '.\cpputest_build\AllTests.exe'
|
||||
}
|
||||
}
|
||||
|
||||
Publish-TestResults (Get-ChildItem 'cpputest_*.xml')
|
||||
|
||||
if (-not $env:APPVEYOR)
|
||||
{
|
||||
Write-Host "Tests Ran: $TestCount"
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
# Helper function to extract vars out of the vsvars batch file
|
||||
function Get-Batchfile ($file) {
|
||||
$cmd = "`"$file`" & set"
|
||||
cmd /c $cmd | Foreach-Object {
|
||||
$p, $v = $_.split('=')
|
||||
Set-Item -path env:$p -value $v
|
||||
}
|
||||
}
|
||||
|
||||
# Helper function to provide the bin-folder path to mingw
|
||||
function Get-MinGWBin() {
|
||||
if ($env:Platform -like '*64') {
|
||||
Write-Output 'C:\Tools\mingw64\bin'
|
||||
}
|
||||
else {
|
||||
Write-Output 'C:\Tools\mingw32\bin'
|
||||
}
|
||||
}
|
||||
|
||||
# Helper function to provide the toolchain file for clang
|
||||
function Get-ClangToolchainFilename() {
|
||||
if ($env:Platform -like '*64') {
|
||||
Write-Output 'clang+mingw-win64.toolchain.cmake'
|
||||
}
|
||||
else {
|
||||
Write-Output 'clang+mingw-win32.toolchain.cmake'
|
||||
}
|
||||
}
|
||||
|
||||
# Helper function to provide the bin-folder path to cygwin
|
||||
function Get-CygwinBin() {
|
||||
if ($env:Platform -like '*64') {
|
||||
Write-Output 'C:\cygwin64\bin'
|
||||
}
|
||||
else {
|
||||
Write-Output 'C:\cygwin\bin'
|
||||
}
|
||||
}
|
||||
|
||||
function Add-PathFolder($folder)
|
||||
{
|
||||
if (-not (Test-Path $folder))
|
||||
{
|
||||
Write-Host "Not adding $folder to the PATH, it does not exist"
|
||||
}
|
||||
|
||||
[bool]$alreadyInPath = $false
|
||||
[System.Collections.ArrayList]$pathFolders = New-Object System.Collections.ArrayList
|
||||
$env:Path -split ";" | foreach { $pathFolders.Add($_) | Out-Null }
|
||||
|
||||
for ([int]$i = 0; $i -lt $pathFolders.Count; $i++)
|
||||
{
|
||||
if ([string]::Compare($pathFolders[$i], $folder, $true) -eq 0)
|
||||
{
|
||||
$alreadyInPath = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $alreadyInPath)
|
||||
{
|
||||
Write-Host "Adding $folder to the PATH"
|
||||
$pathFolders.Insert(0, $folder)
|
||||
$env:Path = $pathFolders -join ";"
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-PathFolder($folder)
|
||||
{
|
||||
[System.Collections.ArrayList]$pathFolders = New-Object System.Collections.ArrayList
|
||||
$env:Path -split ";" | foreach { $pathFolders.Add($_) | Out-Null }
|
||||
|
||||
for ([int]$i = 0; $i -lt $pathFolders.Count; $i++)
|
||||
{
|
||||
if ([string]::Compare($pathFolders[$i], $folder, $true) -eq 0)
|
||||
{
|
||||
Write-Host "Removing $folder from the PATH"
|
||||
$pathFolders.RemoveAt($i)
|
||||
$i--
|
||||
}
|
||||
}
|
||||
|
||||
$env:Path = $pathFolders -join ";"
|
||||
}
|
||||
|
||||
function Set-Path($newPath)
|
||||
{
|
||||
$env:RestorePath = $env:Path
|
||||
$env:Path = $newPath
|
||||
}
|
||||
|
||||
function Restore-Path()
|
||||
{
|
||||
$env:Path = $env:RestorePath
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
checkForCppUTestEnvVariable() {
|
||||
if [ -z "$CPPUTEST_HOME" ] ; then
|
||||
echo "CPPUTEST_HOME not set"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$CPPUTEST_HOME" ] ; then
|
||||
echo "CPPUTEST_HOME not set to a directory"
|
||||
exit 2
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
Convert CppUTest files to Unity test files
|
||||
------------------------------------------
|
||||
|
||||
To convert a CppUTest test file to Unity, enter a command like this
|
||||
|
||||
CONVERT=$CPPUTEST_HOME/scripts/convertToUnity/cpp_u_test_to_unity.rb
|
||||
|
||||
ruby $CONVERT tests/some/dir/or/dirs/MyThink.cpp
|
||||
|
||||
This will create two files like this
|
||||
|
||||
unity/some/dir/or/dirs/MyThing.c
|
||||
unity/some/dir/or/dirs/MyThing_runner.c
|
||||
|
||||
Things that need to be done manually once to your
|
||||
unity test environment:
|
||||
|
||||
Create directory 'unity/some/dir/or/dirs'
|
||||
Adjust unity makefile to refer to the needed files
|
||||
Unity main needs to call RUN_TEST_GROUP(MyThing)
|
||||
|
||||
Things not supported in converted test cases:
|
||||
CppUMock
|
||||
Hand built mocks that use CppUTest macros.
|
||||
Formatting conventions can cause the script to fail
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env ruby
|
||||
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
|
||||
include CppUTestToUnityUtils
|
||||
|
||||
in_file = ARGV[0]
|
||||
unity_filename = convert_test_filename_to_unity_filename(in_file)
|
||||
unity_runner_filename = convert_test_filename_to_unity_testrunner_filename(in_file)
|
||||
puts "Converting :" + in_file + "\n"
|
||||
puts " To :" + unity_filename + "\n"
|
||||
|
||||
test_lines = File.open(in_file).readlines
|
||||
out_unity_file = File.open(unity_filename, 'w')
|
||||
out_unity_runner_file = File.open(unity_runner_filename, 'w')
|
||||
|
||||
test_groups = get_test_groups(test_lines)
|
||||
adjust_tabs(test_lines)
|
||||
remove_extern_c(test_lines)
|
||||
demote_group(/TEST_GROUP/, test_lines)
|
||||
convert_macros(test_lines, test_groups)
|
||||
group_runners = generate_group_runners(test_groups, test_lines)
|
||||
write_lines_to_file(out_unity_file, test_lines)
|
||||
write_lines_to_file(out_unity_runner_file, group_runners)
|
||||
out_unity_file.close()
|
||||
out_unity_runner_file.close()
|
|
@ -0,0 +1,247 @@
|
|||
module CppUTestToUnityUtils
|
||||
|
||||
def convert_test_filename_to_unity_filename(testpath)
|
||||
testpath.sub(/tests\/(.*)\.cpp/, "unity/\\1.c")
|
||||
end
|
||||
|
||||
def convert_test_filename_to_unity_testrunner_filename(testpath)
|
||||
testpath.sub(/tests\/(.*)\.cpp/, "unity/\\1_runner.c")
|
||||
end
|
||||
|
||||
def convert_one_liners(line, group)
|
||||
line.sub!(/#include "CppUTest\/TestHarness.h\"/, "#include \"unity_fixture.h\"" )
|
||||
line.sub!(/FAIL\(/, 'TEST_FAIL(')
|
||||
line.sub!(/CHECK\(/, "TEST_ASSERT_TRUE(")
|
||||
line.sub!(/CHECK_TRUE\(/, "TEST_ASSERT_TRUE(")
|
||||
line.sub!(/CHECK_FALSE\(/, "TEST_ASSERT_FALSE(")
|
||||
line.sub!(/LONGS_EQUAL\(/, "TEST_ASSERT_EQUAL(")
|
||||
line.sub!(/BYTES_EQUAL\(/, "TEST_ASSERT_EQUAL_HEX8(")
|
||||
line.sub!(/STRCMP_EQUAL\(/, "TEST_ASSERT_EQUAL_STRING(")
|
||||
line.sub!(/DOUBLES_EQUAL\(/, "TEST_ASSERT_FLOAT_WITHIN(")
|
||||
line.sub!(/ POINTERS_EQUAL\(/, " TEST_ASSERT_POINTERS_EQUAL(")
|
||||
line.sub!(/CHECK_EQUAL\(true,/, "TEST_ASSERT_TRUE(")
|
||||
line.sub!(/CHECK_EQUAL\(false,/, "TEST_ASSERT_FALSE(")
|
||||
line.sub!(/CHECK_EQUAL\(/, "TEST_ASSERT_EQUAL(")
|
||||
#line.sub!(/static void setup\(/, "TEST_SETUP(" + group)
|
||||
#line.sub!(/static void teardown\(/, "TEST_TEAR_DOWN(" + group)
|
||||
end
|
||||
|
||||
def convert_setup(lines, group)
|
||||
lines.each do | line |
|
||||
if line.sub!(/static void setup\(/, "TEST_SETUP(" + group)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def convert_teardown(lines, group)
|
||||
lines.each do | line |
|
||||
if line.sub!(/static void teardown\(/, "TEST_TEAR_DOWN(" + group)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def convert_macros(lines, groups)
|
||||
groups.each do | group |
|
||||
lines.each do | line |
|
||||
convert_one_liners(line, group)
|
||||
end
|
||||
convert_setup(lines, group)
|
||||
convert_teardown(lines, group)
|
||||
end
|
||||
end
|
||||
|
||||
def get_test_group(lines)
|
||||
@test_group = "None"
|
||||
lines.each do | line |
|
||||
if /TEST_GROUP/ =~ line
|
||||
@test_group = line.split(/[()]/)[1]
|
||||
end
|
||||
end
|
||||
@test_group
|
||||
end
|
||||
|
||||
def get_test_groups(lines)
|
||||
@test_groups = []
|
||||
i = 0
|
||||
lines.each do | line |
|
||||
if /TEST_GROUP/ =~ line
|
||||
@test_groups[i] = line.split(/[()]/)[1]
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
@test_groups
|
||||
end
|
||||
|
||||
def adjust_tabs(lines)
|
||||
lines.each do | line |
|
||||
|
||||
line.gsub!(/^ {2,3}(\w+)/, " \\1")
|
||||
line.gsub!(/\t/, " ")
|
||||
end
|
||||
end
|
||||
|
||||
def include_line?(line)
|
||||
/\#include/ =~ line
|
||||
end
|
||||
|
||||
def convert_member_to_static(line)
|
||||
line.gsub!(/^\s*(\w)/, "static \\1")
|
||||
end
|
||||
|
||||
def add_semicolon_to_end_of_test_group_line(line)
|
||||
line.gsub!(/\)/, ");")
|
||||
end
|
||||
|
||||
def consume_closing_curley_brace(line)
|
||||
line.gsub!(/\}\;*[ \t]*(.*)/, "\\1")
|
||||
end
|
||||
|
||||
def outdent(line)
|
||||
line.gsub!(/^ /, "")
|
||||
end
|
||||
|
||||
def consume_opening_curley_brace(line)
|
||||
line.gsub!(/\{/, "")
|
||||
end
|
||||
|
||||
def demote_group(group, lines)
|
||||
test_group = "None"
|
||||
scope_level = 0
|
||||
in_test_group = false
|
||||
lines.each do | line |
|
||||
next if include_line?(line)
|
||||
|
||||
if !in_test_group
|
||||
if line.match(group)
|
||||
add_semicolon_to_end_of_test_group_line(line)
|
||||
in_test_group = true
|
||||
end
|
||||
next
|
||||
end
|
||||
|
||||
if line.include?("}")
|
||||
scope_level -= 1
|
||||
elsif line.include?("{")
|
||||
scope_level += 1
|
||||
end
|
||||
|
||||
outdent(line)
|
||||
|
||||
if scope_level == 1
|
||||
convert_member_to_static(line)
|
||||
consume_opening_curley_brace(line)
|
||||
end
|
||||
if scope_level == 0
|
||||
consume_closing_curley_brace(line)
|
||||
in_test_group = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def search_and_destroy(pattern, lines)
|
||||
lines.each do | line |
|
||||
line.gsub!(pattern, "")
|
||||
end
|
||||
end
|
||||
|
||||
def extern_c_line?(line)
|
||||
line.match(/extern \"C\"/)
|
||||
end
|
||||
|
||||
def remove_extern_c(lines)
|
||||
in_extern_c = false;
|
||||
scope_level = 0
|
||||
|
||||
lines.each do | line |
|
||||
if !in_extern_c
|
||||
if extern_c_line?(line)
|
||||
in_extern_c = true
|
||||
line.gsub!(/extern \"C\"/, "")
|
||||
end
|
||||
next
|
||||
end
|
||||
|
||||
# next if ! in_extern_c and ! extern_c_line?(line)
|
||||
#
|
||||
# in_extern_c = true
|
||||
if line.include?("{")
|
||||
scope_level += 1
|
||||
elsif line.include?("}")
|
||||
scope_level -= 1
|
||||
end
|
||||
|
||||
if scope_level == 1
|
||||
consume_opening_curley_brace(line)
|
||||
end
|
||||
|
||||
if scope_level == 0 and line.include?("}")
|
||||
in_extern_c = false
|
||||
consume_closing_curley_brace(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_declaration?(line, group)
|
||||
/TEST\(#{group}/ =~ line
|
||||
end
|
||||
|
||||
def generate_group_runner(group, lines)
|
||||
group_runner = []
|
||||
group_runner << "/* Make sure you invoke RUN_TEST_GROUP(" + group + ") from unity main */\n\n"
|
||||
group_runner << "TEST_GROUP_RUNNER(" + group + ")\n"
|
||||
group_runner << "{\n"
|
||||
lines.each do | line |
|
||||
if test_declaration?(line, group)
|
||||
temp = line.clone
|
||||
temp.sub!(/\n/, "")
|
||||
temp.sub!(/^IGNORE_/, "")
|
||||
temp.sub!(/^TEST/, " RUN_TEST_CASE")
|
||||
group_runner << temp + ";\n"
|
||||
end
|
||||
end
|
||||
group_runner << "}\n\n"
|
||||
end
|
||||
|
||||
def generate_group_runners(groups, lines)
|
||||
group_runners = []
|
||||
group_runners << "/* Generated code, edit at your own risk */\n\n"
|
||||
group_runners << "#include \"unity_fixture.h\"\n\n"
|
||||
groups.each do | group |
|
||||
group_runners.concat generate_group_runner(group, lines)
|
||||
end
|
||||
group_runners
|
||||
end
|
||||
|
||||
def generate_group_runner_plainUnity(group, lines)
|
||||
prototypes = []
|
||||
callers = []
|
||||
group_runner = []
|
||||
lines.each do | line |
|
||||
if /void test.*\(.*\)/ =~ line
|
||||
temp = line.clone
|
||||
temp.sub!(/\n/, "")
|
||||
prototypes << temp + ";"
|
||||
temp.sub!(/void /, " ")
|
||||
temp.sub!(/\(void\)/, "()")
|
||||
callers << temp
|
||||
end
|
||||
end
|
||||
group_runner << "\n"
|
||||
group_runner << "//Generated code, edit at your own risk\n\n"
|
||||
group_runner << "\#include \"unity_fixture.h\"\n\n"
|
||||
group_runner << prototypes
|
||||
group_runner << "\n\nTEST_GROUP_RUNNER(" + group + ")\n"
|
||||
group_runner << "{\n"
|
||||
group_runner << callers
|
||||
group_runner << "}\n"
|
||||
end
|
||||
|
||||
def write_lines_to_file(file, lines)
|
||||
lines.each do | line |
|
||||
file.write(line)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,506 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
|
||||
include CppUTestToUnityUtils
|
||||
|
||||
test_lines = Array.new
|
||||
expected_lines = Array.new
|
||||
|
||||
|
||||
def check(theTest, expected, actual)
|
||||
unless (expected == actual)
|
||||
puts theTest + " failed"
|
||||
puts "Actual:\n"
|
||||
show(actual)
|
||||
puts "unmatched lines"
|
||||
show(expected - actual)
|
||||
puts("Expected: " + expected.inspect)
|
||||
puts(" Actual: " + actual.inspect)
|
||||
end
|
||||
end
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
"\n",
|
||||
"TEST_GROUP(mygroup)\n",
|
||||
"{\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"TEST_GROUP(yourgroup)\n",
|
||||
"{\n",
|
||||
"}\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
|
||||
groups = get_test_groups(test_lines)
|
||||
unless /mygroup/ =~ groups[0]
|
||||
puts "Expected mygroup, but got #{groups[0]}"
|
||||
end
|
||||
|
||||
unless /yourgroup/ =~ groups[1]
|
||||
puts "Expected yourgroup, but got #{groups[1]}"
|
||||
end
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
["\n",
|
||||
"TEST_GROUP(mygroup)\n",
|
||||
"{\n",
|
||||
" int xxxx;\n",
|
||||
" void yyyy()\n",
|
||||
" {\n",
|
||||
" int i = 0;\n",
|
||||
" }\n",
|
||||
"};\n",
|
||||
"\n",
|
||||
" void f()\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
["\n",
|
||||
"TEST_GROUP(mygroup);\n",
|
||||
"\n",
|
||||
"static int xxxx;\n",
|
||||
"static void yyyy()\n",
|
||||
"{\n",
|
||||
" int i = 0;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" void f()\n"
|
||||
]
|
||||
|
||||
def show(lines)
|
||||
lines.each do | line |
|
||||
puts line
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
demote_group(/TEST_GROUP/, test_lines)
|
||||
check("demote_group", expected_lines, test_lines)
|
||||
#---------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
"\n",
|
||||
"TEST_GROUP(mygroup)\n",
|
||||
"{\n",
|
||||
"}\n",
|
||||
";\n",
|
||||
"\n",
|
||||
"TEST_GROUP(yourgroup)\n",
|
||||
"{\n",
|
||||
"}\n",
|
||||
";\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
[
|
||||
"\n",
|
||||
"TEST_GROUP(mygroup);\n",
|
||||
"\n",
|
||||
"\n",
|
||||
";\n",
|
||||
"\n",
|
||||
"TEST_GROUP(yourgroup);\n",
|
||||
"\n",
|
||||
"\n",
|
||||
";\n"
|
||||
]
|
||||
|
||||
demote_group(/TEST_GROUP/, test_lines)
|
||||
check("demote_group", expected_lines, test_lines)
|
||||
|
||||
#---------------------------------
|
||||
|
||||
test_lines =
|
||||
["\n",
|
||||
"TEST_GROUP(mygroup)\n",
|
||||
"{\n",
|
||||
" int xxxx;\n",
|
||||
" void yyyy()\n",
|
||||
" {\n",
|
||||
" int i = 0;\n",
|
||||
" }\n",
|
||||
"}; //End TEST_GROUP\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
["\n",
|
||||
"TEST_GROUP(mygroup);\n",
|
||||
"\n",
|
||||
"static int xxxx;\n",
|
||||
"static void yyyy()\n",
|
||||
"{\n",
|
||||
" int i = 0;\n",
|
||||
"}\n",
|
||||
"//End TEST_GROUP\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
demote_group(/TEST_GROUP/, test_lines)
|
||||
check("demote_group", expected_lines, test_lines)
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
["\n",
|
||||
"extern \"C\"\n",
|
||||
"{\n",
|
||||
"\#include \"heythere.h\"\n",
|
||||
"int xxxx;\n",
|
||||
"void yyyy()\n",
|
||||
"{\n",
|
||||
" int i = 0;\n",
|
||||
"}\n",
|
||||
"}\n",
|
||||
"int foo()\n",
|
||||
"{\n",
|
||||
" int aaaa;\n",
|
||||
"}\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
["\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\#include \"heythere.h\"\n",
|
||||
"int xxxx;\n",
|
||||
"void yyyy()\n",
|
||||
"{\n",
|
||||
" int i = 0;\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"int foo()\n",
|
||||
"{\n",
|
||||
" int aaaa;\n",
|
||||
"}\n"
|
||||
]
|
||||
|
||||
remove_extern_c(test_lines)
|
||||
check("remove_extern_c", expected_lines, test_lines)
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
["\n",
|
||||
"extern \"C\"\n",
|
||||
"{\n",
|
||||
"#include \"LightScheduler.h\"\n",
|
||||
"#include \"FakeLightController.h\"\n",
|
||||
"#include \"FakeTimeService.h\"\n",
|
||||
"#include \"FakeRandomMinute.h\"\n",
|
||||
"}\n",
|
||||
"#include \"CppUTest/TestHarness.h\"\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
["\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"#include \"LightScheduler.h\"\n",
|
||||
"#include \"FakeLightController.h\"\n",
|
||||
"#include \"FakeTimeService.h\"\n",
|
||||
"#include \"FakeRandomMinute.h\"\n",
|
||||
"\n",
|
||||
"#include \"CppUTest/TestHarness.h\"\n"
|
||||
]
|
||||
|
||||
remove_extern_c(test_lines)
|
||||
check("remove_extern_c", expected_lines, test_lines)
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
"\n",
|
||||
"#include \"unity_fixture.h\" expected\n",
|
||||
"#include \"CppUTest\/TestHarness.h\"\n",
|
||||
"\n",
|
||||
"TEST_SETUP(theGroup) expected\n",
|
||||
"static void setup()\n",
|
||||
"{\n",
|
||||
" x = 1;\n",
|
||||
"}\n",
|
||||
"TEST_TEAR_DOWN(theGroup) expected\n",
|
||||
"static void teardown()\n",
|
||||
"{\n",
|
||||
" y = 0;\n",
|
||||
"}\n",
|
||||
"TEST(LedDriver, Create)\n",
|
||||
"{\n",
|
||||
" FAIL(\"Start here\");\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"IGNORE_TEST(LedDriver, ignore)\n",
|
||||
"{\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0); expected\n",
|
||||
" CHECK(0 == 0);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0); expected\n",
|
||||
" CHECK_TRUE(0 == 0);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_FALSE(0 != 0); expected\n",
|
||||
" CHECK_FALSE(0 != 0);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL(1,1); expected\n",
|
||||
" LONGS_EQUAL(1,1);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL_HEX8(0xab,0xab); expected\n",
|
||||
" BYTES_EQUAL(0xab,0xab);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL(100,100); expected\n",
|
||||
" CHECK_EQUAL(100,100);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_TRUE(true); expected\n",
|
||||
" CHECK_EQUAL(true,true);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_FALSE(false); expected\n",
|
||||
" CHECK_EQUAL(false,false);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL_STRING(\"THIS\", \"THIS\"); expected\n",
|
||||
" STRCMP_EQUAL(\"THIS\", \"THIS\");\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_FLOAT_WITHIN(1.0, 1.0, .01); expected\n",
|
||||
" DOUBLES_EQUAL(1.0, 1.0, .01);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_POINTERS_EQUAL(this, this); expected\n",
|
||||
" POINTERS_EQUAL(this, this);\n",
|
||||
"}\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
[
|
||||
"\n",
|
||||
"#include \"unity_fixture.h\" expected\n",
|
||||
"#include \"unity_fixture.h\"\n",
|
||||
"\n",
|
||||
"TEST_SETUP(theGroup) expected\n",
|
||||
"TEST_SETUP(theGroup)\n",
|
||||
"{\n",
|
||||
" x = 1;\n",
|
||||
"}\n",
|
||||
"TEST_TEAR_DOWN(theGroup) expected\n",
|
||||
"TEST_TEAR_DOWN(theGroup)\n",
|
||||
"{\n",
|
||||
" y = 0;\n",
|
||||
"}\n",
|
||||
"TEST(LedDriver, Create)\n",
|
||||
"{\n",
|
||||
" TEST_FAIL(\"Start here\");\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"IGNORE_TEST(LedDriver, ignore)\n",
|
||||
"{\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0); expected\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0); expected\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_FALSE(0 != 0); expected\n",
|
||||
" TEST_ASSERT_FALSE(0 != 0);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL(1,1); expected\n",
|
||||
" TEST_ASSERT_EQUAL(1,1);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL_HEX8(0xab,0xab); expected\n",
|
||||
" TEST_ASSERT_EQUAL_HEX8(0xab,0xab);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL(100,100); expected\n",
|
||||
" TEST_ASSERT_EQUAL(100,100);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_TRUE(true); expected\n",
|
||||
" TEST_ASSERT_TRUE(true);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_FALSE(false); expected\n",
|
||||
" TEST_ASSERT_FALSE(false);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_EQUAL_STRING(\"THIS\", \"THIS\"); expected\n",
|
||||
" TEST_ASSERT_EQUAL_STRING(\"THIS\", \"THIS\");\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_FLOAT_WITHIN(1.0, 1.0, .01); expected\n",
|
||||
" TEST_ASSERT_FLOAT_WITHIN(1.0, 1.0, .01);\n",
|
||||
"\n",
|
||||
" TEST_ASSERT_POINTERS_EQUAL(this, this); expected\n",
|
||||
" TEST_ASSERT_POINTERS_EQUAL(this, this);\n",
|
||||
"}\n"
|
||||
]
|
||||
|
||||
convert_macros(test_lines, ["theGroup"])
|
||||
check("convert_macros", expected_lines, test_lines)
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
"TEST_SETUP(group1) expected\n",
|
||||
"static void setup()\n",
|
||||
"TEST_TEAR_DOWN(group1) expected\n",
|
||||
"static void teardown()\n",
|
||||
"TEST(group1, Create)\n",
|
||||
"IGNORE_TEST(group1, ignore)\n",
|
||||
"TEST_SETUP(group2) expected\n",
|
||||
"static void setup()\n",
|
||||
"TEST_TEAR_DOWN(group2) expected\n",
|
||||
"static void teardown()\n",
|
||||
"TEST(group2, Create)\n",
|
||||
"IGNORE_TEST(group2, ignore)\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
[
|
||||
"TEST_SETUP(group1) expected\n",
|
||||
"TEST_SETUP(group1)\n",
|
||||
"TEST_TEAR_DOWN(group1) expected\n",
|
||||
"TEST_TEAR_DOWN(group1)\n",
|
||||
"TEST(group1, Create)\n",
|
||||
"IGNORE_TEST(group1, ignore)\n",
|
||||
"TEST_SETUP(group2) expected\n",
|
||||
"TEST_SETUP(group2)\n",
|
||||
"TEST_TEAR_DOWN(group2) expected\n",
|
||||
"TEST_TEAR_DOWN(group2)\n",
|
||||
"TEST(group2, Create)\n",
|
||||
"IGNORE_TEST(group2, ignore)\n",
|
||||
]
|
||||
|
||||
convert_macros(test_lines, ["group1", "group2"])
|
||||
check("convert_macros", expected_lines, test_lines)
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
" aaaa expected\n",
|
||||
"\taaa\n",
|
||||
" bbbb expected\n",
|
||||
"\t\t\t\tbbbb\n",
|
||||
" int a3; expected\n",
|
||||
" int a3;\n",
|
||||
" int a4; expected\n",
|
||||
" int a4;\n"
|
||||
]
|
||||
|
||||
expected_lines =
|
||||
[
|
||||
" aaaa expected\n",
|
||||
" aaa\n",
|
||||
" bbbb expected\n",
|
||||
" bbbb\n",
|
||||
" int a3; expected\n",
|
||||
" int a3;\n",
|
||||
" int a4; expected\n",
|
||||
" int a4;\n"
|
||||
]
|
||||
|
||||
adjust_tabs(test_lines)
|
||||
check("adjust_tabs", expected_lines, test_lines)
|
||||
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
"TEST(LedDriver, Create)\n",
|
||||
"{\n",
|
||||
" FAIL(\"Start here\");\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"TEST(LedDriver, XXXXX)\n",
|
||||
"{\n",
|
||||
" FAIL(\"Start here\");\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"IGNORE_TEST(LedDriver, ignore)\n",
|
||||
"{\n",
|
||||
" TEST_ASSERT_TRUE(0 == 0); expected\n",
|
||||
"}\n"
|
||||
]
|
||||
|
||||
expected_group_runner =
|
||||
[
|
||||
"/* Make sure you invoke RUN_TEST_GROUP(LedDriver) from unity main */\n\n",
|
||||
"TEST_GROUP_RUNNER(LedDriver)\n",
|
||||
"{\n",
|
||||
" RUN_TEST_CASE(LedDriver, Create);\n",
|
||||
" RUN_TEST_CASE(LedDriver, XXXXX);\n",
|
||||
" RUN_TEST_CASE(LedDriver, ignore);\n",
|
||||
"}\n\n"
|
||||
]
|
||||
|
||||
group_runner = generate_group_runner("LedDriver", test_lines)
|
||||
check("generate_group_runner", expected_group_runner, group_runner)
|
||||
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_lines =
|
||||
[
|
||||
"TEST(LedDriverGroup1, Create)\n",
|
||||
"{\n",
|
||||
" FAIL(\"Start here\");\n",
|
||||
"}\n",
|
||||
"\n",
|
||||
"TEST(LedDriverGroup2, XXXXX)\n",
|
||||
"{\n",
|
||||
" FAIL(\"Start here\");\n",
|
||||
"}\n",
|
||||
"\n"
|
||||
]
|
||||
|
||||
expected_group_runners =
|
||||
[
|
||||
"/* Generated code, edit at your own risk */\n\n",
|
||||
"#include \"unity_fixture.h\"\n\n",
|
||||
"/* Make sure you invoke RUN_TEST_GROUP(LedDriverGroup1) from unity main */\n\n",
|
||||
"TEST_GROUP_RUNNER(LedDriverGroup1)\n",
|
||||
"{\n",
|
||||
" RUN_TEST_CASE(LedDriverGroup1, Create);\n",
|
||||
"}\n\n",
|
||||
"/* Make sure you invoke RUN_TEST_GROUP(LedDriverGroup2) from unity main */\n\n",
|
||||
"TEST_GROUP_RUNNER(LedDriverGroup2)\n",
|
||||
"{\n",
|
||||
" RUN_TEST_CASE(LedDriverGroup2, XXXXX);\n",
|
||||
"}\n\n"
|
||||
]
|
||||
|
||||
runners = generate_group_runners(["LedDriverGroup1", "LedDriverGroup2"], test_lines)
|
||||
check("generate_group_runners", expected_group_runners, runners)
|
||||
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_filename = "prefix/tests/pooltable/EightballTest.cpp"
|
||||
expected_unity_filename = "prefix/unity/pooltable/EightballTest.c"
|
||||
|
||||
unity_filename = convert_test_filename_to_unity_filename(test_filename)
|
||||
|
||||
if expected_unity_filename != unity_filename
|
||||
puts("Failure in: convert_test_path_to_unity_path")
|
||||
puts("Expected: " + expected_unity_filename.inspect)
|
||||
puts(" Actual: " + unity_filename.inspect)
|
||||
end
|
||||
|
||||
#---------------------------------------------------
|
||||
|
||||
test_filename = "tests/pool/table/EightballTest.cpp"
|
||||
expected_unity_runner_filename = "unity/pool/table/EightballTest_runner.c"
|
||||
|
||||
unity_runner_filename = convert_test_filename_to_unity_testrunner_filename(test_filename)
|
||||
|
||||
if expected_unity_runner_filename != unity_runner_filename
|
||||
puts("Failure in: convert_test_path_to_unity_path")
|
||||
puts("Expected: " + expected_unity_runner_filename.inspect)
|
||||
puts(" Actual: " + unity_runner_filename.inspect)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
|
||||
include CppUTestToUnityUtils
|
||||
|
||||
in_file = ARGV[0]
|
||||
create_group_runner_file(in_file)
|
||||
unity_runner_filename = convert_test_filename_to_unity_testrunner_filename(in_file)
|
||||
puts "Creating test runner for :" + in_file + "\n"
|
||||
puts " Generating :" + unity_filename + "\n"
|
||||
|
||||
test_lines = File.open(in_file).readlines
|
||||
out_unity_runner_file = File.open(unity_runner_filename, 'w')
|
||||
|
||||
test_group = get_test_group(test_lines)
|
||||
group_runner = generate_group_runner(test_group, test_lines)
|
||||
write_lines_to_file(out_unity_runner_file, group_runner)
|
||||
out_unity_runner_file.close()
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'cpp_u_test_to_unity_utils.rb')
|
||||
include CppUTestToUnityUtils
|
||||
|
||||
in_file = ARGV[0]
|
||||
test_lines = File.open(in_file).collect
|
||||
out_file = File.open(File.basename(in_file, ".c") + "_runner.c", 'w')
|
||||
|
||||
group_runner = generate_group_runner_plainUnity("unity", test_lines)
|
||||
write_lines_to_file(out_file, group_runner)
|
||||
out_file.close()
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
#$1 is the container name
|
||||
|
||||
checkForCppUTestToolsEnvVariable() {
|
||||
if [ -z "$CPPUTEST_HOME" ] ; then
|
||||
echo "CPPUTEST_HOME not set. You must set CPPUTEST_HOME to the top level CppUTest directory"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$CPPUTEST_HOME" ] ; then
|
||||
echo "CPPUTEST_HOME not set to a directory. You must set CPPUTEST_HOME to the top level CppUTest directory"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
checkForImageNameParameter() {
|
||||
if [ -z "$container" ] ; then
|
||||
echo "Container name parameter not set. Check the docker directory. It should be the extension of the Dockerfile. e.g. ubuntu"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$CPPUTEST_HOME/docker/Dockerfile.$container" ] ; then
|
||||
echo "The Dockerfile docker/Dockerfile.$container doesn't exist. Typo?"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
container=$1
|
||||
checkForCppUTestToolsEnvVariable
|
||||
checkForImageNameParameter
|
||||
|
||||
docker build -f $CPPUTEST_HOME/docker/Dockerfile.$container --tag cpputest/$container:latest .
|
||||
docker container rm cpputest_$container
|
||||
docker create -it -v$CPPUTEST_HOME:/cpputest -e "CPPUTEST_HOME=/cpputest" --name cpputest_$container cpputest/$container:latest
|
||||
|
||||
echo "You can run your container through: docker start -i cpputest_<container>. E.g. docker start -i cpputest_$container"
|
||||
|
||||
|
63
platforms/platform-test-f4-ll/cpputest/scripts/filterGcov.sh
Executable file
63
platforms/platform-test-f4-ll/cpputest/scripts/filterGcov.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
INPUT_FILE=$1
|
||||
TEMP_FILE1=${INPUT_FILE}1.tmp
|
||||
TEMP_FILE2=${INPUT_FILE}2.tmp
|
||||
TEMP_FILE3=${INPUT_FILE}3.tmp
|
||||
ERROR_FILE=$2
|
||||
OUTPUT_FILE=$3
|
||||
HTML_OUTPUT_FILE=$3.html
|
||||
TEST_RESULTS=$4
|
||||
|
||||
flattenGcovOutput() {
|
||||
while read line1
|
||||
do
|
||||
read line2
|
||||
echo $line2 " " $line1
|
||||
read junk
|
||||
read junk
|
||||
done < ${INPUT_FILE}
|
||||
}
|
||||
|
||||
getRidOfCruft() {
|
||||
sed '-e s/^Lines.*://g' \
|
||||
'-e s/^[0-9]\./ &/g' \
|
||||
'-e s/^[0-9][0-9]\./ &/g' \
|
||||
'-e s/of.\w[^'File']*File/ /g' \
|
||||
"-e s/'//g" \
|
||||
'-e s/^.*\/usr\/.*$//g' \
|
||||
'-e s/^.*\.$//g'
|
||||
}
|
||||
|
||||
flattenPaths() {
|
||||
sed \
|
||||
-e 's/\/[^/][^/]*\/[^/][^/]*\/\.\.\/\.\.\//\//g' \
|
||||
-e 's/\/[^/][^/]*\/[^/][^/]*\/\.\.\/\.\.\//\//g' \
|
||||
-e 's/\/[^/][^/]*\/[^/][^/]*\/\.\.\/\.\.\//\//g' \
|
||||
-e 's/\/[^/][^/]*\/\.\.\//\//g'
|
||||
}
|
||||
|
||||
getFileNameRootFromErrorFile() {
|
||||
sed '-e s/gc..:cannot open .* file//g' ${ERROR_FILE}
|
||||
}
|
||||
|
||||
writeEachNoTestCoverageFile() {
|
||||
while read line
|
||||
do
|
||||
echo " 0.00% " ${line}
|
||||
done
|
||||
}
|
||||
|
||||
createHtmlOutput() {
|
||||
echo "<table border="2" cellspacing="5" cellpadding="5">"
|
||||
echo "<tr><th>Coverage</th><th>File</th></tr>"
|
||||
sed "-e s/.*% /<tr><td>&<\/td><td>/" \
|
||||
"-e s/[a-zA-Z0-9_]*\.[ch][a-z]*/<a href='file:\.\/&.gcov'>&<\/a><\/td><\/tr>/"
|
||||
echo "</table>"
|
||||
sed "-e s/.*/&<br>/g" < ${TEST_RESULTS}
|
||||
}
|
||||
|
||||
flattenGcovOutput | getRidOfCruft | flattenPaths > ${TEMP_FILE1}
|
||||
getFileNameRootFromErrorFile | writeEachNoTestCoverageFile | flattenPaths > ${TEMP_FILE2}
|
||||
cat ${TEMP_FILE1} ${TEMP_FILE2} | sort | uniq > ${OUTPUT_FILE}
|
||||
createHtmlOutput < ${OUTPUT_FILE} > ${HTML_OUTPUT_FILE}
|
||||
rm -f ${TEMP_FILE1} ${TEMP_FILE2}
|
|
@ -0,0 +1,8 @@
|
|||
<project>
|
||||
<junitreport>
|
||||
<fileset dir=".">
|
||||
<include name="cpputest*.xml"/>
|
||||
</fileset>
|
||||
<report todir="./unit_test_report"/>
|
||||
</junitreport>
|
||||
</project>
|
10
platforms/platform-test-f4-ll/cpputest/scripts/reformat.sh
Executable file
10
platforms/platform-test-f4-ll/cpputest/scripts/reformat.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
ASTYLE_OPTIONS="--convert-tabs --indent=spaces=4 --indent-classes --indent-switches --indent-preprocessor --style=ansi"
|
||||
|
||||
find $1 -name "*.h" -o -name "*.c" -o -name "*.cpp" |
|
||||
while read filename; do
|
||||
tmpfile=${filename}.astyle.cpp
|
||||
astyle ${ASTYLE_OPTIONS} <"${filename}" > "${tmpfile}"
|
||||
mv "${tmpfile}" "${filename}"
|
||||
done
|
2
platforms/platform-test-f4-ll/cpputest/scripts/squeeze.sh
Executable file
2
platforms/platform-test-f4-ll/cpputest/scripts/squeeze.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sed -f
|
||||
s/[ ][ ]*/ /g
|
31
platforms/platform-test-f4-ll/cpputest/scripts/svnignore.txt
Normal file
31
platforms/platform-test-f4-ll/cpputest/scripts/svnignore.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
doxygen
|
||||
*.d
|
||||
*/Debug/*
|
||||
*.exe
|
||||
*.obj
|
||||
*.o
|
||||
*.a
|
||||
*.ncb
|
||||
*.opt
|
||||
*.plg
|
||||
*.idb
|
||||
*.pdb
|
||||
*.lib
|
||||
.settings
|
||||
*doxygen*
|
||||
*.gcov
|
||||
*.gcno
|
||||
*.gcda
|
||||
*_tests
|
||||
*_cslim
|
||||
*a.out
|
||||
*.zip
|
||||
tmp
|
||||
pdfs
|
||||
*.map
|
||||
gcov
|
||||
objs
|
||||
lib
|
||||
*_tests.txt
|
||||
gcov*.html
|
||||
Releases
|
|
@ -0,0 +1,10 @@
|
|||
#include "ClassName.h"
|
||||
|
||||
ClassName::ClassName()
|
||||
{
|
||||
}
|
||||
|
||||
ClassName::~ClassName()
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ClassName is responsible for ...
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ClassName
|
||||
{
|
||||
public:
|
||||
explicit ClassName();
|
||||
virtual ~ClassName();
|
||||
|
||||
private:
|
||||
|
||||
ClassName(const ClassName&);
|
||||
ClassName& operator=(const ClassName&);
|
||||
|
||||
};
|
||||
|
||||
#endif // D_ClassName_H
|
|
@ -0,0 +1,11 @@
|
|||
#include "ClassName.h"
|
||||
|
||||
void ClassName_Create(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassName_Destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
* ClassName is responsible for ...
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
void ClassName_Create(void);
|
||||
void ClassName_Destroy(void);
|
||||
|
||||
#endif /* D_FakeClassName_H */
|
|
@ -0,0 +1,12 @@
|
|||
#include "ClassName.h"
|
||||
#include "IO.h"
|
||||
|
||||
void ClassName_Create(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassName_Destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
* ClassName is responsible for ...
|
||||
*
|
||||
**********************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
void ClassName_Create(void);
|
||||
void ClassName_Destroy(void);
|
||||
|
||||
#endif /* D_FakeClassName_H */
|
|
@ -0,0 +1,27 @@
|
|||
extern "C" {
|
||||
#include "ClassName.h"
|
||||
#include "MockIO.h"
|
||||
}
|
||||
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
Reset_Mock_IO();
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
Assert_No_Unused_Expectations();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#include "ClassName.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
typedef struct ClassNameStruct
|
||||
{
|
||||
int placeHolderForHiddenStructElements;
|
||||
} ClassNameStruct;
|
||||
|
||||
ClassName ClassName_Create(void)
|
||||
{
|
||||
ClassName self = calloc(1, sizeof(ClassNameStruct));
|
||||
return self;
|
||||
}
|
||||
|
||||
void ClassName_Destroy(ClassName self)
|
||||
{
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* ClassName is responsible for ...
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
typedef struct ClassNameStruct * ClassName;
|
||||
|
||||
ClassName ClassName_Create(void);
|
||||
void ClassName_Destroy(ClassName);
|
||||
|
||||
#endif /* D_FakeClassName_H */
|
|
@ -0,0 +1,27 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
ClassName aClassName;
|
||||
|
||||
void setup()
|
||||
{
|
||||
aClassName = ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy(aClassName);
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#include "ClassName.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
typedef struct ClassName
|
||||
{
|
||||
int placeHolderForHiddenStructElements;
|
||||
};
|
||||
|
||||
ClassName* ClassName_Create(void)
|
||||
{
|
||||
ClassName* self = malloc(sizeof(ClassName));
|
||||
memset(self, 0, sizeof(ClassName));
|
||||
return self;
|
||||
}
|
||||
|
||||
void ClassName_Destroy(ClassName* self)
|
||||
{
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
* ClassName is responsible for ...
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
typedef struct ClassName ClassNamePiml;
|
||||
|
||||
ClassName* ClassName_Create(void);
|
||||
void ClassName_Destroy(ClassName*);
|
||||
void ClassName_VirtualFunction_impl(ClassName*);
|
||||
|
||||
#endif /* D_FakeClassName_H */
|
|
@ -0,0 +1,25 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#include "ClassName.h"
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
ClassName* aClassName;
|
||||
|
||||
void setup()
|
||||
{
|
||||
aClassName = new ClassName();
|
||||
}
|
||||
void teardown()
|
||||
{
|
||||
delete aClassName;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#include "ClassName.h"
|
||||
|
||||
void ClassName()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef D_ClassName_H
|
||||
#define D_ClassName_H
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
* ClassName is responsible for ...
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
void ClassName();
|
||||
|
||||
#endif /* D_FakeClassName_H */
|
|
@ -0,0 +1,23 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "ClassName.h"
|
||||
}
|
||||
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
extern "C"
|
||||
{
|
||||
#include "FakeClassName.h"
|
||||
}
|
||||
|
||||
//CppUTest includes should be after your and system includes
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
ClassName_Create();
|
||||
}
|
||||
|
||||
void teardown()
|
||||
{
|
||||
ClassName_Destroy();
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#include "ClassName.h"
|
||||
#include "MockClassName.h"
|
||||
|
||||
#include "CppUTest/TestHarness.h"
|
||||
|
||||
TEST_GROUP(ClassName)
|
||||
{
|
||||
ClassName* aClassName;
|
||||
MockClassName* mockClassName;
|
||||
|
||||
void setup()
|
||||
{
|
||||
mockClassName = new MockClassName();
|
||||
aClassName = mockClassName;
|
||||
}
|
||||
void teardown()
|
||||
{
|
||||
delete aClassName;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ClassName, Create)
|
||||
{
|
||||
FAIL("Start here");
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef D_MockClassName_H
|
||||
#define D_MockClassName_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// MockClassName.h
|
||||
//
|
||||
// MockClassName is responsible for providing a test stub for ClassName
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "ClassName.h"
|
||||
|
||||
|
||||
class MockClassName : public ClassName
|
||||
{
|
||||
public:
|
||||
explicit MockClassName()
|
||||
{}
|
||||
virtual ~MockClassName()
|
||||
{}
|
||||
|
||||
private:
|
||||
|
||||
MockClassName(const MockClassName&);
|
||||
MockClassName& operator=(const MockClassName&);
|
||||
|
||||
};
|
||||
|
||||
#endif // D_MockClassName_H
|
|
@ -0,0 +1,11 @@
|
|||
#include "ClassName.h"
|
||||
|
||||
void ClassName_Create(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ClassName_Destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef D_FakeClassName_H
|
||||
#define D_FakeClassName_H
|
||||
|
||||
/**********************************************************
|
||||
*
|
||||
* FakeClassName is responsible for providing a
|
||||
* test stub for ClassName
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
#include "ClassName.h"
|
||||
|
||||
#endif /* D_FakeClassName_H */
|
|
@ -0,0 +1,373 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?>
|
||||
|
||||
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.macosx.base.1435574281">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.macosx.base.1435574281" moduleId="org.eclipse.cdt.core.settings" name="MacOSX GCC">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.MachO" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="TddCpp-Logger" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.macosx.base.1435574281" name="MacOSX GCC" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.1435574281.1160983010" name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.29748120" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.MachO" id="cdt.managedbuild.target.gnu.platform.macosx.base.447268970" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
|
||||
<builder enableAutoBuild="true" id="cdt.managedbuild.target.gnu.builder.macosx.base.334128974" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
|
||||
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.1787161386" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base"/>
|
||||
<tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.1325946745" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base">
|
||||
<inputType id="cdt.managedbuild.tool.macosx.cpp.linker.input.1312733490" superClass="cdt.managedbuild.tool.macosx.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.macosx.base.2144619367" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.macosx.base">
|
||||
<option id="gnu.both.asm.option.include.paths.1383507133" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="../../CppUTest/include"/>
|
||||
<listOptionValue builtIn="false" value=""${CPPUTEST_HOME}/include""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1764406066" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.macosx.base.2027039457" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.macosx.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base.1144241685" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base">
|
||||
<option id="gnu.cpp.compiler.option.include.paths.110149452" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="../../CppUTest/include"/>
|
||||
<listOptionValue builtIn="false" value=""${CPPUTEST_HOME}/include""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.569662101" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.macosx.base.698840757" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.macosx.base">
|
||||
<option id="gnu.c.compiler.option.include.paths.898597770" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="../../CppUTest/include"/>
|
||||
<listOptionValue builtIn="false" value=""${CPPUTEST_HOME}/include""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1077250187" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="false" filePath=""/>
|
||||
<parser enabled="false"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="false" filePath=""/>
|
||||
<parser enabled="false"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlC" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.1435574281;cdt.managedbuild.toolchain.gnu.macosx.base.1435574281.1160983010;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.698840757;cdt.managedbuild.tool.gnu.c.compiler.input.1077250187">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="false" filePath=""/>
|
||||
<parser enabled="false"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="false" filePath=""/>
|
||||
<parser enabled="false"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlC" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.1435574281;cdt.managedbuild.toolchain.gnu.macosx.base.1435574281.1160983010;cdt.managedbuild.tool.gnu.cpp.compiler.macosx.base.1144241685;cdt.managedbuild.tool.gnu.cpp.compiler.input.569662101">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="makefileGenerator">
|
||||
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="true" filePath=""/>
|
||||
<parser enabled="true"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="false" filePath=""/>
|
||||
<parser enabled="false"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlc" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
<profile id="org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP">
|
||||
<buildOutputProvider>
|
||||
<openAction enabled="false" filePath=""/>
|
||||
<parser enabled="false"/>
|
||||
</buildOutputProvider>
|
||||
<scannerInfoProvider id="specsFile">
|
||||
<runAction arguments="-E -v ${plugin_state_location}/${specs_file}" command="${XL_compilerRoot}/xlC" useDefault="true"/>
|
||||
<parser enabled="true"/>
|
||||
</scannerInfoProvider>
|
||||
</profile>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="TddCpp-Logger.null.1509812606" name="TddCpp-Logger"/>
|
||||
</storageModule>
|
||||
</cproject>
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Project</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,42 @@
|
|||
#Set this to @ to keep the makefile quiet
|
||||
SILENCE = @
|
||||
|
||||
#---- Outputs ----#
|
||||
COMPONENT_NAME = Project
|
||||
#Set this to @ to keep the makefile quiet
|
||||
SILENCE = @
|
||||
|
||||
#--- Inputs ----#
|
||||
PROJECT_HOME_DIR = .
|
||||
ifeq "$(CPPUTEST_HOME)" ""
|
||||
CPPUTEST_HOME = ../CppUTest
|
||||
endif
|
||||
CPP_PLATFORM = Gcc
|
||||
|
||||
SRC_DIRS = \
|
||||
src\
|
||||
src/*
|
||||
|
||||
# to pick specific files (rather than directories) use this:
|
||||
SRC_FILES =
|
||||
|
||||
TEST_SRC_DIRS = \
|
||||
tests \
|
||||
tests/*
|
||||
|
||||
MOCKS_SRC_DIRS = \
|
||||
mocks \
|
||||
|
||||
INCLUDE_DIRS =\
|
||||
.\
|
||||
include \
|
||||
include/* \
|
||||
$(CPPUTEST_HOME)/include/ \
|
||||
$(CPPUTEST_HOME)/include/Platforms/Gcc\
|
||||
mocks
|
||||
|
||||
CPPUTEST_WARNINGFLAGS = -Wall -Werror -Wswitch-default
|
||||
CPPUTEST_WARNINGFLAGS += -Wconversion -Wswitch-enum
|
||||
|
||||
include $(CPPUTEST_HOME)/build/MakefileWorker.mk
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#ifndef D_ProjectBuildTime_H
|
||||
#define D_ProjectBuildTime_H
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ProjectBuildTime is responsible for recording and reporting when
|
||||
// this project library was built
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ProjectBuildTime
|
||||
{
|
||||
public:
|
||||
explicit ProjectBuildTime();
|
||||
virtual ~ProjectBuildTime();
|
||||
|
||||
const char* GetDateTime();
|
||||
|
||||
private:
|
||||
|
||||
const char* dateTime;
|
||||
|
||||
ProjectBuildTime(const ProjectBuildTime&);
|
||||
ProjectBuildTime& operator=(const ProjectBuildTime&);
|
||||
|
||||
};
|
||||
|
||||
#endif // D_ProjectBuildTime_H
|
|
@ -0,0 +1,16 @@
|
|||
#include "ProjectBuildTime.h"
|
||||
|
||||
ProjectBuildTime::ProjectBuildTime()
|
||||
: dateTime(__DATE__ " " __TIME__)
|
||||
{
|
||||
}
|
||||
|
||||
ProjectBuildTime::~ProjectBuildTime()
|
||||
{
|
||||
}
|
||||
|
||||
const char* ProjectBuildTime::GetDateTime()
|
||||
{
|
||||
return dateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
#include "CppUTest/CommandLineTestRunner.h"
|
||||
|
||||
int main(int ac, char** av)
|
||||
{
|
||||
return CommandLineTestRunner::RunAllTests(ac, av);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#include "CppUTest/TestHarness.h"
|
||||
#include "ProjectBuildTime.h"
|
||||
|
||||
TEST_GROUP(ProjectBuildTime)
|
||||
{
|
||||
ProjectBuildTime* projectBuildTime;
|
||||
|
||||
void setup()
|
||||
{
|
||||
projectBuildTime = new ProjectBuildTime();
|
||||
}
|
||||
void teardown()
|
||||
{
|
||||
delete projectBuildTime;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ProjectBuildTime, Create)
|
||||
{
|
||||
CHECK(0 != projectBuildTime->GetDateTime());
|
||||
}
|
||||
|
11
platforms/platform-test-f4-ll/cpputest/scripts/travis_ci_after.sh
Executable file
11
platforms/platform-test-f4-ll/cpputest/scripts/travis_ci_after.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Script run in the travis CI
|
||||
set -ex
|
||||
|
||||
FILE="./test-suite.log"
|
||||
|
||||
if [ -f $FILE ]; then
|
||||
cat $FILE
|
||||
else
|
||||
echo "$FILE not found."
|
||||
fi
|
178
platforms/platform-test-f4-ll/cpputest/scripts/travis_ci_build.sh
Executable file
178
platforms/platform-test-f4-ll/cpputest/scripts/travis_ci_build.sh
Executable file
|
@ -0,0 +1,178 @@
|
|||
#!/bin/bash
|
||||
# Script run in the travis CI
|
||||
set -ex
|
||||
|
||||
if [ "x$CPPUTEST_HOME" = "x" ] ; then
|
||||
export CPPUTEST_HOME=$TRAVIS_BUILD_DIR
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xautotools" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
make tdd
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xmakefileworker" ]; then
|
||||
make -C $CPPUTEST_HOME -f Makefile_using_MakefileWorker test_all
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xcmake" ]; then
|
||||
BUILD_ARGS=("-DWERROR=ON")
|
||||
|
||||
if [ -n "$CPP_STD" ]; then
|
||||
BUILD_ARGS+=("-DCMAKE_CXX_STANDARD=$CPP_STD")
|
||||
fi
|
||||
|
||||
cmake --version
|
||||
cmake "${BUILD_ARGS[@]}" ..
|
||||
make
|
||||
ctest -V
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xautotools_gtest" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
make check_gtest
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xcmake_gtest" ]; then
|
||||
pwd
|
||||
wget https://github.com/google/googletest/archive/release-1.6.0.zip -O gtest-1.6.0.zip && unzip gtest-1.6.0.zip;
|
||||
wget https://github.com/google/googlemock/archive/release-1.6.0.zip -O gmock-1.6.0.zip && unzip gmock-1.6.0.zip;
|
||||
unzip gtest-1.6.0.zip -d $TRAVIS_BUILD_DIR
|
||||
unzip gmock-1.6.0.zip -d $TRAVIS_BUILD_DIR
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
mv googletest-release-1.6.0 googlemock-release-1.6.0/gtest
|
||||
cd googlemock-release-1.6.0
|
||||
autoreconf -i; ./configure CXXFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 && make
|
||||
cd -
|
||||
export GMOCK_HOME=$TRAVIS_BUILD_DIR/googlemock-release-1.6.0
|
||||
export GTEST_HOME=$TRAVIS_BUILD_DIR/googlemock-release-1.6.0/gtest
|
||||
cmake . -DGMOCK=ON
|
||||
make
|
||||
ctest -V
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xtest_report" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
make check
|
||||
./CppUTestTests -ojunit
|
||||
./CppUTestExtTests -ojunit
|
||||
cp ../scripts/generate_junit_report_ant.xml .
|
||||
ant -f generate_junit_report_ant.xml
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xcmake_coverage" ]; then
|
||||
pip install --user cpp-coveralls gcovr
|
||||
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DC++11=ON -DCOVERAGE=ON -DLONGLONG=ON
|
||||
make
|
||||
ctest
|
||||
|
||||
coveralls -b . -r .. -i "src" -i "include" --gcov-options="-lbc" || true
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xautotools_cmake_install_test" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
rm -rf install_autotools
|
||||
mkdir -p install_autotools
|
||||
make DESTDIR=install_autotools install
|
||||
|
||||
cmake ..
|
||||
rm -rf install_cmake
|
||||
mkdir -p install_cmake
|
||||
make DESTDIR=install_cmake install
|
||||
|
||||
# Hack: autotools cannot make CMake package. We cached and copied them. Here we check they are still the same
|
||||
for cmakefile in CppUTestConfig.cmake CppUTestConfigVersion.cmake CppUTestTargets-relwithdebinfo.cmake CppUTestTargets.cmake; do
|
||||
cat install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile
|
||||
cat install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile
|
||||
diff -Bw install_autotools/usr/local/lib/CppUTest/cmake/$cmakefile install_cmake/usr/local/lib/CppUTest/cmake/$cmakefile || exit 1
|
||||
done
|
||||
|
||||
export INSTALL_DIFF=`diff -rwBq install_autotools install_cmake -X CppUTestGeneratedConfig.h -X libCppUTest.a -X libCppUTestExt.a`
|
||||
if [ "x$INSTALL_DIFF" != "x" ]; then
|
||||
echo "FAILED: CMake install and Autotools install is not the same!\n"
|
||||
echo "Difference\n"
|
||||
echo "-------------------------------\n"
|
||||
echo "$INSTALL_DIFF"
|
||||
echo "-------------------------------\n"
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xdocker_ubuntu_autotools" ]; then
|
||||
$CPPUTEST_HOME/scripts/create_docker_images_and_containers ubuntu
|
||||
docker start -i cpputest_ubuntu
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xdocker_ubuntu_dos" ]; then
|
||||
$CPPUTEST_HOME/scripts/create_docker_images_and_containers dos
|
||||
docker start -i cpputest_dos
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xmake_dos" ]; then
|
||||
if [ ! -d watcom ]; then
|
||||
git clone https://github.com/cpputest/watcom-compiler.git watcom
|
||||
fi
|
||||
export PATH=$PATH:$PWD/watcom/binl
|
||||
export WATCOM=$PWD/watcom
|
||||
export CC=wcl
|
||||
export CXX=wcl
|
||||
$CC --version
|
||||
make -f $CPPUTEST_HOME/platforms/Dos/Makefile clean
|
||||
make -f $CPPUTEST_HOME/platforms/Dos/Makefile
|
||||
$CPPUTEST_HOME/platforms/Dos/alltests.sh
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xextensive_check" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
make check_all
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xautotools_dist" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
|
||||
if [ "x$TRAVIS_OS_NAME" = "xosx" ]; then
|
||||
COPYFILE_DISABLE=1 make dist VERSION=latest
|
||||
COPYFILE_DISABLE=1 make dist-zip VERSION=latest
|
||||
else
|
||||
make dist VERSION=latest
|
||||
make dist-zip VERSION=latest
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xautotools_install_and_test_examples" ]; then
|
||||
autoreconf -i ..
|
||||
../configure
|
||||
|
||||
make tdd
|
||||
sudo make install
|
||||
make -C $CPPUTEST_HOME/examples -f $CPPUTEST_HOME/examples/Makefile_ExamplesWithCppUTestInstalled.mk
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xvc_windows" ]; then
|
||||
export PATH=$MSBUILD_PATH:$PATH
|
||||
cmake ..
|
||||
MSBuild.exe ALL_BUILD.vcxproj
|
||||
./tests/CppUTest/CppUTestTests.exe
|
||||
./tests/CppUTestExt/CppUTestExtTests.exe
|
||||
fi
|
||||
|
||||
if [ "x$BUILD" = "xcmake_windows" ]; then
|
||||
choco install make
|
||||
BUILD_ARGS=("-DWERROR=ON")
|
||||
|
||||
if [ -n "$CPP_STD" ]; then
|
||||
BUILD_ARGS+=("-DCMAKE_CXX_STANDARD=$CPP_STD")
|
||||
fi
|
||||
|
||||
cmake --version
|
||||
cmake -G 'Unix Makefiles' "${BUILD_ARGS[@]}" ..
|
||||
make
|
||||
ctest -V
|
||||
fi
|
|
@ -0,0 +1,29 @@
|
|||
*.metadata*
|
||||
*.sh~
|
||||
*.obj
|
||||
*.zip
|
||||
*.a
|
||||
*.d
|
||||
*.o
|
||||
*.lib
|
||||
*.ncb
|
||||
*.opt
|
||||
*.plg
|
||||
*/Debug/*
|
||||
*.svn*
|
||||
*/Alltests
|
||||
*.gcov
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.html
|
||||
*doxygen*
|
||||
*_tests
|
||||
*/*.class
|
||||
*Doxyfile
|
||||
*Releases*
|
||||
*UnityTemplates*
|
||||
*platforms*
|
||||
*.DS_Store
|
||||
*.git*
|
||||
*.gitignore
|
||||
*.swp
|
Loading…
Add table
Add a link
Reference in a new issue