Skip to content

Commit

Permalink
Bring parallelism into tests
Browse files Browse the repository at this point in the history
Signed-off-by: Cervenka Dusan <[email protected]>
  • Loading branch information
Hadatko committed Sep 25, 2023
1 parent 78569ac commit 3819a65
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 17 deletions.
84 changes: 76 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,99 @@ version: 2.1
orbs:
win: circleci/[email protected] # The Windows orb gives you everything you need to start using the

commands:
install_dependencies:
parameters:
compiler:
default: ""
type: string
steps:
- run: chmod u+x install_dependencies.sh && ./install_dependencies.sh <<parameters.compiler>>
compile_tests:
parameters:
compiler:
default: ""
type: string
steps:
- run: chmod u+x compile_tests.sh && ./compile_tests.sh <<parameters.compiler>>
run_tests:
steps:
- run: pytest erpcgen/test/
- run: python3 test/run_unit_tests.py

jobs:
build-linux-gcc:
machine:
image: ubuntu-2204:2022.04.2 #https://circleci.com/developer/machine/image/ubuntu-2204 pick LTS
steps:
- checkout
- run: chmod u+x install_dependencies.sh && ./install_dependencies.sh
- run: chmod u+x run_tests.sh && ./run_tests.sh
- install_dependencies
- compile_tests
- store_artifacts:
path: ./Release/Linux/erpcgen/erpcgen
test-linux-gcc:
machine:
image: ubuntu-2204:2022.04.2 #https://circleci.com/developer/machine/image/ubuntu-2204 pick LTS
parallelism: 2
steps:
- checkout
- run_tests

build-linux-clang:
machine:
image: ubuntu-2204:2022.04.2 #https://circleci.com/developer/machine/image/ubuntu-2204 pick LTS
steps:
- checkout
- run: chmod u+x install_dependencies.sh && ./install_dependencies.sh clang
- run: chmod u+x run_tests.sh && ./run_tests.sh clang
- install_dependencies:
compiler: "clang"
- compile_tests:
compiler: "clang"
# - store_artifacts:
# path: ./Release/Linux/erpcgen/erpcgen
test-linux-clang:
machine:
image: ubuntu-2204:2022.04.2 #https://circleci.com/developer/machine/image/ubuntu-2204 pick LTS
parallelism: 2
steps:
- checkout
- run_tests

build-mac-gcc:
macos:
xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases
resource_class: macos.x86.medium.gen2
steps:
- checkout
- run: chmod u+x install_dependencies.sh && ./install_dependencies.sh
- run: chmod u+x run_tests.sh && ./run_tests.sh
- install_dependencies
- compile_tests
- store_artifacts:
path: ./Release/Darwin/erpcgen/erpcgen
test-mac-gcc:
macos:
xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases
parallelism: 2
steps:
- checkout
- run_tests

build-mac-clang:
macos:
xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases
resource_class: macos.x86.medium.gen2
steps:
- checkout
- run: chmod u+x install_dependencies.sh && ./install_dependencies.sh clang
- run: chmod u+x run_tests.sh && ./run_tests.sh clang
- install_dependencies:
compiler: "clang"
- compile_tests:
compiler: "clang"
test-mac-clang:
macos:
xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases
parallelism: 2
steps:
- checkout
- run_tests

# - store_artifacts:
# path: ./Release/Darwin/erpcgen/erpcgen
build-windows-mingw:
Expand Down Expand Up @@ -70,8 +126,20 @@ workflows:
build-workflow:
jobs:
- build-linux-gcc
- test-linux-gcc:
requires:
- build-linux-gcc
- build-linux-clang
- test-linux-clang:
requires:
- build-linux-clang
- build-mac-gcc
- test-mac-gcc:
requires:
- build-mac-gcc
- build-mac-clang
- test-mac-clang:
requires:
- build-mac-clang
- build-windows-mingw
- build-windows-VS
13 changes: 13 additions & 0 deletions compile_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# exit when any command fails
set -e

make clean
if [ "$1" = "clang" ]; then
echo "Compiling by clang compiler."
CC=clang CXX=clang++ make all
else
echo "Compiling by default gnu compiler."
CC=gcc CXX=g++ make all
fi
9 changes: 0 additions & 9 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,5 @@
# exit when any command fails
set -e

make clean
if [ "$1" = "clang" ]; then
echo "Compiling by clang compiler."
CC=clang CXX=clang++ make all
else
echo "Compiling by default gnu compiler."
CC=gcc CXX=g++ make all
fi

pytest erpcgen/test/
python3 test/run_unit_tests.py

0 comments on commit 3819a65

Please sign in to comment.