From d777636ca43302a95e571ab030ec44ef50905570 Mon Sep 17 00:00:00 2001 From: Rahul Thakur <rahul.thakur@iopsys.eu> Date: Mon, 8 May 2023 04:38:38 +0000 Subject: [PATCH] libethernet: setup static code analysis --- .gitlab-ci.yml | 25 +++++++++++++++++++++++++ gitlab-ci/build.sh | 5 +++++ gitlab-ci/install-dependencies.sh | 26 ++++++++++++++++++++++++++ gitlab-ci/iopsys-supervisord.conf | 5 +++++ gitlab-ci/setup.sh | 12 ++++++++++++ linux/common/common_eth.c | 3 ++- 6 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100755 gitlab-ci/build.sh create mode 100755 gitlab-ci/install-dependencies.sh create mode 100644 gitlab-ci/iopsys-supervisord.conf create mode 100755 gitlab-ci/setup.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..4a08067 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +include: + - project: 'iopsys/gitlab-ci-pipeline' + file: '/static-code-analysis.yml' + ref: '0.28' + +stages: + - static_code_analysis + - compile_test + #- unit_test + #- functional_test + #- api_test + +variables: + DEBUG: 'TRUE' + SOURCE_FOLDER: "." + RUN_CPPCHECK: "cppcheck --enable=all --error-exitcode=1 --suppress=missingInclude --suppress=unusedFunction --suppress=unreadVariable --suppress=variableScope --suppress=redundantInitialization --suppress=unusedLabel --suppress=unusedStructMember --suppress=knownConditionTrueFalse --suppress=unmatchedSuppression -i test_stub/" + +run_compile_test: + stage: compile_test + image: ${COMMON_IMAGE} + allow_failure: false + script: + - "./gitlab-ci/install-dependencies.sh" + - "./gitlab-ci/build.sh" + diff --git a/gitlab-ci/build.sh b/gitlab-ci/build.sh new file mode 100755 index 0000000..76b05d4 --- /dev/null +++ b/gitlab-ci/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e +echo "build stage" +pwd +make diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh new file mode 100755 index 0000000..f86d6b6 --- /dev/null +++ b/gitlab-ci/install-dependencies.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo "install dependencies" + +home=$(pwd) + +function exec_cmd() +{ + echo "executing $@" + $@ >/dev/null 2>&1 + local ret=$? + + if [ "${ret}" -ne 0 ]; then + echo "Failed to execute $@ ret (${ret})" + exit 1 + fi +} + +# libeasy.so +rm -fr libeasy +mkdir -p /usr/include/easy +exec_cmd git clone -b devel https://dev.iopsys.eu/hal/libeasy.git +cd libeasy +exec_cmd make CFLAGS+="-I/usr/include/libnl3" +exec_cmd cp -a libeasy*.so* /usr/lib +exec_cmd cp -a easy.h event.h utils.h if_utils.h debug.h hlist.h /usr/include/easy/ diff --git a/gitlab-ci/iopsys-supervisord.conf b/gitlab-ci/iopsys-supervisord.conf new file mode 100644 index 0000000..63a02de --- /dev/null +++ b/gitlab-ci/iopsys-supervisord.conf @@ -0,0 +1,5 @@ +[program:ubusd] +priority=1 +autorestart=false +startretries=0 +command=/bin/bash -c "/usr/sbin/ubusd" diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh new file mode 100755 index 0000000..19e9cb9 --- /dev/null +++ b/gitlab-ci/setup.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +echo "preparation script" + +pwd + +cp -r ./schemas/ubus/* /usr/share/rpcd/schemas +cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/ + +ls /etc/config/ +ls /usr/share/rpcd/schemas/ +ls /etc/supervisor/conf.d/ diff --git a/linux/common/common_eth.c b/linux/common/common_eth.c index 3b1c12a..c249c38 100644 --- a/linux/common/common_eth.c +++ b/linux/common/common_eth.c @@ -48,6 +48,7 @@ const struct eth_ops mtk_eth_ops = { .ifname = "lan", .get_stats = mtk_eth_get_stats, .get_rmon_stats = mtk_eth_get_rmon_stats, +}; #elif defined(IOPSYS_LINUX) const struct eth_ops linux_eth_ops = { .ifname = "eth", @@ -58,5 +59,5 @@ const struct eth_ops linux_eth_ops = { .reset_phy = linux_eth_reset_phy, .get_stats = linux_eth_get_stats, .get_rmon_stats = linux_eth_get_rmon_stats, -#endif }; +#endif -- GitLab