Skip to content
Snippets Groups Projects
Commit a3171f1e authored by Anjan Chanda's avatar Anjan Chanda
Browse files

gitlab-ci: initial commit

parent 1e7a4a13
No related branches found
No related tags found
No related merge requests found
Pipeline #35171 passed with warnings
#!/bin/bash
set -e
. /usr/share/libubox/jshn.sh
. /usr/bin/tap.sh
cntlrlog="/tmp/cntlr.test.log"
agentlog="/tmp/agent.test.log"
echo "preparation script"
pwd
echo "Cleaning..."
make clean
make -C test/cmocka clean
make -C src
supervisorctl status all
supervisorctl update
supervisorctl restart ubusd wifimngr ieee1905d
sleep 2
supervisorctl status all
echo "Running the unit test cases, pwd ${LIB_DIR}"
#ret=$?
tap_validate_md5sum() {
sha1=$(md5sum "$1" | cut -d' ' -f1)
sha2=$(md5sum "$2" | cut -d' ' -f1)
tap_is_str "$sha1" "$sha2" "ubus call $3 $4 $5"
}
ubus_invoke() {
object=$1
method=$2
args=$3
ubus call $object $method $args
echo "$?"
}
json_load "$(cat test/api/json/mapagent.validation.json)"
json_dump
json_get_var object object
json_get_keys methods methods
json_select methods
for i in $methods; do
json_select "$i"
json_get_var method method
json_get_var args 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"
echo "" > "$agentlog"
json_select ..
done
tap_done_testing
tap_finish
supervisorctl stop ubusd ieee1905d wifimngr
supervisorctl status all
#report part
#GitLab-CI output
gcovr -r .
# Artefact
gcovr -r . --xml -o ./unit-test-coverage.xml
date +%s > timestamp.log
#echo "$0 Return status ${ret}"
#!/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
}
exec_cmd apt update
exec_cmd apt install -y iproute2
# libwifi-6.so + libeasy.so
cd /opt/dev
rm -fr easy-soc-libs
mkdir -p /usr/include/easy
exec_cmd git clone -b devel https://dev.iopsys.eu/iopsys/easy-soc-libs.git
cd easy-soc-libs/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/
cd ../libwifi
exec_cmd make PLATFORM="test"
exec_cmd cp wifi.h /usr/include/
exec_md cp -a libwifi-6*.so* /usr/lib
# wifimngr
cd /opt/dev
rm -fr wifimngr
exec_cmd git clone -b devel https://dev.iopsys.eu/iopsys/wifimngr.git
cd wifimngr
exec_cmd ./gitlab-ci/install-dependencies.sh
exec_cmd ./gitlab-ci/setup.sh
exec_cmd make
exec_cmd cp wifimngr /usr/sbin/
# ieee1905 + map.so
cd /opt/dev
export CFLAGS="${CFLAGS} -g -Wall -g -O0"
rm -fr ieee1905
exec_cmd git clone --depth 1 -b devel https://dev.iopsys.eu/iopsys/ieee1905.git
cd ieee1905
exec_cmd ./gitlab-ci/install-dependencies.sh
exec_cmd ./gitlab-ci/setup.sh
exec_cmd make
mkdir -p /usr/include /usr/lib/ieee1905
exec_cmd cp -a cmdu.h /usr/include/
exec_cmd cp -a cmdu_ackq.h /usr/include/
exec_cmd cp -a 1905_tlvs.h /usr/include/
exec_cmd cp -a i1905_wsc.h /usr/include/
exec_cmd cp -a bufutil.h /usr/include/
exec_cmd cp -a timer_impl.h /usr/include/
exec_cmd cp -a libmidgen.so /usr/lib
exec_cmd cp -a libieee1905.so /usr/lib
exec_cmd cp -a ieee1905d /usr/sbin/
exec_cmd cp -a extensions/map/libmaputil.so /usr/lib
exec_cmd cp -a extensions/map/map.so /usr/lib
ldconfig
# mapagent
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
exec_cmd make
exec_cmd cp mapagent /usr/sbin/
# tap.sh library
cd /opt/dev
rm -fr tap
exec_cmd git clone https://github.com/andrewgregory/tap.sh.git tap
cd tap
exec_cmd cp tap.sh /usr/bin/
# default mapagent config
cat <<'EOF' > /etc/config/mapagent
config agent 'agent'
option enabled '1'
option debug '0'
option profile '2'
option brcm_setup '1'
option al_bridge 'br-lan'
#option netdev 'wl'
option discovery_proto 'static'
config controller_select
option local '1'
option id 'auto'
option probe_int '20'
option retry_int '3'
option autostart '0'
config wifi-radio
option device 'test5'
option band '5'
option steer_policy '2'
option util_threshold '200'
option rcpi_threshold '30'
option report_rcpi_threshold '0'
option rcpi_hysteresis_margin '0'
option report_util_threshold '0'
option include_sta_stats '0'
option include_sta_metric '0'
config wifi-radio
option device 'test2'
option band '2'
option steer_policy '2'
option util_threshold '200'
option rcpi_threshold '30'
option report_rcpi_threshold '0'
option rcpi_hysteresis_margin '0'
option report_util_threshold '0'
option include_sta_stats '0'
option include_sta_metric '0'
EOF
[program:ubusd]
priority=1
autorestart=false
startretries=0
command=/bin/bash -c "/usr/sbin/ubusd"
[program:wifimngr]
priority=2
autorestart=false
startretries=0
command=/bin/bash -c "/usr/sbin/wifimngr"
[program:ieee1905d]
priority=3
autorestart=false
startretries=0
command=/bin/bash -c "/usr/sbin/ieee1905d"
[program:mapagent]
priority=4
autorestart=false
startretries=0
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-agent/src/mapagent -vvvvvv -d"
#!/bin/bash
echo "preparation script"
pwd
cp -r ./test/files/etc/* /etc/
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/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment