diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b8b98bf1..363ecfeb1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,18 +21,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 +46,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/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 1beb51fe5..324dd9bfc 100644 --- a/erpcgen/test/conftest.py +++ b/erpcgen/test/conftest.py @@ -258,7 +258,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 = [] @@ -269,24 +270,41 @@ 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): @@ -755,15 +773,14 @@ def desc(self): def verify_tools(): - # Verify that erpcgen and the compiler are available. - - def handle_err(e: Exception, toolName: str, expectedPath: str, envName: str): + def handle_err(e: Exception, toolName: str, expectedPathCC: str, envNameCC: str, expectedPathCXX: str, envNameCXX: str): 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, @@ -784,7 +801,7 @@ def handle_err(e: Exception, toolName: str, expectedPath: str, envName: str): 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/install_dependencies.sh b/install_dependencies.sh index efd3ee2a5..876eb892d 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -24,11 +24,11 @@ Darwin*) echo "Mac os detected." brew update echo "Installing dependencies." - 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}" 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) {