Skip to content

Commit 3bf255d

Browse files
updates for ubuntu 22.04 and cpputest 4.0
1 parent 16fa598 commit 3bf255d

File tree

7 files changed

+32
-4
lines changed

7 files changed

+32
-4
lines changed

test_support/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
include_directories(include)
12
add_subdirectory(cpputest-qpc-port)

test_support/common/cpputestCMake.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ else()
99
message(STATUS "Found CppUTest version ${CPPUTEST_VERSION}")
1010
endif()
1111

12+
if(CPPUTEST_VERSION_MAJOR LESS 4)
13+
# likely 3.8
14+
add_compile_definitions(CMS_CPPUTEST_LEGACY)
15+
else()
16+
# 4.0 version or newer
17+
add_compile_definitions(CMS_CPPUTEST_V4)
18+
endif()
19+
1220
include_directories(${CPPUTEST_INCLUDE_DIRS})
1321
link_directories(${CPPUTEST_LIBRARIES})
1422

test_support/cpputest-qpc-port/include/cmsDummyActiveObject.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qpc.h"
3030
#include <array>
3131
#include <functional>
32+
#include <cstdlib>
3233

3334
namespace cms {
3435

test_support/cpputest-qpc-port/src/cms_cpputest_q_onAssert.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
///***************************************************************************
2727
/// @endcond
2828

29-
#include "CppUTest/TestHarness.h"
29+
#include "cms_cpputest.hpp"
3030
#include "qp_port.h" //required for Q_NORETURN definition, needed by qsafe.h
3131
#include "qsafe.h"
3232
#include "qassertMockSupport.hpp"
@@ -51,5 +51,5 @@ void Q_onError(char const* const module, int_t const id)
5151
.withParameter("module", module)
5252
.withParameter("id", id);
5353

54-
TEST_EXIT
54+
CMS_TEST_EXIT;
5555
}

test_support/cpputest-qpc-port/test/cms_cpputest_qf_ctrlTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <chrono>
2828
#include "cms_cpputest_qf_ctrl.hpp"
2929
#include "cmsDummyActiveObject.hpp"
30-
#include "CppUTest/TestHarness.h"
30+
#include "cms_cpputest.hpp"
3131
#include "qp_pkg.h"
3232

3333
using namespace cms::test;
@@ -128,7 +128,7 @@ TEST(qf_ctrlTests,
128128
sigTwoCount++;
129129
}
130130
else {
131-
TEST_EXIT
131+
CMS_TEST_EXIT;
132132
}
133133
});
134134

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// Created by eshlemanm on 5/18/24, providing a minor porting layer
3+
// to handle CppUTest 3.8 versus 4.0 changes.
4+
//
5+
6+
#ifndef CPPUTEST_FOR_QPC_CMS_CPPUTEST_HPP
7+
#define CPPUTEST_FOR_QPC_CMS_CPPUTEST_HPP
8+
9+
#include "CppUTest/TestHarness.h"
10+
11+
#ifdef CMS_CPPUTEST_LEGACY
12+
#define CMS_TEST_EXIT do { TEST_EXIT } while(0)
13+
#else
14+
#define CMS_TEST_EXIT do { TEST_EXIT; } while(0)
15+
#endif
16+
17+
#endif // CPPUTEST_FOR_QPC_CMS_CPPUTEST_HPP

utilities/include/cmsVectorBackedQEQueue.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "qpc.h"
2828
#include <cstdint>
2929
#include <vector>
30+
#include <cstdlib>
3031

3132
namespace cms {
3233

0 commit comments

Comments
 (0)