ci: add 'fastnetmon subfolder build' step
All checks were successful
continuous-integration/drone/push Build is passing

build fnm in 'build' subfolder and run ldd on artifacts
* fix most obvious insufficiencies in fastnetmon_tests.cpp
This commit is contained in:
surtur 2021-05-04 04:12:28 +02:00
parent eeb14027d2
commit 3528ee7767
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 49 additions and 6 deletions

@ -124,6 +124,25 @@ steps:
status: [success, failure] status: [success, failure]
depends_on: [build fastnetmon] depends_on: [build fastnetmon]
- name: fastnetmon subfolder build
pull: if-not-exists
image: immawanderer/archlinux-cdev:latest
volumes:
- name: usrcache
path: /usr
commands:
- export MAKEFLAGS="$MAKEFLAGS -j$(nproc)"
- mkdir -pv src/build && cd src/build
- cmake -D"USE_NEW_ATOMIC_BUILTINS=ON" -D"ENABLE_AFPACKET_SUPPORT=ON" -D"ENABLE_GOBGP_SUPPORT=ON" -D"BUILD_PLUGIN_RUNNER=ON" -D"BUILD_TESTS=OFF" -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Wall -Wextra" -S.. -B.
- ls -lah
- make clean fastnetmon all
- ldd fastnetmon
- ldd fastnetmon_api_client
- ldd fastnetmon_client
when:
status: [success, failure]
depends_on: [build fastnetmon explicit features]
volumes: volumes:
- name: usrcache - name: usrcache
temp: {} temp: {}
@ -242,6 +261,27 @@ steps:
status: [success, failure] status: [success, failure]
depends_on: [build fastnetmon] depends_on: [build fastnetmon]
- name: fastnetmon subfolder build
pull: if-not-exists
image: fedora:34
volumes:
- name: etc
path: /etc
- name: usrcache
path: /usr
commands:
- export MAKEFLAGS="$MAKEFLAGS -j$(nproc)"
- mkdir -pv src/build && cd src/build
- cmake -D"USE_NEW_ATOMIC_BUILTINS=ON" -D"ENABLE_AFPACKET_SUPPORT=ON" -D"ENABLE_GOBGP_SUPPORT=ON" -D"BUILD_PLUGIN_RUNNER=ON" -D"BUILD_TESTS=OFF" -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS -Wall -Wextra" --clean-first -S .. -B.
- ls -lah
- make clean fastnetmon all
- ldd fastnetmon
- ldd fastnetmon_api_client
- ldd fastnetmon_client
when:
status: [success, failure]
depends_on: [build fastnetmon explicit features]
volumes: volumes:
- name: usrcache - name: usrcache
temp: {} temp: {}

@ -1,11 +1,14 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <math.h> #include <math.h>
#include "bgp_flow_spec.h" /* bgp_flow_spec.{cpp,h} has been renamed to bgp_protocol.{cpp,hpp} in
* a7357e3ee06a5ca6f7e200e66d9d9183bba26ef0 */
#include "bgp_protocol.hpp"
#include "fast_library.h" #include "fast_library.h"
#include <fstream> #include <fstream>
#include "fastnetmon_types.h"
#include "log4cpp/Appender.hh" #include "log4cpp/Appender.hh"
#include "log4cpp/BasicLayout.hh" #include "log4cpp/BasicLayout.hh"
#include "log4cpp/Category.hh" #include "log4cpp/Category.hh"
@ -435,7 +438,7 @@ TEST(patricia, positive_lookup_ipv6_prefix) {
} }
TEST(serialize_attack_description, blank_attack) { TEST(serialize_attack_description, blank_attack) {
attack_details current_attack; attack_details_t current_attack;
std::string result = serialize_attack_description(current_attack); std::string result = serialize_attack_description(current_attack);
EXPECT_EQ( EXPECT_EQ(
result, result,
@ -458,7 +461,7 @@ TEST(serialize_attack_description, blank_attack) {
} }
TEST(serialize_attack_description_to_json, blank_attack) { TEST(serialize_attack_description_to_json, blank_attack) {
attack_details current_attack; attack_details_t current_attack;
json_object* jobj = serialize_attack_description_to_json(current_attack); json_object* jobj = serialize_attack_description_to_json(current_attack);
EXPECT_EQ(std::string(json_object_to_json_string(jobj)), EXPECT_EQ(std::string(json_object_to_json_string(jobj)),
@ -479,7 +482,7 @@ TEST(serialize_attack_description_to_json, blank_attack) {
} }
TEST(serialize_network_load_to_text, blank_attck_average) { TEST(serialize_network_load_to_text, blank_attck_average) {
map_element network_speed_meter; map_element_t network_speed_meter;
EXPECT_EQ(serialize_network_load_to_text(network_speed_meter, true), EXPECT_EQ(serialize_network_load_to_text(network_speed_meter, true),
"Average network incoming traffic: 0 mbps\nAverage network outgoing traffic: 0 " "Average network incoming traffic: 0 mbps\nAverage network outgoing traffic: 0 "
@ -488,7 +491,7 @@ TEST(serialize_network_load_to_text, blank_attck_average) {
} }
TEST(serialize_network_load_to_text, blank_attck_absolute) { TEST(serialize_network_load_to_text, blank_attck_absolute) {
map_element network_speed_meter; map_element_t network_speed_meter;
EXPECT_EQ(serialize_network_load_to_text(network_speed_meter, false), EXPECT_EQ(serialize_network_load_to_text(network_speed_meter, false),
"Network incoming traffic: 0 mbps\nNetwork outgoing traffic: 0 mbps\nNetwork " "Network incoming traffic: 0 mbps\nNetwork outgoing traffic: 0 mbps\nNetwork "
@ -496,7 +499,7 @@ TEST(serialize_network_load_to_text, blank_attck_absolute) {
} }
TEST(serialize_network_load_to_json, blank_attack_average) { TEST(serialize_network_load_to_json, blank_attack_average) {
map_element network_speed_meter; map_element_t network_speed_meter;
json_object* jobj = serialize_network_load_to_json(network_speed_meter); json_object* jobj = serialize_network_load_to_json(network_speed_meter);
EXPECT_EQ(std::string(json_object_to_json_string(jobj)), EXPECT_EQ(std::string(json_object_to_json_string(jobj)),