Skip to content

Commit

Permalink
Added github action to test CPP API (#187)
Browse files Browse the repository at this point in the history
Github action to test C++ API
  • Loading branch information
christophe0606 authored Jun 26, 2024
1 parent fd088ac commit 3be81f2
Show file tree
Hide file tree
Showing 18 changed files with 247 additions and 52 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/runcpptest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Compile and Run
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]

permissions:
actions: read
security-events: write

jobs:
CI_cpp_test_run:
strategy:
fail-fast: false
matrix:
# GCC currently has too many problems with the C++ API
compiler: [AC6, CLANG]
core: [M0, M4, M55]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: Testing/requirements.txt

- name: Install system packages
run: |
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install libpython3.9 libtinfo5
- name: Cache packs
uses: actions/cache@v4
with:
key: packs-cmsis-dsp
restore-keys: |
packs-
path: /home/runner/.cache/arm/packs

- name: Activate vcpkg
uses: ARM-software/cmsis-actions/vcpkg@v1
with:
cache: "-cmsis_dsp_vcpkg"

- name: Activate Arm tool license
uses: ARM-software/cmsis-actions/armlm@v1

- name: Cache boost
id: cache-boost
uses: actions/cache@v4
with:
key: boost-cmsis-dsp
restore-keys: |
boost-cmsis-dsp
path: ${{ github.workspace }}/boost_1_84_0

- name: Install boost
if: steps.cache-boost.outputs.cache-hit != 'true'
run: |
echo "Install boost"
curl -o boost.tar.gz https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.gz
tar -xf boost.tar.gz
- name: Prepare framework
run: |
cd dsppp
echo "Create missing folders"
mkdir AC6_results
mkdir CLANG_results
mkdir GCC_results
echo "Install missing python packages"
pip install -r ../Testing/requirements.txt
echo "Load missing pack"
csolution list packs -s test.csolution.yml -m > required_packs.txt
cat required_packs.txt
cpackget add -a -f required_packs.txt
- name: Execute
run: |
cd dsppp
echo "Running tests"
python run_all.py -t -g ${{ matrix.compiler }} -c ${{ matrix.core }} -avh $AVH_FVP_PLUGINS/../bin
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-cpp-report_${{ matrix.compiler }}_${{ matrix.core }}
path: dsppp/${{ matrix.compiler }}_results/errors_${{ matrix.core }}.txt


- name: Check error
run: |
cd dsppp
echo "Checking output..."
test "$(cat ${{ matrix.compiler }}_results/errors_${{ matrix.core }}.txt | wc -l)" -eq 0
16 changes: 13 additions & 3 deletions .github/workflows/runtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
security-events: write

jobs:
CI_test_run:
CI_c_test_run:
strategy:
fail-fast: false
matrix:
Expand All @@ -25,17 +25,27 @@ jobs:
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.10'
cache: 'pip'
cache-dependency-path: Testing/requirements.txt

- name: Install system packages
run: |
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install libpython3.9 libtinfo5
- name: Cache packs
uses: actions/cache@v4
with:
key: packs-cmsis-dsp
restore-keys: |
packs-
path: /home/runner/.cache/arm/packs

- name: Activate vcpkg
uses: ARM-software/cmsis-actions/vcpkg@v1
with:
cache: "-${{ matrix.compiler }}"
cache: "-cmsis_dsp_vcpkg"

- name: Activate Arm tool license
uses: ARM-software/cmsis-actions/armlm@v1
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PythonWrapper/build_linux/Makefile
PythonWrapper/build_linux/bin_dsp/
PythonWrapper/build_linux/build.sh
PythonWrapper/build_linux/cmake_install.cmake

boost_1_84_0/


# Output of the linkchecker tool
Expand Down
3 changes: 3 additions & 0 deletions dsppp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ run_*.bat
ac6_results/
gcc_results/
clang_results/
AC6_results/
GCC_results/
CLANG_results/
2 changes: 1 addition & 1 deletion dsppp/RTE/_Release_VHT-Corstone-300/RTE_Components.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CSOLUTION generated file: DO NOT EDIT!
* Generated by: csolution version 2.2.1
* Generated by: csolution version 2.4.0
*
* Project: 'test.Release+VHT-Corstone-300'
* Target: 'Release+VHT-Corstone-300'
Expand Down
2 changes: 1 addition & 1 deletion dsppp/RTE/_Release_VHT-M0P/RTE_Components.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CSOLUTION generated file: DO NOT EDIT!
* Generated by: csolution version 2.2.1
* Generated by: csolution version 2.4.0
*
* Project: 'test.Release+VHT-M0P'
* Target: 'Release+VHT-M0P'
Expand Down
2 changes: 1 addition & 1 deletion dsppp/RTE/_Release_VHT-M4/RTE_Components.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CSOLUTION generated file: DO NOT EDIT!
* Generated by: csolution version 2.2.1
* Generated by: csolution version 2.4.0
*
* Project: 'test.Release+VHT-M4'
* Target: 'Release+VHT-M4'
Expand Down
9 changes: 8 additions & 1 deletion dsppp/allocator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "allocator.h"

#if !defined(TESTMODE)

#define ALLOC_POOL(BYTES,NB) \
MemoryPool<POOL_BLOCK_##BYTES,user_allocator_aligned_malloc> vecPool_##BYTES(NB);

Expand All @@ -11,11 +13,13 @@ std::map<int, int> current_stats;
std::map<int, int> max_stats;
std::map<void*, std::size_t> current_dyn_stats;

#endif

void print_map(std::string comment)
{

std::cout << comment << "\r\n";
#if !defined(POOL_ALLOCATOR)
#if !defined(POOL_ALLOCATOR) && !defined(TESTMODE)
std::size_t total_static=0;
std::size_t total_dynamic=0;

Expand Down Expand Up @@ -64,6 +68,8 @@ void print_map(std::string comment)
#endif
}

#if !defined(TESTMODE)

void reset_current_stats()
{
#if !defined(POOL_ALLOCATOR)
Expand Down Expand Up @@ -96,3 +102,4 @@ void check_current_stats()
#endif
}

#endif
10 changes: 9 additions & 1 deletion dsppp/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@


// Allocator for temporaries
// But when in test mode (like in github action), malloc allocator is used instead
#if !defined(TESTMODE)
#if defined(POOL_ALLOCATOR)
#define TMP_ALLOC pool_allocator
#else
#define TMP_ALLOC stat_allocator
#endif
#endif

#include <dsppp/memory_pool.hpp>

Expand Down Expand Up @@ -57,6 +60,7 @@ struct pool_allocator<BYTES> {
};


#if !defined(TESTMODE)
#if defined(POOL_ALLOCATOR)
#include "allocation/all.h"
#endif
Expand Down Expand Up @@ -119,6 +123,10 @@ struct stat_allocator {

};

extern void print_map(std::string comment);
extern void check_current_stats();
extern void reset_current_stats();

#endif

extern void print_map(std::string comment);

11 changes: 3 additions & 8 deletions dsppp/cdefault.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ default:
- -DNDEBUG
- -Wall
- -Wextra
- -Werror
- -std=c11
- -Ofast
- -ffast-math
Expand All @@ -28,8 +27,6 @@ default:
- -Wno-parentheses-equality
- -Wno-reserved-identifier
- -ffunction-sections
- -Wno-nan-infinity-disabled
- -DARM_MATH_LOOPUNROLL
CPP:
- -fno-rtti
- -fno-exceptions
Expand Down Expand Up @@ -58,8 +55,7 @@ default:
- -Wdouble-promotion
- -DNDEBUG
- -Wall
- -Wextra
- -Werror
- -Wextra
- -std=c11
- -Ofast
- -ffast-math
Expand All @@ -69,11 +65,11 @@ default:
- -Wno-sign-conversion
- -Wno-unused-macros
- -ffunction-sections
- -DARM_MATH_LOOPUNROLL
- -flax-vector-conversions
- -Wno-maybe-uninitialized
- -fdata-sections
- -fno-unroll-loops
- -mfp16-format=ieee
CPP:
- -fno-rtti
- -fno-exceptions
Expand All @@ -88,6 +84,7 @@ default:
- -fdata-sections
- -Wno-psabi
- -fno-unroll-loops
- -mfp16-format=ieee
ASM:
- -masm=auto
Link:
Expand All @@ -106,7 +103,6 @@ default:
- -DNDEBUG
- -Wall
- -Wextra
- -Werror
- -std=c11
- -Ofast
- -ffast-math
Expand All @@ -123,7 +119,6 @@ default:
- -Wno-parentheses-equality
- -Wno-reserved-identifier
- -ffunction-sections
- -DARM_MATH_LOOPUNROLL
CPP:
- -fno-rtti
- -fno-exceptions
Expand Down
Loading

0 comments on commit 3be81f2

Please sign in to comment.