From ad526169386326a82a8d59bc88e727ab415cabef Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Fri, 6 Jan 2023 16:10:07 +0100 Subject: [PATCH 1/5] Change default build target to release + adding artefacts Signed-off-by: Cervenka Dusan --- .circleci/config.yml | 6 ++++++ erpcgen/Makefile | 10 +++++----- erpcgen/test/config.py | 5 ++--- erpcsniffer/Makefile | 10 +++++----- mk/flags.mk | 11 +++++------ mk/paths.mk | 2 +- test/run_unit_tests.py | 2 +- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8c39b2418..d33d8844b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,6 +8,8 @@ jobs: - checkout - run: chmod u+x install_dependencies.sh && ./install_dependencies.sh - run: chmod u+x run_tests.sh && ./run_tests.sh + - store_artifacts: + path: ./Release/Linux/erpcgen/erpcgen build-linux-clang: machine: image: ubuntu-2004:202111-02 @@ -15,6 +17,8 @@ jobs: - checkout - run: chmod u+x install_dependencies.sh && ./install_dependencies.sh clang - run: chmod u+x run_tests.sh && ./run_tests.sh clang + - store_artifacts: + path: ./Release/Linux/erpcgen/erpcgen build-mac-gcc: macos: xcode: 13.2.1 @@ -38,3 +42,5 @@ workflows: - build-linux-clang # - build-mac-gcc # Mac is on going, or it can be hosted on company computer. # - build-mac-clang + +# VS Code Extension Version: 1.5.1 diff --git a/erpcgen/Makefile b/erpcgen/Makefile index 744736a65..83ba17f2b 100644 --- a/erpcgen/Makefile +++ b/erpcgen/Makefile @@ -117,10 +117,10 @@ include $(ERPC_ROOT)/mk/targets.mk ifeq "$(is_mingw)" "1" LIBRARIES += -L$(BOOST_ROOT)/stage/lib - ifeq "$(build)" "debug" - LIBRARIES += -lboost_system-mgw48-mt-1_57 -lboost_filesystem-mgw48-mt-1_57 - else + ifeq "$(build)" "release" LIBRARIES += -lboost_system-mgw48-mt-d-1_57 -lboost_filesystem-mgw48-mt-d-1_57 + else + LIBRARIES += -lboost_system-mgw48-mt-1_57 -lboost_filesystem-mgw48-mt-1_57 endif else ifeq "$(is_linux)" "1" @@ -128,7 +128,7 @@ else endif static_libs := NO - ifneq "$(build)" "debug" + ifeq "$(build)" "release" ifeq "$(is_darwin)" "1" static_libs := $(BOOST_ROOT)/lib/libboost_system.a $(BOOST_ROOT)/lib/libboost_filesystem.a endif @@ -141,7 +141,7 @@ else endif # Release should be alwas static. Customers don't need install things. -ifneq "$(build)" "debug" +ifeq "$(build)" "release" # Except Darwin. Darwin has static libs defined above. ifeq "$(is_darwin)" "" LIBRARIES += -static diff --git a/erpcgen/test/config.py b/erpcgen/test/config.py index fdd8d0ca8..b87b23e67 100644 --- a/erpcgen/test/config.py +++ b/erpcgen/test/config.py @@ -27,9 +27,9 @@ if 'ERPCGEN' in os.environ: ERPCGEN = os.environ['ERPCGEN'] elif sys.platform == 'win32': - ERPCGEN = str(this_dir.join(r"..\VisualStudio_v14\Debug\erpcgen.exe")) + ERPCGEN = str(this_dir.join(r"..\VisualStudio_v14\Release\erpcgen.exe")) else: - ERPCGEN = str(this_dir.join("../../Debug/{}/erpcgen/erpcgen".format(os_name))) + ERPCGEN = str(this_dir.join("../../Release/{}/erpcgen/erpcgen".format(os_name))) # Set path to C/C++ compiler. if 'CC' in os.environ: @@ -39,4 +39,3 @@ # Number of test runs to keep. RUN_KEEP_COUNT = 3 - diff --git a/erpcsniffer/Makefile b/erpcsniffer/Makefile index edde8a532..d831eb469 100644 --- a/erpcsniffer/Makefile +++ b/erpcsniffer/Makefile @@ -79,10 +79,10 @@ include $(ERPC_ROOT)/mk/targets.mk ifeq "$(is_mingw)" "1" LIBRARIES += -L$(BOOST_ROOT)/stage/lib - ifeq "$(build)" "debug" - LIBRARIES += -lboost_system-mgw48-mt-1_57 -lboost_filesystem-mgw48-mt-1_57 - else + ifeq "$(build)" "release" LIBRARIES += -lboost_system-mgw48-mt-d-1_57 -lboost_filesystem-mgw48-mt-d-1_57 + else + LIBRARIES += -lboost_system-mgw48-mt-1_57 -lboost_filesystem-mgw48-mt-1_57 endif else ifeq "$(is_linux)" "1" @@ -90,7 +90,7 @@ else endif static_libs := NO - ifneq "$(build)" "debug" + ifeq "$(build)" "release" ifeq "$(is_darwin)" "1" static_libs := $(BOOST_ROOT)/lib/libboost_system.a $(BOOST_ROOT)/lib/libboost_filesystem.a endif @@ -103,7 +103,7 @@ else endif # Release should be alwas static. Customers don't need install things. -ifneq "$(build)" "debug" +ifeq "$(build)" "release" # Except Darwin. Darwin has static libs defined above. ifeq "$(is_darwin)" "" # LIBRARIES += -static diff --git a/mk/flags.mk b/mk/flags.mk index a42233de3..e187a9959 100644 --- a/mk/flags.mk +++ b/mk/flags.mk @@ -60,15 +60,14 @@ else ARFLAGS = -rcs endif -ifeq "$(build)" "debug" - DEBUG_OR_RELEASE := Debug - CFLAGS += -g3 -O0 -DDEBUG -DYYDEBUG=1 - CXXFLAGS += -g3 -O0 -DDEBUG -DYYDEBUG=1 - LDFLAGS += -else +ifeq "$(build)" "release" DEBUG_OR_RELEASE := Release CFLAGS += -Os -DNDEBUG CXXFLAGS += -Os -DNDEBUG +else + DEBUG_OR_RELEASE := Debug + CFLAGS += -g3 -O0 -DDEBUG -DYYDEBUG=1 + CXXFLAGS += -g3 -O0 -DDEBUG -DYYDEBUG=1 endif ifneq "$(is_mingw)" "1" diff --git a/mk/paths.mk b/mk/paths.mk index e30846749..f3af22f38 100644 --- a/mk/paths.mk +++ b/mk/paths.mk @@ -105,4 +105,4 @@ endif # Debug or Release # Release by default #----------------------------------------------- -build ?= debug +build ?= release diff --git a/test/run_unit_tests.py b/test/run_unit_tests.py index c043ef07f..34a703a73 100644 --- a/test/run_unit_tests.py +++ b/test/run_unit_tests.py @@ -35,7 +35,7 @@ def isTestDir(dir): testClientCommand = "run-tcp-client" testServerCommand = "run-tcp-server" transportLayer = "tcp" -target = "debug" +target = "release" # Process command line options # Check for 2 or more arguments because argv[0] is the script name From 59011403099222d4512e0ed908e2af58932cdcb2 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Fri, 6 Jan 2023 17:02:46 +0100 Subject: [PATCH 2/5] Add documentation note of new feature. Signed-off-by: Cervenka Dusan --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index acbff5141..bf384d5e4 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,10 @@ eRPC is available with an unrestrictive BSD 3-clause license. See the [LICENSE f [eRPC releases](https://github.com/EmbeddedRPC/erpc/releases) +### edge releases + +Edge releases can by found on [eRPC CircleCI](https://app.circleci.com/pipelines/github/EmbeddedRPC/erpc) webpage. Choose build of interest, then platform target and choose ARTIFACTS tab. Here you can find binary application from chosen build. + ## Documentation [Documentation](https://github.com/EmbeddedRPC/erpc/wiki) is in the `wiki` section. From 8c42a086c6e7ca69ab754045c20af7996251e7d1 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Fri, 6 Jan 2023 17:21:44 +0100 Subject: [PATCH 3/5] Added shortcut for readme topics Signed-off-by: Cervenka Dusan --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bf384d5e4..69e59179d 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,26 @@ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/EmbeddedRPC/erpc/pulls) [![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/EmbeddedRPC/erpc) +- [eRPC](#erpc) + - [About](#about) + - [Releases](#releases) + - [Edge releases](#edge-releases) + - [Documentation](#documentation) + - [Examples](#examples) + - [References](#references) + - [Directories](#directories) + - [Building and installing](#building-and-installing) + - [Requirements](#requirements) + - [Windows](#windows) + - [Linux and Cygwin](#linux-and-cygwin) + - [Mac OS X](#mac-os-x) + - [Building](#building) + - [Installing for Python](#installing-for-python) + - [Known issues and limitations](#known-issues-and-limitations) + - [Code providing](#code-providing) + +## About + eRPC (Embedded RPC) is an open source Remote Procedure Call (RPC) system for multichip embedded systems and heterogeneous multicore SoCs. Unlike other modern RPC systems, such as the excellent [Apache Thrift](http://thrift.apache.org), eRPC distinguishes itself by being designed for tightly coupled systems, using plain C for remote functions, and having a small code size (<5kB). It is not intended for high performance distributed systems over a network. @@ -82,7 +102,7 @@ eRPC is available with an unrestrictive BSD 3-clause license. See the [LICENSE f [eRPC releases](https://github.com/EmbeddedRPC/erpc/releases) -### edge releases +### Edge releases Edge releases can by found on [eRPC CircleCI](https://app.circleci.com/pipelines/github/EmbeddedRPC/erpc) webpage. Choose build of interest, then platform target and choose ARTIFACTS tab. Here you can find binary application from chosen build. From 715fd14607eb33dcba14a296936d289dd73a54d7 Mon Sep 17 00:00:00 2001 From: Dusan Cervenka Date: Mon, 9 Jan 2023 12:23:40 +0100 Subject: [PATCH 4/5] Add .circleci/config.yml Signed-off-by: Cervenka Dusan --- .circleci/config.yml | 22 ++++++++++++++-------- .travis.yml | 32 -------------------------------- install_dependencies.sh | 10 +++++----- 3 files changed, 19 insertions(+), 45 deletions(-) delete mode 100644 .travis.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index d33d8844b..8fe6101c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,8 @@ version: 2.1 jobs: build-linux-gcc: machine: - image: ubuntu-2004:202111-02 + image: ubuntu-2004:202111-02 # https://circleci.com/developer/machine/image/ubuntu-2004 + resource_class: medium steps: - checkout - run: chmod u+x install_dependencies.sh && ./install_dependencies.sh @@ -12,7 +13,8 @@ jobs: path: ./Release/Linux/erpcgen/erpcgen build-linux-clang: machine: - image: ubuntu-2004:202111-02 + image: ubuntu-2004:202111-02 # https://circleci.com/developer/machine/image/ubuntu-2004 + resource_class: medium steps: - checkout - run: chmod u+x install_dependencies.sh && ./install_dependencies.sh clang @@ -21,18 +23,24 @@ jobs: path: ./Release/Linux/erpcgen/erpcgen build-mac-gcc: macos: - xcode: 13.2.1 + xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases + resource_class: medium steps: - checkout - run: chmod u+x install_dependencies.sh && ./install_dependencies.sh - run: chmod u+x run_tests.sh && ./run_tests.sh + - store_artifacts: + path: ./Release/Darwin/erpcgen/erpcgen build-mac-clang: macos: - xcode: 13.2.1 + xcode: 12.5.1 # https://circleci.com/docs/using-macos/#supported-xcode-versions https://en.wikipedia.org/wiki/MacOS_version_history#Releases + resource_class: medium steps: - checkout - run: chmod u+x install_dependencies.sh && ./install_dependencies.sh clang - run: chmod u+x run_tests.sh && ./run_tests.sh clang + - store_artifacts: + path: ./Release/Darwin/erpcgen/erpcgen workflows: @@ -40,7 +48,5 @@ workflows: jobs: - build-linux-gcc - build-linux-clang - # - build-mac-gcc # Mac is on going, or it can be hosted on company computer. - # - build-mac-clang - -# VS Code Extension Version: 1.5.1 + - build-mac-gcc + - build-mac-clang diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f4f1c9f29..000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: cpp -sudo: required -dist: xenial -compiler: -- gcc -- clang -os: -- linux -- osx -osx_image: xcode11.6 # OS X 10.15.5 -before_install: -- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -qq; fi -- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install python3 bison flex libboost-dev libboost-filesystem-dev libboost-system-dev python3 ; fi -- if [ $TRAVIS_OS_NAME == linux ]; then pyenv install 3.5.1 ; pyenv global 3.5.1; fi -- if [ $TRAVIS_OS_NAME == osx ]; then brew update; fi -- if [ $TRAVIS_OS_NAME == osx ]; then brew install python3 bison flex -v -f 2>&1 && brew upgrade boost || true; fi -- if [ $TRAVIS_OS_NAME == osx ]; then curl "https://bootstrap.pypa.io/pip/get-pip.py" | sudo python3; fi - -install: -#- sudo pip install --upgrade pip setuptools -#- CC=gcc sudo pip install requests[security] -- if [ $TRAVIS_OS_NAME == osx ]; then sudo pip install tornado; fi -- if [ $TRAVIS_OS_NAME == osx ]; then sudo pip install --user nose; fi -- if [ $TRAVIS_OS_NAME == osx ]; then sudo pip install pytest --upgrade --ignore-installed six; fi -- if [ $TRAVIS_OS_NAME == linux ]; then sudo pip install pytest; fi -- sudo pip install pyyaml -- sudo pip install enum34 -- sudo pip install pyserial -script: -- make all -- pushd erpcgen/test ; py.test ; popd -- python3 test/run_unit_tests.py diff --git a/install_dependencies.sh b/install_dependencies.sh index 2deeda184..87d0dbe38 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -21,11 +21,11 @@ Linux*) Darwin*) echo "Mac os detected. Installing dependencies." brew update - brew install python3 bison flex -v -f 2>&1 && brew upgrade boost || true - curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" | sudo python3 - sudo pip install tornado - sudo pip install --user nose - sudo pip install pytest --upgrade --ignore-installed six + brew install python3 boost bison flex -v -f 2>&1 + sudo pip3 install tornado + sudo pip3 install --user nose + sudo pip3 install pytest --upgrade --ignore-installed six + sudo pip3 install pyyaml ;; *) echo "Unknown or currently unsupported os: ${unameOut}" From 87dd3578feb09623b0bbed7b3c5ea0e7d847c589 Mon Sep 17 00:00:00 2001 From: Cervenka Dusan Date: Mon, 9 Jan 2023 12:46:26 +0100 Subject: [PATCH 5/5] Move to g++ in pytest Signed-off-by: Cervenka Dusan --- erpcgen/test/config.py | 4 ++ erpcgen/test/conftest.py | 49 +++++++++++++------ mk/flags.mk | 4 +- .../unit_test_tcp_arbitrator_client.cpp | 4 ++ 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/erpcgen/test/config.py b/erpcgen/test/config.py index b87b23e67..ba66cadc0 100644 --- a/erpcgen/test/config.py +++ b/erpcgen/test/config.py @@ -36,6 +36,10 @@ CC = os.environ['CC'] else: CC = 'gcc' +if 'CXX' in os.environ: + CXX = os.environ['CXX'] +else: + CXX = 'g++' # Number of test runs to keep. RUN_KEEP_COUNT = 3 diff --git a/erpcgen/test/conftest.py b/erpcgen/test/conftest.py index b028cfdd0..8d9c1c48d 100644 --- a/erpcgen/test/conftest.py +++ b/erpcgen/test/conftest.py @@ -237,7 +237,8 @@ class CCompiler(object): def __init__(self, cwd=None, *args): self._cwd = cwd self._args = args - self._path = config.CC + self._pathCC = config.CC + self._pathCXX = config.CXX self._includes = [] self._sources = [] @@ -248,24 +249,40 @@ def add_source(self, path): self._sources.append(path) def run(self, captureOutput=False): + def _run(cwd, captureOutput, pytestConfig, args, compilerType): + if pytestConfig and pytestConfig.getvalue("erpcgen_log_execs"): + print(f"Calling {compilerType} compiler:", " ".join(args)) + + cwd = str(cwd) if cwd is not None else None + if captureOutput: + return subprocess.check_output(args, cwd=cwd) + else: + subprocess.check_call(args, cwd=cwd) + return None + # Enable all warnings except for unused functions. - args = [self._path, "-c", "-Wall", "-Werror", "-Wno-unused-function"] - args += self._args + defaultArgs = ["-c", "-Wall", "-Werror", "-Wno-unused-function"] + defaultArgs += self._args + argsCC = [self._pathCC, "-std=gnu11"] + defaultArgs + argsCXX = [self._pathCXX, "-std=gnu++11"] + defaultArgs + incl = [] for i in self._includes: - args += ["-I", str(i)] + incl += ["-I", str(i)] + + argsCXX+=incl + argsCC+=incl for s in self._sources: - args.append(str(s)) + if str(s).split(".")[-1] == "cpp": + argsCXX.append(str(s)) + else: + argsCC.append(str(s)) - if pytestConfig and pytestConfig.getvalue("erpcgen_log_execs"): - print("Calling C/C++ compiler:", " ".join(args)) + output = [_run(self._cwd, captureOutput, pytestConfig, argsCC, "C")] + output.append(_run(self._cwd, captureOutput, pytestConfig, argsCXX, "CXX")) - cwd = str(self._cwd) if self._cwd is not None else None - if captureOutput: - return subprocess.check_output(args, cwd=cwd) - else: - subprocess.check_call(args, cwd=cwd) + return output class ErpcgenTestException(Exception): pass @@ -694,12 +711,12 @@ def desc(self): # Verify that erpcgen and the compiler are available. def verify_tools(): - def handle_err(e, toolName, expectedPath, envName): + def handle_err(e, toolName, expectedPathCC, envNameCC, expectedPathCXX, envNameCXX): if isinstance(e, OSError): if e.errno == errno.ENOENT: print("Error: {} executable cannot be found.".format(toolName)) - print("Expected {} path: {}".format(toolName, expectedPath)) - print("To change the {} path, set the {} environment variable or create a config_local.py.".format(toolName, envName)) + print("Expected {} paths: {} and {}".format(toolName, expectedPathCC, expectedPathCXX)) + print("To change the {} path, set the {} and/or {} environment variable or create a config_local.py.".format(toolName, envNameCC, envNameCXX)) print("See readme.txt for more information.") else: print("Fatal error: OS error when verifying {} is available. [errno {}]: {}".format(toolName, @@ -719,6 +736,6 @@ def handle_err(e, toolName, expectedPath, envName): try: CCompiler(None, "--version").run(captureOutput=True) except (OSError, subprocess.CalledProcessError) as e: - handle_err(e, "compiler", config.CC, "CC") + handle_err(e, "compiler", config.CC, "CC", config.CXX, "CXX") verify_tools() diff --git a/mk/flags.mk b/mk/flags.mk index e187a9959..9c2b04e8a 100644 --- a/mk/flags.mk +++ b/mk/flags.mk @@ -28,9 +28,9 @@ else MARCH ?= # -m32 or -m64 endif -CXXFLAGS += -std=gnu++11 -D LINUX -Wunused-variable -Wno-deprecated-register -Wno-narrowing -Werror $(MARCH) +CXXFLAGS += -std=gnu++11 -Wunused-variable -Wno-deprecated-register -Wno-narrowing -Werror $(MARCH) #CXXFLAGS += -Wall -Wextra -Wshadow -pedantic-errors -CFLAGS += -std=gnu11 -D LINUX -D _GNU_SOURCE -Werror $(MARCH) +CFLAGS += -std=gnu11 -Werror $(MARCH) YYFLAGS += -Wno-other # --debug --verbose LLFLAGS += LDFLAGS += $(MARCH) diff --git a/test/common/unit_test_tcp_arbitrator_client.cpp b/test/common/unit_test_tcp_arbitrator_client.cpp index 452d9b977..9af4b2994 100644 --- a/test/common/unit_test_tcp_arbitrator_client.cpp +++ b/test/common/unit_test_tcp_arbitrator_client.cpp @@ -17,6 +17,8 @@ #include "test_firstInterface.h" #include "test_secondInterface.h" #include "unit_test.h" +#include +#include #include @@ -111,6 +113,8 @@ int main(int argc, char **argv) Log::info("Intit ERPC first (client) app...\n"); + std::chrono::milliseconds duration(500); + std::this_thread::sleep_for(duration); erpc_status_t err = g_transport.open(); if (err) {