diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ba56965..7855e6e4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ include: variables: DEBUG: 'TRUE' SOURCE_FOLDER: "." - COMMON_IMAGE: iopsys/code-analysis:0.26 + COMMON_IMAGE: iopsys/code-analysis:0.27 RUN_CPPCHECK: "cppcheck --enable=style --error-exitcode=1 --inline-suppr --include=/usr/local/include/json-c/json_object.h --include=/usr/include/libubox/list.h -I . -I ./include/ -I ./libbbf_api/ -i test/ -DBBF_VENDOR_IOPSYS -DBBF_VENDOR_OPENWRT" stages: @@ -78,13 +78,16 @@ run_memory_test: script: - "./gitlab-ci/setup.sh" - "./gitlab-ci/memory-test.sh" - + - echo "BBF_TAR_URL=${CI_JOB_URL}/artifacts/raw/build/libbbf-1.0.0-Linux.sh" >build.env artifacts: + reports: + dotenv: build.env when: always paths: - timestamp.log - memory-test-coverage.xml - bbf_out.zip + - build/libbbf-1.0.0-Linux.sh doxygen: stage: unit_test @@ -110,8 +113,12 @@ run_uspd: variables: false variables: UPSTREAM_BBF_SHA: $CI_COMMIT_SHA + BBF_TAR_URL: $BBF_TAR_URL allow_failure: false trigger: project: iopsys/uspd branch: bbf_pipeline strategy: depend + needs: + job: run_memory_test + artifacts: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cc6103d..1e4f16f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ ADD_DEFINITIONS(-Wall -Werror) ADD_DEFINITIONS(-D_GNU_SOURCE) ADD_DEFINITIONS(-DBBF_VENDOR_PREFIX="${BBF_VENDOR_PREFIX}") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I. -I./dmtree -I./dmtree/tr181 -I./dmtree/tr104 -I./dmtree/tr143") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_DIR}/dmtree") OPTION(BBF_TR181 "build with tr181 datamodel" ON) OPTION(BBF_TR104 "build with tr104 datamodel" ON) @@ -24,21 +24,22 @@ ENDIF() FILE(GLOB BBF_API_SOURCES ${PROJECT_SOURCE_DIR}/libbbf_api/*.c) -SET(BBF_DM_SOURCES dmentry.c - dmdiagnostics.c - dmbbfcommon.c) +SET(BBF_DM_SOURCES dmentry.c dmdiagnostics.c dmbbfcommon.c) IF(BBF_TR181) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr181") FILE(GLOB BBF_TR181_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr181/*.c) add_compile_definitions(BBF_TR181) ENDIF(BBF_TR181) IF(BBF_TR104) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr104") FILE(GLOB BBF_TR104_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr104/*.c) add_compile_definitions(BBF_TR104) ENDIF(BBF_TR104) IF(BBF_TR143) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr143") FILE(GLOB BBF_TR143_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr143/*.c) add_compile_definitions(BBF_TR143) ENDIF(BBF_TR143) @@ -95,30 +96,39 @@ ADD_LIBRARY(bbfdm SHARED ${BBF_API_SOURCES} ${BBF_DM_SOURCES} TARGET_LINK_LIBRARIES(bbfdm uci ubus ubox json-c blobmsg_json trace dl curl ${SSL_LIBS}) INSTALL(TARGETS bbfdm - LIBRARY DESTINATION "/usr/lib") + LIBRARY DESTINATION usr/lib) -INSTALL(DIRECTORY DESTINATION "/etc/bbfdm") -INSTALL(DIRECTORY DESTINATION "/etc/bbfdm/dmmap") -INSTALL(DIRECTORY DESTINATION "/etc/bbfdm/json") -INSTALL(DIRECTORY DESTINATION "/usr/share/bbfdm") -INSTALL(DIRECTORY DESTINATION "/usr/lib/bbfdm") +INSTALL(DIRECTORY DESTINATION etc/bbfdm) +INSTALL(DIRECTORY DESTINATION etc/bbfdm/dmmap) +INSTALL(DIRECTORY DESTINATION etc/bbfdm/json) +INSTALL(DIRECTORY DESTINATION usr/share/bbfdm) +INSTALL(DIRECTORY DESTINATION usr/lib/bbfdm) FILE(GLOB headers include/*.h) INSTALL(FILES ${headers} - DESTINATION include + DESTINATION usr/include ) FILE(GLOB libbbf_api_headers libbbf_api/*.h) INSTALL(FILES ${libbbf_api_headers} - DESTINATION include/libbbf_api + DESTINATION usr/include/libbbf_api ) FILE(GLOB libbbfdm_headers *.h) INSTALL(FILES ${libbbfdm_headers} - DESTINATION include/libbbfdm + DESTINATION usr/include/libbbfdm ) FILE(GLOB scripts scripts/*) INSTALL(FILES ${scripts} - DESTINATION "/usr/share/bbfdm" + DESTINATION usr/share/bbfdm ) + +# add CPack to project +SET(CPACK_PACKAGE_NAME "libbbf") +SET(CPACK_PACKAGE_VENDOR "iopsys.io") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libbbf - Datamodel library") +SET(CPACK_PACKAGE_VERSION "1.0.0") +SET(CPACK_GENERATOR STGZ) + +include(CPack) diff --git a/dmtree/tr104/common.c b/dmtree/tr104/common.c index 148d8561..027a64ea 100644 --- a/dmtree/tr104/common.c +++ b/dmtree/tr104/common.c @@ -8,7 +8,6 @@ * Author: Yalu Zhang, yalu.zhang@iopsys.eu */ -#include "dmentry.h" #include "common.h" char *RFPowerControl[] = {"Normal", "Reduced", NULL}; @@ -20,7 +19,7 @@ char *KeyingMethods[] = {"Null", "Static", "SDP", "IKE", NULL}; char *FacilityAction[] = {"AA_REGISTER", "AA_ERASE", "AA_INTERROGATE", "CA_ACTIVATE", "CCBS_ACTIVATE", "CCBS_DEACTIVATE", "CCBS_INTERROGATE", "CCNR_ACTIVATE", "CCNR_DEACTIVATE", "CCNR_INTERROGATE", "CFB_REGISTER", "CFB_ACTIVATE", "CFB_DEACTIVATE", "CFB_ERASE", "CFB_INTERROGATE", "CFNR_REGISTER", "CFNR_ACTIVATE", "CFNR_DEACTIVATE", "CFNR_ERASE", "CFNR_INTERROGATE", "CFNR_TIMER", "CFT_ACTIVATE", "CFT_DEACTIVATE", "CFT_INTERROGATE", "CFU_REGISTER", "CFU_ACTIVATE", "CFU_DEACTIVATE", "CFU_ERASE", "CFU_INTERROGATE", "CLIR_ACTIVATE", "CLIR_DEACTIVATE", "CLIR_INTERROGATE", "CP_INVOKE", "CW_ACTIVATE", "CW_DEACTIVATE", "CW_INVOKE", "DND_ACTIVATE", "DND_DEACTIVATE", "DND_INTERROGATE", "EXT_INVOKE", "LINE_INVOKE", "MAILBOX_INVOKE", "OCB_ACTIVATE", "OCB_DEACTIVATE", "OCB_INTERROGATE", "PSO_ACTIVATE", "PW_SET", "SCF_ACTIVATE", "SCF_DEACTIVATE", "SCF_INTERROGATE", "SCREJ_ACTIVATE", "SCREJ_DEACTIVATE", "SCREJ_INTERROGATE", "SR_ACTIVATE", "SR_DEACTIVATE", "SR_INTERROGATE", NULL}; struct codec_info supported_codecs[MAX_SUPPORTED_CODECS]; int codecs_num; - +extern struct list_head main_memhead; LIST_HEAD(call_log_list); static struct stat prev_stat = { 0 }; static int call_log_list_size = 0; diff --git a/dmtree/tr104/servicesvoiceservicecallcontrol.c b/dmtree/tr104/servicesvoiceservicecallcontrol.c index 4c701893..f5057142 100644 --- a/dmtree/tr104/servicesvoiceservicecallcontrol.c +++ b/dmtree/tr104/servicesvoiceservicecallcontrol.c @@ -11,7 +11,6 @@ #include "servicesvoiceservice.h" #include "servicesvoiceservicecallcontrol.h" #include "common.h" -#include "dmentry.h" /************************************************************************** * LINKER diff --git a/dmtree/tr104/servicesvoiceservicecodecprofile.c b/dmtree/tr104/servicesvoiceservicecodecprofile.c index f4b28698..171d9e6a 100644 --- a/dmtree/tr104/servicesvoiceservicecodecprofile.c +++ b/dmtree/tr104/servicesvoiceservicecodecprofile.c @@ -8,7 +8,6 @@ * Author: Yalu Zhang, yalu.zhang@iopsys.eu */ -#include "dmentry.h" #include "servicesvoiceservicecodecprofile.h" #include "common.h" diff --git a/dmtree/tr104/servicesvoiceservicesip.c b/dmtree/tr104/servicesvoiceservicesip.c index e6be17e8..b2030586 100644 --- a/dmtree/tr104/servicesvoiceservicesip.c +++ b/dmtree/tr104/servicesvoiceservicesip.c @@ -11,7 +11,6 @@ #include "servicesvoiceservice.h" #include "servicesvoiceservicesip.h" #include "common.h" -#include "dmentry.h" /************************************************************************** * LINKER diff --git a/dmtree/tr143/diagnostics.c b/dmtree/tr143/diagnostics.c index b06a867a..ffe91786 100644 --- a/dmtree/tr143/diagnostics.c +++ b/dmtree/tr143/diagnostics.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "dmdiagnostics.h" #include "dmbbfcommon.h" #include "diagnostics.h" diff --git a/dmtree/tr181/atm.c b/dmtree/tr181/atm.c index cf0fe4ed..0397d63a 100644 --- a/dmtree/tr181/atm.c +++ b/dmtree/tr181/atm.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "atm.h" struct atm_args diff --git a/dmtree/tr181/bridging.c b/dmtree/tr181/bridging.c index 6d24824c..1c4a7eba 100644 --- a/dmtree/tr181/bridging.c +++ b/dmtree/tr181/bridging.c @@ -9,7 +9,6 @@ * Author: Amin Ben Ramdhane * */ -#include "dmentry.h" #include "bridging.h" struct bridge_args diff --git a/dmtree/tr181/deviceinfo.c b/dmtree/tr181/deviceinfo.c index a22b384a..5d3b35bb 100644 --- a/dmtree/tr181/deviceinfo.c +++ b/dmtree/tr181/deviceinfo.c @@ -12,10 +12,10 @@ #include "dmdiagnostics.h" #include "deviceinfo.h" -#include "dmentry.h" + +extern struct list_head main_memhead; LIST_HEAD(process_list); - static int process_count = 0; #define PROCPS_BUFSIZE 1024 diff --git a/dmtree/tr181/dhcpv4.c b/dmtree/tr181/dhcpv4.c index 5335bb8d..9d8a9606 100644 --- a/dmtree/tr181/dhcpv4.c +++ b/dmtree/tr181/dhcpv4.c @@ -11,7 +11,6 @@ * */ -#include "dmentry.h" #include "dhcpv4.h" #define DHCP_OPTION_VENDORID 60 diff --git a/dmtree/tr181/dhcpv6.c b/dmtree/tr181/dhcpv6.c index 5ea281cc..1f01341f 100644 --- a/dmtree/tr181/dhcpv6.c +++ b/dmtree/tr181/dhcpv6.c @@ -9,7 +9,6 @@ * Author: Amin Ben Ramdhane */ -#include "dmentry.h" #include "dhcpv4.h" #include "dhcpv6.h" diff --git a/dmtree/tr181/dns.c b/dmtree/tr181/dns.c index 37aa734e..3f5f4061 100644 --- a/dmtree/tr181/dns.c +++ b/dmtree/tr181/dns.c @@ -8,7 +8,6 @@ * Author: Amin Ben Ramdhane */ -#include "dmentry.h" #include "dmdiagnostics.h" #include "dmbbfcommon.h" #include "dns.h" diff --git a/dmtree/tr181/dsl.c b/dmtree/tr181/dsl.c index 5c8568ce..15ad6638 100644 --- a/dmtree/tr181/dsl.c +++ b/dmtree/tr181/dsl.c @@ -8,7 +8,6 @@ * Author: AMIN Ben Ramdhane */ -#include "dmentry.h" #include "dsl.h" struct dsl_line_args diff --git a/dmtree/tr181/dynamicdns.c b/dmtree/tr181/dynamicdns.c index 6cecf183..664b40ce 100644 --- a/dmtree/tr181/dynamicdns.c +++ b/dmtree/tr181/dynamicdns.c @@ -8,7 +8,6 @@ * Author: Amin Ben Ramdhane */ -#include "dmentry.h" #include "dynamicdns.h" #define DDNS_SERVICES_DEFAULT "/usr/share/ddns/default" diff --git a/dmtree/tr181/ethernet.c b/dmtree/tr181/ethernet.c index 15192e7b..2d7a6b1b 100644 --- a/dmtree/tr181/ethernet.c +++ b/dmtree/tr181/ethernet.c @@ -10,7 +10,6 @@ * */ -#include "dmentry.h" #include "ethernet.h" struct eth_port_args diff --git a/dmtree/tr181/fast.c b/dmtree/tr181/fast.c index 4e480e74..372f175b 100644 --- a/dmtree/tr181/fast.c +++ b/dmtree/tr181/fast.c @@ -8,7 +8,6 @@ * Author: Jani Juvan */ -#include "dmentry.h" #include "dsl.h" #include "fast.h" diff --git a/dmtree/tr181/firewall.c b/dmtree/tr181/firewall.c index d6daef25..eb5b018d 100644 --- a/dmtree/tr181/firewall.c +++ b/dmtree/tr181/firewall.c @@ -9,7 +9,6 @@ * Author: Amin Ben Ramdhane */ -#include "dmentry.h" #include "firewall.h" /************************************************************* diff --git a/dmtree/tr181/hosts.c b/dmtree/tr181/hosts.c index f2dababb..2f2a702f 100644 --- a/dmtree/tr181/hosts.c +++ b/dmtree/tr181/hosts.c @@ -9,7 +9,6 @@ */ #include "hosts.h" -#include "dmentry.h" /************************************************************* * ENTRY METHOD diff --git a/dmtree/tr181/ieee1905.c b/dmtree/tr181/ieee1905.c index 5261a7b5..8860f803 100644 --- a/dmtree/tr181/ieee1905.c +++ b/dmtree/tr181/ieee1905.c @@ -9,7 +9,6 @@ * Author: Nevadita Chatterjee */ -#include "dmentry.h" #include "ieee1905.h" struct ieee1905_device_nonieee1905neighbor_args diff --git a/dmtree/tr181/interfacestack.c b/dmtree/tr181/interfacestack.c index b868d06b..7fe71c32 100644 --- a/dmtree/tr181/interfacestack.c +++ b/dmtree/tr181/interfacestack.c @@ -8,7 +8,6 @@ * Author: Amin Ben Ramdhane */ -#include "dmentry.h" #include "ethernet.h" #include "interfacestack.h" diff --git a/dmtree/tr181/ip.c b/dmtree/tr181/ip.c index 49b4e7a9..7306ef76 100644 --- a/dmtree/tr181/ip.c +++ b/dmtree/tr181/ip.c @@ -12,7 +12,6 @@ #include "ppp.h" #include "ip.h" -#include "dmentry.h" #ifdef BBF_TR143 #include "diagnostics.h" #endif diff --git a/dmtree/tr181/nat.c b/dmtree/tr181/nat.c index 4e965eaa..b3f5117b 100644 --- a/dmtree/tr181/nat.c +++ b/dmtree/tr181/nat.c @@ -10,7 +10,6 @@ * */ -#include "dmentry.h" #include "nat.h" /************************************************************* diff --git a/dmtree/tr181/ppp.c b/dmtree/tr181/ppp.c index d3367b22..b4a3cac9 100644 --- a/dmtree/tr181/ppp.c +++ b/dmtree/tr181/ppp.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "ppp.h" struct ppp_args diff --git a/dmtree/tr181/ptm.c b/dmtree/tr181/ptm.c index 1608f7ef..da4dc8aa 100644 --- a/dmtree/tr181/ptm.c +++ b/dmtree/tr181/ptm.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "atm.h" #include "ptm.h" diff --git a/dmtree/tr181/qos.c b/dmtree/tr181/qos.c index 2ce47da3..8c03bbc8 100644 --- a/dmtree/tr181/qos.c +++ b/dmtree/tr181/qos.c @@ -9,7 +9,6 @@ * Author: Rohit Topno */ -#include "dmentry.h" #include "qos.h" /************************************************************* diff --git a/dmtree/tr181/qos.h b/dmtree/tr181/qos.h index 79b55273..78924630 100644 --- a/dmtree/tr181/qos.h +++ b/dmtree/tr181/qos.h @@ -12,7 +12,6 @@ #define __QOS_H #include "libbbf_api/dmcommon.h" -#include "dmentry.h" extern DMOBJ tQoSObj[]; extern DMLEAF tQoSParams[]; diff --git a/dmtree/tr181/routing.c b/dmtree/tr181/routing.c index b5d65ed0..745d5e8b 100644 --- a/dmtree/tr181/routing.c +++ b/dmtree/tr181/routing.c @@ -10,7 +10,6 @@ * */ -#include "dmentry.h" #include "routing.h" struct proc_routing { diff --git a/dmtree/tr181/upnp.c b/dmtree/tr181/upnp.c index 3f8bfe13..975f33bb 100644 --- a/dmtree/tr181/upnp.c +++ b/dmtree/tr181/upnp.c @@ -9,7 +9,6 @@ * Author: Imen Bhiri */ -#include "dmentry.h" #include "upnp.h" struct upnpdiscovery { diff --git a/dmtree/tr181/usb.c b/dmtree/tr181/usb.c index 4f00e593..b437a7dd 100644 --- a/dmtree/tr181/usb.c +++ b/dmtree/tr181/usb.c @@ -8,7 +8,6 @@ * Author: Omar Kallel */ -#include "dmentry.h" #include "usb.h" #define SYSFS_USB_DEVICES_PATH "/sys/bus/usb/devices" diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index bea92c45..74664de5 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -12,7 +12,6 @@ * */ -#include "dmentry.h" #include "wifi.h" struct wifi_radio_args diff --git a/dmtree/vendor/iopsys/tr181/times.c b/dmtree/vendor/iopsys/tr181/times.c index 91993f68..f3399f5c 100644 --- a/dmtree/vendor/iopsys/tr181/times.c +++ b/dmtree/vendor/iopsys/tr181/times.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "times.h" static int get_local_time_zone_name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) diff --git a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c index 28bd2f8c..5dd2c4be 100644 --- a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c +++ b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "x_iopsys_eu_igmp.h" static void get_mcast_iface_key(char *p_ifname, char *key, size_t key_size) diff --git a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c index 103df372..80da7e1e 100644 --- a/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c +++ b/dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c @@ -9,7 +9,6 @@ * */ -#include "dmentry.h" #include "x_iopsys_eu_mld.h" #include "x_iopsys_eu_igmp.h" diff --git a/gitlab-ci/memory-test.sh b/gitlab-ci/memory-test.sh index cf970d2c..c218ceb9 100755 --- a/gitlab-ci/memory-test.sh +++ b/gitlab-ci/memory-test.sh @@ -78,4 +78,7 @@ gcovr -r . 2> /dev/null #throw away stderr # Artefact gcovr -r . 2> /dev/null --xml -o ./memory-test-coverage.xml +echo "Generating release" +generate_release + echo "Memory Test :: PASS" diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh index 1059f19f..10e5425e 100755 --- a/gitlab-ci/shared.sh +++ b/gitlab-ci/shared.sh @@ -57,6 +57,13 @@ function install_wolfssl() cd ${CUR} } +function generate_release() +{ + cd build + cpack + cd .. +} + function install_libbbf() { COV_CFLAGS='-fprofile-arcs -ftest-coverage' @@ -65,17 +72,18 @@ function install_libbbf() VENDOR_PREFIX='X_IOPSYS_EU_' echo "Compiling libbbf" - if [ -f Makefile ]; then - make clean - rm -rf CMakeFiles CMakeCache.txt cmake_install.cmake - rm -f *.log *.xml + if [ -d build ]; then + rm -rf build fi - cmake CMakeLists.txt -DCMAKE_C_FLAGS="$COV_CFLAGS " -DCMAKE_EXE_LINKER_FLAGS="$COV_LDFLAGS" -DBBF_TR181=ON -DBBF_TR104=ON -DBBF_TR143=ON -DWITH_OPENSSL=ON -DBBF_JSON_PLUGIN=ON -DBBF_DOTSO_PLUGIN=ON -DBBF_VENDOR_EXTENSION=ON -DBBF_VENDOR_LIST="$VENDOR_LIST" -DBBF_VENDOR_PREFIX="$VENDOR_PREFIX" - exec_cmd make + mkdir -p build + cd build + cmake ../ -DCMAKE_C_FLAGS="$COV_CFLAGS " -DCMAKE_EXE_LINKER_FLAGS="$COV_LDFLAGS" -DBBF_TR181=ON -DBBF_TR104=ON -DBBF_TR143=ON -DWITH_OPENSSL=ON -DBBF_JSON_PLUGIN=ON -DBBF_DOTSO_PLUGIN=ON -DBBF_VENDOR_EXTENSION=ON -DBBF_VENDOR_LIST="$VENDOR_LIST" -DBBF_VENDOR_PREFIX="$VENDOR_PREFIX" -DCMAKE_INSTALL_PREFIX=/ + exec_cmd_verbose make echo "installing libbbf" - exec_cmd make install + exec_cmd_verbose make install + cd .. } function install_libbbf_test()