Skip to content

Commit

Permalink
feat: add integration tests (#208)
Browse files Browse the repository at this point in the history
* Add dev container

* feat: mininal stim+tester

GPIO only, report over tester UI LEDs

* handshake and timeout to test GPIO

* Refactor and use InputPin/OutputPin

* Added echo support (not working state)

* Format CMakeLists.txt and Main.cpp

* Update and restructure

* More restructuring

* Extract integration_test/logic/Gpio

* Refactor

* Fix building for host

* A few small fixes

* Extract instantiations from main

* Update EmbeddedInfraLib

* Create install package in host build, pass on to embedded build

* Fix artifact name

* Apply clang-format

* .github/workflows/ci.yml: remove superfluous host build

* .github/workflows/ci.yml: install xsltproc

* integration_test/tester/Main: Update names of Tester/Tested

* Update amp-embedded-infra-lib to v5.0.0

---------

Co-authored-by: Thomas de Bont <[email protected]>
  • Loading branch information
richardapeters and thomas-philips authored Nov 9, 2023
1 parent 2413862 commit 07086ec
Show file tree
Hide file tree
Showing 34 changed files with 85,615 additions and 23 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:
- uses: lukka/run-cmake@2ce8982be71b8e9a3c4d5e432135035afd1e76a7 # v10.7
with:
configurePreset: "host"
buildPreset: "host-Debug" #-WithPackage"
buildPreset: "host-Debug-WithPackage"
#testPreset: "host"
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']"
#- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
# with:
# name: halst
# path: build/host/halst-*-Linux.tar.gz
# if-no-files-found: error
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: hal_st
path: build/host/hal_st-*-Linux.tar.gz
if-no-files-found: error
#- name: Upload test logs
# if: ${{ failure() }}
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
Expand Down Expand Up @@ -69,6 +69,7 @@ jobs:
embedded_build:
name: Embedded Build
runs-on: ubuntu-latest
needs: [host_build_test_ubuntu]
strategy:
matrix:
configuration: ["RelWithDebInfo"]
Expand All @@ -90,13 +91,17 @@ jobs:
uses: carlosperate/arm-none-eabi-gcc-action@e9cd61b92edb079b14b2d0449b21f8a517121fe8 # v1.8.0
with:
release: ${{ matrix.gcc }}
- run: sudo apt-get update && sudo apt-get install ninja-build xsltproc
- uses: hendrikmuhs/ccache-action@6d1841ec156c39a52b1b23a810da917ab98da1f4 # v1.2.10
with:
key: ${{ matrix.gcc }}-${{ matrix.configuration }}-${{ matrix.target }}
- run: |
sudo apt-get update && sudo apt-get install --no-install-recommends ninja-build xsltproc
echo "::add-matcher::.github/matchers/gcc-problem-matcher.json"
cmake --preset host -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build --preset host-${{ matrix.configuration }}
cmake --preset ${{ matrix.target }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build --preset ${{ matrix.target }}-${{ matrix.configuration }}
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: hal_st
- run: tar -zxvf hal_st-*.tar.gz
- run: mkdir install && mv hal_st-*/* install/
- uses: lukka/run-cmake@2ce8982be71b8e9a3c4d5e432135035afd1e76a7 # v10.7
with:
configurePreset: ${{ matrix.target }}
buildPreset: ${{ matrix.target }}-${{ matrix.configuration }}
configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
build/
out/
megalinter-reports/
install/
21 changes: 19 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (HALST_STANDALONE)
FetchContent_Declare(
emil
GIT_REPOSITORY https://github.com/philips-software/amp-embedded-infra-lib.git
GIT_TAG dbda405cc2ef2d356fbe707df5389042a49c7959 # Unreleased
GIT_TAG 2ddda404d8822d9cdeb817629e036647a8a3a136 # v5.0.0
)

FetchContent_MakeAvailable(emil)
Expand All @@ -34,7 +34,7 @@ set_directory_properties(PROPERTY USE_FOLDERS ON)

# When building HalSt by itself do not exclude any targets from all
# Libraries will only be excluded from all when HalSt is a consumed as a dependency.
if (HALST_STANDALONE AND NOT EMIL_HOST_BUILD)
if (HALST_STANDALONE)
set(HALST_EXCLUDE_FROM_ALL "")
else()
set(HALST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
Expand All @@ -43,6 +43,7 @@ endif()
add_subdirectory(st)
add_subdirectory(hal_st)
add_subdirectory(hal_st_lwip)
add_subdirectory(integration_test)
add_subdirectory(services)
add_subdirectory(examples)

Expand All @@ -51,3 +52,19 @@ emil_clangformat_directories(hal_st DIRECTORIES .)
if (HALST_STANDALONE)
emil_folderize_all_targets()
endif()

set(CPACK_GENERATOR "ZIP;TGZ")
set(CPACK_SOURCE_IGNORE_FILES ".vs/;.git/;build/")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_VENDOR "Koninklijke Philips N.V")
set(CPACK_PACKAGE_DESCRIPTION "${PROJECT_DESCRIPTION}")
set(CPACK_DEBIAN_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_RPM_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_HOMEPAGE_URL "${PROJECT_HOMEPAGE_URL}")
set(CPACK_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")

include(CPack)
10 changes: 8 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"name": "defaults",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install",
"cacheVariables": {
"HALST_BUILD_EXAMPLES": true
}
Expand All @@ -14,7 +15,8 @@
"displayName": "Configuration for Host Tooling and Tests",
"inherits": "defaults",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo;MinSizeRel"
"CMAKE_CONFIGURATION_TYPES": "Debug;Release;RelWithDebInfo;MinSizeRel",
"EMIL_BUILD_ECHO_COMPILERS": true
},
"generator": "Ninja Multi-Config"
},
Expand Down Expand Up @@ -43,7 +45,6 @@
"CMAKE_TOOLCHAIN_FILE": ""
},
"cacheVariables": {
"EMIL_GENERATE_PACKAGE_CONFIG": false,
"TARGET_MCU_VENDOR": "st"
}
},
Expand Down Expand Up @@ -197,6 +198,11 @@
"name": "stm32f767-RelWithDebInfo",
"configuration": "RelWithDebInfo",
"configurePreset": "stm32f767"
},
{
"name": "stm32f767-Debug",
"configuration": "Debug",
"configurePreset": "stm32f767"
}
],
"testPresets": [
Expand Down
Loading

0 comments on commit 07086ec

Please sign in to comment.