diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..9ba0acbbec5130decc4e85d9708fc8b5a0d336b9 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,42 @@ +include: + - project: 'iopsys/gitlab-ci-pipeline' + file: '/static-code-analysis.yml' + +stages: + - static_code_analysis + - checkpatch + - functional_test + +variables: + DEBUG: 'TRUE' + SOURCE_FOLDER: "." + +run_functional_test: + stage: functional_test + image: iopsys/code-analysis-dev + allow_failure: false + script: + - "./gitlab-ci/install-dependencies.sh" + - "./gitlab-ci/setup.sh" + - "./gitlab-ci/functional-test.sh" + + artifacts: + when: always + paths: + - functional-test-coverage.xml + - timestamp.log + - coverage.tar.gz + +run_checkpatch: + stage: checkpatch + image: iopsys/code-analysis-dev + allow_failure: false + script: + - "./gitlab-ci/coding-style.sh" + + artifacts: + when: always + paths: + - functional-test-coverage.xml + - timestamp.log + - coverage.tar.gz diff --git a/gitlab-ci/coding-style.sh b/gitlab-ci/coding-style.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b45734b7eb8fe3531a87b1e08f0ea97f518b1c7 --- /dev/null +++ b/gitlab-ci/coding-style.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +DIRS="src/core src/include src/ipc src/utils " + +rm -rf coding_style.log +touch coding_style.log +for dir in $DIRS; do + scripts/checkpatch.pl -f --no-tree --no-signoff --ignore CONST_STRUCT,SPDX_LICENSE_TAG,LINE_CONTINUATIONS $dir/*.h $dir/*.c >> coding_style.log 2>1 +done + +cat coding_style.log + +cat coding_style.log | grep -q "ERROR: " + +[ "$?" == 0 ] && exit 1 + +exit 0 diff --git a/gitlab-ci/functional-test.sh b/gitlab-ci/functional-test.sh index 7b7ead977bafb9b1de62821cd5724a68757e696f..6f98250ad329c322ed03874102fce778ed88351a 100755 --- a/gitlab-ci/functional-test.sh +++ b/gitlab-ci/functional-test.sh @@ -24,9 +24,6 @@ supervisorctl status all echo "Running the unit test cases, pwd ${LIB_DIR}" #ret=$? -supervisorctl stop ubusd ieee1905d wifimngr topologyd mapagent mapcontroller -supervisorctl status all - tap_validate_md5sum() { sha1=$(md5sum "$1" | cut -d' ' -f1) sha2=$(md5sum "$2" | cut -d' ' -f1) @@ -40,6 +37,7 @@ ubus_invoke() { args=$3 ubus call $object $method $args + echo "$?" } json_load "$(cat test/api/json/mapcontroller.validation.json)" @@ -53,7 +51,12 @@ for i in $methods; do json_get_var method method json_get_var args args - ubus_invoke $object $method $args + rv=$(ubus_invoke $object $method $args) + if [ "$rv" != 0 ]; then + tap_is_str "return code: 0" "return code: $rv" "ubus call $object $method $args" + continue + fi + sleep 1 tap_validate_md5sum "$agentlog" "$cntlrlog" "$object" "$method" "$args" echo "" > "$cntlrlog" @@ -64,6 +67,10 @@ done tap_done_testing tap_finish +supervisorctl stop ubusd ieee1905d wifimngr topologyd mapagent mapcontroller +supervisorctl status all + + #report part #GitLab-CI output gcovr -r . diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh index 74e46d7f46dbf2daec6b66003c87395b2204873d..eaf28997e2cae200e021364fe6a82ee05fcc649d 100755 --- a/gitlab-ci/install-dependencies.sh +++ b/gitlab-ci/install-dependencies.sh @@ -66,10 +66,10 @@ rm -fr map-1905 git clone -b devel https://dev.iopsys.eu/iopsys/map-1905.git cd map-1905 exec_cmd make -cp -r libmaputils.so /usr/lib +mkdir -p /usr/lib/ieee1905 +cp -r libmaputils.so /usr/lib/ mkdir -p /usr/include/map1905 cp include/*.h /usr/include/map1905/ -mkdir -p /usr/lib/ieee1905 cp -r libwifimap2.so /usr/lib/ieee1905 #cd ${home} #mkdir -p /usr/lib/ieee1905 @@ -94,11 +94,10 @@ cd /opt/dev rm -fr map-agent exec_cmd git clone -b devel https://dev.iopsys.eu/iopsys/map-agent.git cd map-agent/src -git checkout ap_capabilities exec_cmd make exec_cmd cp mapagent /usr/sbin/ -# install mapagent +# install tap.sh library cd /opt/dev rm -fr tap exec_cmd git clone https://github.com/andrewgregory/tap.sh.git tap @@ -162,4 +161,4 @@ echo " config wificntlr option enabled '1' option debug '6' -" > /etc/config/controller \ No newline at end of file +" > /etc/config/controller diff --git a/gitlab-ci/iopsys-supervisord.conf b/gitlab-ci/iopsys-supervisord.conf index bed0b42d0100dde9d797c41bd033ac08f8ab89c3..3f80af5e270a73128fc09440352daae7985aceda 100644 --- a/gitlab-ci/iopsys-supervisord.conf +++ b/gitlab-ci/iopsys-supervisord.conf @@ -11,7 +11,7 @@ command=/bin/bash -c "/usr/sbin/ieee1905d" command=/bin/bash -c "/usr/sbin/topologyd" [program:mapagent] -command=/bin/bash -c "/usr/sbin/mapagent -d" +command=/bin/bash -c "/usr/sbin/mapagent -vvvvvv -d" [program:mapcontroller] -command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/map-controller/src/mapcontroller -d" +command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/map-controller/src/mapcontroller -vvvvvv -d" diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh index 3fd902b17d80dc571e6a8b25811d849fd528b0c5..8f565815ab7261a75aedfa28822cfa69f3b2ccff 100755 --- a/gitlab-ci/setup.sh +++ b/gitlab-ci/setup.sh @@ -4,6 +4,9 @@ echo "preparation script" pwd +uci set ieee1905.ieee1905.map_plugin="1" +uci commit ieee1905 + cp -r ./test/files/etc/* /etc/ cp -r ./schemas/ubus/* /usr/share/rpcd/schemas cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/ diff --git a/hooks/pre-commit b/hooks/pre-commit index 417684ed7ace780c279f61e16955ecf60c5503a3..891321c6e2a0c0424e9a38e428a47db9f4123a28 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -1,3 +1,2 @@ #!/bin/bash exec git diff --cached | scripts/checkpatch.pl --no-tree --no-signoff --ignore CONST_STRUCT,SPDX_LICENSE_TAG,LINE_CONTINUATIONS - diff --git a/src/core/cntlr_map_debug.h b/src/core/cntlr_map_debug.h index 384886c43efe8ade70b8a1228e092f20c4770c9b..a1780ea0e2c8659a5a6fab314a27768ee9ca99ad 100644 --- a/src/core/cntlr_map_debug.h +++ b/src/core/cntlr_map_debug.h @@ -24,7 +24,7 @@ int debug_sta_caps_report(void *cntlr, struct cmdu_cstruct *cmdu); int debug_ap_metrics_response(void *cntlr, struct cmdu_cstruct *cmdu); int debug_sta_link_metrics_response(void *cntlr, struct cmdu_cstruct *cmdu); int debug_unassoc_sta_link_metrics_response(void *cntlr, - struct cmdu_cstruct *cmdu); + struct cmdu_cstruct *cmdu); int debug_beacon_metrics_response(void *cntlr, struct cmdu_cstruct *cmdu); int debug_sta_steer_btm_report(void *cntlr, struct cmdu_cstruct *cmdu); int debug_sta_steer_complete(void *cntlr, struct cmdu_cstruct *cmdu); diff --git a/test/api/json/mapcontroller.validation.json b/test/api/json/mapcontroller.validation.json index 91584e837f2f3b94713ab0fd5e23d3cb92743062..263740268d10dcdb7286534c73ac846a133b14f1 100644 --- a/test/api/json/mapcontroller.validation.json +++ b/test/api/json/mapcontroller.validation.json @@ -4,10 +4,6 @@ { "method": "ap_caps", "rc": 0 - }, - { - "method": "sta_caps", - "rc": 0 } ] }