Skip to content

Commit 71ed6e7

Browse files
Merge pull request #4 from covemountainsoftware/2-break-up-into-library-specific-project-and-example-container-project
Resolve: break up into library specific project and example container project
2 parents feae199 + d7ffab9 commit 71ed6e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+69
-1379
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "externals/qpc"]
2-
path = externals/qpc
3-
url = git@github.com:QuantumLeaps/qpc.git

CMakeLists.txt

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
cmake_minimum_required(VERSION 3.16)
2-
project(cpputest-for-qpc)
2+
project(cpputest-for-qpc-lib)
3+
include(FetchContent)
34

45
set(CMAKE_CXX_STANDARD 14)
56
set(CMAKE_C_STANDARD 11)
67

78
add_compile_options(-Wall -Wextra -Werror)
89

9-
include_directories(include)
10+
set(CMS_EXTERNALS_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/externals)
11+
set(CMS_CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cpputest-for-qpc-lib/cmake)
1012

11-
set(EXTERNALS_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/externals)
12-
set(CMS_QPC_TOP_DIR ${EXTERNALS_TOP_DIR}/qpc)
13+
if(NOT DEFINED CMS_QPC_TOP_DIR)
14+
set(CMS_QPC_TOP_DIR ${CMS_EXTERNALS_TOP_DIR}/qpc)
15+
FetchContent_Declare(qpc
16+
GIT_REPOSITORY https://github.com/QuantumLeaps/qpc.git
17+
GIT_TAG fcea9943bbeeca49c66ce124d4d71467f6e2661e #7.3.3
18+
SOURCE_DIR ${CMS_QPC_TOP_DIR}
19+
)
20+
message("Fetching QP/C git repository")
21+
FetchContent_MakeAvailable(qpc)
22+
endif(NOT DEFINED CMS_QPC_TOP_DIR)
1323

14-
include(externals/qpcCMakeSupport.txt)
15-
16-
set(CMS_TEST_SUPPORT_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test_support)
17-
set(MOCKS_TOP_DIR ${CMS_TEST_SUPPORT_TOP_DIR}/mocks)
18-
set(DRIVERS_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/drivers)
19-
set(CMS_UTILS_TOP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/utilities)
20-
21-
add_subdirectory(utilities)
22-
add_subdirectory(test_support)
23-
add_subdirectory(drivers)
24-
add_subdirectory(examples)
24+
include(${CMS_CMAKE_DIR}/qpcCMakeSupport.cmake)
25+
add_subdirectory(cpputest-for-qpc-lib)

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CppUTest for the QP/C (qpc) Real-Time Embedded Framework
1+
# CppUTest for the QP/C (qpc) Real-Time Embedded Framework (library only)
22

33
Build and Test status: ![Build and Tests](https://github.com/covemountainsoftware/cpputest-for-qpc/actions/workflows/cmake.yml/badge.svg)
44

@@ -12,7 +12,7 @@ encourage and support efforts like this. Thank you!
1212

1313
# Introduction
1414

15-
The `cpputest-for-qpc` project enables CppUTest for the
15+
The `cpputest-for-qpc` library project enables CppUTest for the
1616
QP/C Real-Time Embedded Framework. This project provides for the
1717
following capabilities:
1818

@@ -22,7 +22,7 @@ following capabilities:
2222
* Supporting utilities to simplify unit testing of qpc
2323
based active objects. Provided classes may also be useful in
2424
the final target software, if C++ is also in use.
25-
* An example C language based active object under test.
25+
* A separate examples project providing usage/examples of this library
2626

2727
Benefits of this approach to unit testing active objects include:
2828
* No surprises. The active object under test interacts with the
@@ -43,19 +43,20 @@ Benefits of this approach to unit testing active objects include:
4343

4444
# Environment
4545

46-
This project was developed and proven in Ubuntu 20.04. In theory any
46+
This project was developed and proven in Ubuntu 20.04 and 22.04. In theory any
4747
build or host operating system environment supported by CppUTest will
4848
be compatible with this code.
4949

5050
## Prerequisites
5151

52-
* qpc (pulled in as a git submodule)
53-
* After cloning this repository, do not forget to:
54-
* `git submodule init`
55-
* `git submodule update`
56-
* CppUTest (version 3.8-7 or version 4.0) (3.8 is the default in Ubuntu 20.04 while 4.0 is the default in Ubuntu 22.04)
5752
* CMake and associated build tools were used to develop
5853
and prove out this project.
54+
* QP/C
55+
* You can override the QPC to another directory with your project's exact QPC source code.
56+
Define the cmake variable CMS_QPC_TOP_DIR before including the internal CMakeLists.txt.
57+
* or:
58+
* Do not define CMS_QPC_TOP_DIR, and the internal cmake will fetch the appropriate QP/C repo.
59+
* CppUTest (version 3.8-7 or version 4.0) (3.8 is the default in Ubuntu 20.04 while 4.0 is the default in Ubuntu 22.04)
5960
* This project requires support for C++14 and C11.
6061

6162
## Continuous Integration
@@ -125,7 +126,7 @@ behavior, using the exact same interfaces the active object would use
125126
in the production target. CppUTest provides for the mocking capabilities to
126127
ensure that the active object under test is calling the expected APIs.
127128

128-
Within this project, please see the tests for `examples/hwLockCtrlService` which
129+
Within the associated examples project, please see the tests for `examples/hwLockCtrlService` which
129130
provides examples of:
130131
* Testing for reaction to a published event, where the reaction is observed
131132
through a CppUTest `mock()`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include_directories(include)
2+
include_directories(${CMS_QPC_SRC_DIR})
3+
include_directories(${CMS_CPPUTEST_QP_PORT_TOP_DIR}/include)
4+
5+
add_library(cpputest-for-qpc-lib
6+
src/cpputest_qf_port.cpp
7+
src/cms_cpputest_qf_ctrl.cpp
8+
src/cms_cpputest_q_onAssert.cpp
9+
src/cms_cpputest_qf_onCleanup.cpp
10+
src/cpputestMain.cpp
11+
${CMS_QPC_QF_SRCS})
12+
13+
add_subdirectory(tests)
14+
15+
target_include_directories(cpputest-for-qpc-lib PUBLIC
16+
${CMS_QPC_INCLUDE_DIR}
17+
${CMS_CPPUTEST_QP_PORT_TOP_DIR}/include
18+
${CMS_UTILS_TOP_DIR}/include)
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
set(CMS_QPC_SRC_DIR ${CMS_QPC_TOP_DIR}/src)
2+
set(CMS_QPC_INCLUDE_DIR ${CMS_QPC_TOP_DIR}/include)
3+
set(CMS_QPC_QF_SRC_DIR ${CMS_QPC_SRC_DIR}/qf)
4+
5+
set(CMS_QPC_QF_SRCS
6+
${CMS_QPC_QF_SRC_DIR}/qep_hsm.c
7+
${CMS_QPC_QF_SRC_DIR}/qep_msm.c
8+
${CMS_QPC_QF_SRC_DIR}/qf_act.c
9+
${CMS_QPC_QF_SRC_DIR}/qf_actq.c
10+
${CMS_QPC_QF_SRC_DIR}/qf_defer.c
11+
${CMS_QPC_QF_SRC_DIR}/qf_dyn.c
12+
${CMS_QPC_QF_SRC_DIR}/qf_mem.c
13+
${CMS_QPC_QF_SRC_DIR}/qf_ps.c
14+
${CMS_QPC_QF_SRC_DIR}/qf_qact.c
15+
${CMS_QPC_QF_SRC_DIR}/qf_qeq.c
16+
${CMS_QPC_QF_SRC_DIR}/qf_qmact.c
17+
${CMS_QPC_QF_SRC_DIR}/qf_time.c)
File renamed without changes.
File renamed without changes.

test_support/cpputest-qpc-port/include/cmsDummyActiveObject.hpp renamed to cpputest-for-qpc-lib/include/cmsDummyActiveObject.hpp

File renamed without changes.

test_support/cpputest-qpc-port/include/cmsTestPublishedEventRecorder.hpp renamed to cpputest-for-qpc-lib/include/cmsTestPublishedEventRecorder.hpp

File renamed without changes.

0 commit comments

Comments
 (0)