Skip to content

Commit

Permalink
Merge b359a5f into 3c20848
Browse files Browse the repository at this point in the history
  • Loading branch information
basvodde committed May 13, 2020
2 parents 3c20848 + b359a5f commit 3f0a87d
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 82 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -48,6 +48,8 @@ jobs:
env: BUILD=autotools
- compiler: clang
env: BUILD=autotools
- compiler: gcc
env: BUILD=makefileworker

# Extended builds, different C++ version and build tools
- stage: extended build & test
Expand Down
16 changes: 1 addition & 15 deletions ChangeLog
@@ -1,18 +1,4 @@

Addition to Release 3.7 and Release 3.7.1:

* -v and -ojunit together
* Better memory leak printing
* MEMCMP_EQUAL
* STRNCMP_EQUAL
* Memory Leak Detector multi-threading support
* Mock Output parameters
* Better Windows support
* Many Mock improvements
* Many small fixes and improvements
* Less platform specific dependencies
* More platforms supported

For further changelog check the github page:
For changelog check the github page:
https://github.com/cpputest/cpputest

99 changes: 44 additions & 55 deletions Makefile_using_MakefileWorker
Expand Up @@ -11,12 +11,13 @@ endif
CPPUTEST_HOME = .
OLD_MAKE = oldmake

MAKE_CMD = make -f $(CPPUTEST_HOME)/Makefile_using_MakefileWorker
CPPUTEST_ENABLE_DEBUG = Y

SRC_DIRS = \
src/CppUTest \
src/Platforms/$(CPP_PLATFORM)

TEST_SRC_DIRS = \
tests/CppUTest

Expand All @@ -27,75 +28,63 @@ include $(CPPUTEST_HOME)/build/MakefileWorker.mk

#these are a sample of the other alternative flag settings
.PHONY: test_all
test_all: start test_old_make
test_all: start
@echo Building with the default flags.
make clean
$(TIME) make
$(MAKE_CMD) clean
$(TIME) $(MAKE_CMD)
./$(TEST_TARGET) -r
make clean
@echo Building with the STDC++ new disabled.
$(TIME) make CPPUTEST_USE_STD_CPP_LIB=Y extensions
make CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
$(MAKE_CMD) clean
@echo Building with the STDC++ new disabled.
$(TIME) $(MAKE_CMD) CPPUTEST_USE_STD_CPP_LIB=Y extensions
$(MAKE_CMD) CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
@echo Building with Memory Leak Detection disabled
$(TIME) make CPPUTEST_USE_MEM_LEAK_DETECTION=N extensions
make CPPUTEST_USE_MEM_LEAK_DETECTION=N cleanExtensions
$(TIME) $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N extensions
$(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N cleanExtensions
@echo Building with Memory Leak Detection disabled and STD C++ disabled
$(TIME) make CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y extensions
make CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
$(TIME) $(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y extensions
$(MAKE_CMD) CPPUTEST_USE_MEM_LEAK_DETECTION=N CPPUTEST_USE_STD_CPP_LIB=Y cleanExtensions
@echo Building with debug disabled
$(TIME) make CPPUTEST_ENABLE_DEBUG=N extensions
make CPPUTEST_ENABLE_DEBUG=N cleanExtensions
$(TIME) $(MAKE_CMD) CPPUTEST_ENABLE_DEBUG=N extensions
$(MAKE_CMD) CPPUTEST_ENABLE_DEBUG=N cleanExtensions
@echo Building with overridden CXXFLAGS and CFLAGS and CPPFLAGS
$(TIME) make CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude"
make CFLAGS="" CXXFLAGS="" clean
$(TIME) $(MAKE_CMD) CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude"
$(MAKE_CMD) CFLAGS="" CXXFLAGS="" clean
@echo Building without Standard C library includes
$(TIME) make CPPUTEST_USE_STD_C_LIB=N all_no_tests
make CPPUTEST_USE_STD_C_LIB=N clean
$(TIME) $(MAKE_CMD) CPPUTEST_USE_STD_C_LIB=N all_no_tests
$(MAKE_CMD) CPPUTEST_USE_STD_C_LIB=N clean
@echo Building with a different TARGET_PLATFORM
make TARGET_PLATFORM=real_platform
$(MAKE_CMD) TARGET_PLATFORM=real_platform
@echo Building with overridden CXXFLAGS and CFLAGS and memory leak and STDC++ disabled
$(TIME) make CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude -DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED"
make CFLAGS="" CXXFLAGS="" CPPFLAGS="-DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED" clean
@echo Building examples
make cleanExamples
$(TIME) make examples
make cleanExamples
$(TIME) $(MAKE_CMD) CLFAGS="" CXXFLAGS="" CPPFLAGS="-Iinclude -DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED"
$(MAKE_CMD) CFLAGS="" CXXFLAGS="" CPPFLAGS="-DCPPUTEST_STD_CPP_LIB_DISABLED -DCPPUTEST_MEM_LEAK_DETECTION_DISABLED" clean
@echo Building examples
$(MAKE_CMD) cleanExamples
$(TIME) $(MAKE_CMD) examples
$(MAKE_CMD) cleanExamples
@echo Testing JUnit output
$(TIME) make
$(TIME) $(MAKE_CMD)
$(SILENCE)./$(TEST_TARGET) -ojunit > junit_run_output
$(SILENCE)if [ -s junit_run_output ]; then echo "JUnit run has output. Build failed!"; exit 1; fi
make clean
make CPPUTEST_MAP_FILE=map.txt
make clean
$(MAKE_CMD) clean
$(MAKE_CMD) CPPUTEST_MAP_FILE=map.txt
$(MAKE_CMD) clean
@echo Testing GCOV usage
$(TIME) make CPPUTEST_USE_GCOV=Y everythingInstall
make gcov
make -f Makefile_CppUTestExt gcov
make -C examples gcov
make cleanEverythingInstall
$(TIME) $(MAKE_CMD) CPPUTEST_USE_GCOV=Y everythingInstall
$(MAKE_CMD) gcov
$(MAKE) -f Makefile_CppUTestExt gcov
$(MAKE) -C examples gcov
$(MAKE_CMD) cleanEverythingInstall
@echo Testing VPATH usage
$(TIME) make CPPUTEST_USE_GCOV=Y CPPUTEST_USE_VPATH=Y everythingInstall
make CPPUTEST_USE_VPATH=Y gcov
make CPPUTEST_USE_VPATH=Y -f Makefile_CppUTestExt gcov
make CPPUTEST_USE_VPATH=Y -C examples gcov
make clean cleanExamples
$(TIME) $(MAKE_CMD) CPPUTEST_USE_GCOV=Y CPPUTEST_USE_VPATH=Y everythingInstall
$(MAKE_CMD) CPPUTEST_USE_VPATH=Y gcov
$(MAKE) CPPUTEST_USE_VPATH=Y -f Makefile_CppUTestExt gcov
$(MAKE) CPPUTEST_USE_VPATH=Y -C examples gcov
$(MAKE_CMD) clean cleanExamples
@echo Testing VPATH usage
$(TIME) make CPPUTEST_USE_VPATH=Y everythingInstall
make CPPUTEST_USE_VPATH=Y cleanEverythingInstall
make flags
make debug

HAS_OLD_MAKE = $(shell $(OLD_MAKE) -v 2>/dev/null)

test_old_make:
$(SILENCE)if [ "$(HAS_OLD_MAKE)" = "" ]; then \
echo "Old make with the name $(OLD_MAKE) not found. Skipping testing with old make version"; \
else \
$(OLD_MAKE) -f Makefile_for_old_make clean && \
$(OLD_MAKE) -f Makefile_for_old_make && \
$(OLD_MAKE) -f Makefile_for_old_make extensions && \
$(OLD_MAKE) -f Makefile_for_old_make clean; \
fi
$(TIME) $(MAKE_CMD) CPPUTEST_USE_VPATH=Y everythingInstall
$(MAKE_CMD) CPPUTEST_USE_VPATH=Y cleanEverythingInstall
$(MAKE_CMD) flags
$(MAKE_CMD) debug

.PHONY: examples
examples: $(TEST_TARGET) extensions
Expand Down
4 changes: 4 additions & 0 deletions scripts/travis_ci_build.sh
Expand Up @@ -12,6 +12,10 @@ if [ "x$BUILD" = "xautotools" ]; then
make tdd
fi

if [ "x$BUILD" = "xmakefileworker" ]; then
make -C $CPPUTEST_HOME -f Makefile_using_MakefileWorker
fi

if [ "x$BUILD" = "xcmake" ]; then
BUILD_ARGS=("-DWERROR=ON")

Expand Down
2 changes: 2 additions & 0 deletions src/Platforms/GccNoStdC/UtestPlatform.cpp
Expand Up @@ -78,3 +78,5 @@ void (*PlatformSpecificMutexLock)(PlatformSpecificMutex mtx) = NULLPTR;
void (*PlatformSpecificMutexUnlock)(PlatformSpecificMutex mtx) = NULLPTR;
void (*PlatformSpecificMutexDestroy)(PlatformSpecificMutex mtx) = NULLPTR;

void (*PlatformSpecificSrand)(unsigned int) = NULLPTR;
int (*PlatformSpecificRand)(void) = NULLPTR;
7 changes: 7 additions & 0 deletions tests/CppUTest/MemoryOperatorOverloadTest.cpp
Expand Up @@ -166,9 +166,16 @@ TEST(MemoryLeakOverridesToBeUsedInProductionCode, UseNativeMallocByTemporarlySwi
#undef malloc
#undef free
#endif

#if CPPUTEST_USE_STD_C_LIB
void* memory = malloc(10);
LONGS_EQUAL(memLeaks, memLeakDetector->totalMemoryLeaks(mem_leak_period_checking));
free (memory);
#else
void* memory = PlatformSpecificMalloc(10);
LONGS_EQUAL(memLeaks, memLeakDetector->totalMemoryLeaks(mem_leak_period_checking));
PlatformSpecificFree (memory);
#endif

#ifdef CPPUTEST_USE_MALLOC_MACROS
#include "CppUTest/MemoryLeakDetectorMallocMacros.h"
Expand Down
12 changes: 6 additions & 6 deletions tests/CppUTest/SimpleStringTest.cpp
Expand Up @@ -532,10 +532,10 @@ TEST(SimpleString, copyInBufferNormal)
{
SimpleString str("Hello World");
size_t bufferSize = str.size()+1;
char* buffer = (char*) malloc(bufferSize);
char* buffer = (char*) PlatformSpecificMalloc(bufferSize);
str.copyToBuffer(buffer, bufferSize);
STRCMP_EQUAL(str.asCharString(), buffer);
free(buffer);
PlatformSpecificFree(buffer);
}

TEST(SimpleString, copyInBufferWithEmptyBuffer)
Expand All @@ -550,21 +550,21 @@ TEST(SimpleString, copyInBufferWithBiggerBufferThanNeeded)
{
SimpleString str("Hello");
size_t bufferSize = 20;
char* buffer= (char*) malloc(bufferSize);
char* buffer= (char*) PlatformSpecificMalloc(bufferSize);
str.copyToBuffer(buffer, bufferSize);
STRCMP_EQUAL(str.asCharString(), buffer);
free(buffer);
PlatformSpecificFree(buffer);
}

TEST(SimpleString, copyInBufferWithSmallerBufferThanNeeded)
{
SimpleString str("Hello");
size_t bufferSize = str.size();
char* buffer= (char*) malloc(bufferSize);
char* buffer= (char*) PlatformSpecificMalloc(bufferSize);
str.copyToBuffer(buffer, bufferSize);
STRNCMP_EQUAL(str.asCharString(), buffer, (bufferSize-1));
LONGS_EQUAL(0, buffer[bufferSize-1]);
free(buffer);
PlatformSpecificFree(buffer);
}

TEST(SimpleString, ContainsNull)
Expand Down
4 changes: 2 additions & 2 deletions tests/CppUTest/TestHarness_cTest.cpp
Expand Up @@ -338,7 +338,7 @@ TEST(TestHarness_c, checkLongLongInt)
static void _failLongLongIntTextMethod()
{
cpputest_longlong dummy_longlong;
CHECK_EQUAL_C_LONGLONG_TEXT(dummy_longlong, dummy_longlong);
CHECK_EQUAL_C_LONGLONG_TEXT(dummy_longlong, dummy_longlong, "Text");
} // LCOV_EXCL_LINE

TEST(TestHarness_c, checkLongLongIntText)
Expand Down Expand Up @@ -366,7 +366,7 @@ TEST(TestHarness_c, checkUnsignedLongLongInt)
static void _failUnsignedLongLongIntTextMethod()
{
cpputest_ulonglong dummy_ulonglong;
CHECK_EQUAL_C_ULONGLONG_TEXT(dummy_ulonglong, dummy_ulonglong);
CHECK_EQUAL_C_ULONGLONG_TEXT(dummy_ulonglong, dummy_ulonglong, "Text");
} // LCOV_EXCL_LINE

TEST(TestHarness_c, checkUnsignedLongLongIntText)
Expand Down
4 changes: 0 additions & 4 deletions tests/RunAllTests.sh

This file was deleted.

0 comments on commit 3f0a87d

Please sign in to comment.