Skip to content

Commit ca28697

Browse files
author
Damir Zainullin
committed
Biflow Aggregator - Fix pipeline
1 parent cf2e6b3 commit ca28697

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
ACLOCAL_AMFLAGS = -I m4
22

3+
# Biflow aggregator depends on logger and logreplay
34
SUBDIRS= \
45
aggregator \
56
anonymizer \
67
backscatter \
7-
biflow_aggregator \
88
debug_sender \
99
device_classifier \
1010
email_reporter \
@@ -31,6 +31,7 @@ topn \
3131
traffic_repeater \
3232
unirec2json \
3333
endiverter \
34+
biflow_aggregator \
3435
googletest_example
3536

3637
EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL NEWS README.md nfreader \

biflow_aggregator/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ biflow_aggregator_LDADD=-lunirec -ltrap
77
include ../aminclude.am
88

99
TESTS = tests/test.sh
10+
11+
EXTRA_DIST = tests/test.sh \
12+
tests/references \
13+
tests/inputs \
14+
tests/config.xml

biflow_aggregator/tests/test.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ run_test_with_global_timeout() {
1414
local input=$1
1515
local output=$2
1616
local reference=$3
17-
local config=$4
18-
local global_timeout=$5
19-
20-
(../biflow_aggregator -i "u:lr,u:ba" -e -c config.xml -n $config -g $global_timeout & ) || true
17+
local section=$4
18+
local config=$5
19+
local global_timeout=$6
20+
(./biflow_aggregator -i "u:lr,u:ba" -e -c $config -n $section -g $global_timeout & ) || true
2121
local AGGREGATOR_PID=$!
2222
sleep 0.5
2323
die_if_not_running $AGGREGATOR_PID "Failed to start biflow aggregator"
2424

25-
../../logger/logger -w $output -i "u:ba" &
25+
./../logger/logger -w $output -i "u:ba" &
2626
local LOGGER_PID=$!
2727
sleep 0.5
2828
die_if_not_running $LOGGER_PID "Failed to start logger"
2929

30-
../../logreplay/logreplay -f $input -i "u:lr" &
30+
./../logreplay/logreplay -f $input -i "u:lr" &
3131
local LOGREPLAY_PID=$!
3232
sleep 0.5
3333
die_if_not_running $LOGREPLAY_PID "Failed to start logreplay"
@@ -39,38 +39,49 @@ run_test_with_global_timeout() {
3939
kill $LOGGER_PID 2>/dev/null
4040
wait $LOGGER_PID
4141

42-
if ! colordiff $output $reference; then
42+
if ! diff $output $reference; then
4343
echo $output doesnt match $reference
4444
success="false"
4545
fi
4646
}
47+
pwd >&2
4748

4849
script_path="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
49-
cd $script_path
50+
5051
success="true"
51-
mkdir -p outputs
52-
for input in inputs/input*; do
52+
53+
tmpdir=$(mktemp -d)
54+
55+
trap "rm -rf \"$tmpdir\"" EXIT
56+
57+
outputs="$tmpdir/outputs"
58+
59+
mkdir -p "$outputs"
60+
61+
62+
for input in "$script_path"/inputs/input*; do
5363
basename=$(basename "$input")
5464
echo Found $basename
5565
if [[ $basename =~ input([0-9]+)_(.+) ]]; then
5666
index="${BASH_REMATCH[1]}"
57-
config="${BASH_REMATCH[2]}"
58-
output=outputs/output$index
59-
reference=references/reference$index
67+
section="${BASH_REMATCH[2]}"
68+
output="$outputs/output$index"
69+
config="$script_path/config.xml"
70+
reference="$script_path/references/reference$index"
6071
else
6172
echo $input
6273
echo "Incorrect input name. Must be input<index>_<config_name>"
6374
exit 1
6475
fi
6576

6677
echo "Running test without global timeout..."
67-
run_test_with_global_timeout $input ${output}_gt0 ${reference}_gt0 $config "0"
78+
run_test_with_global_timeout $input ${output}_gt0 ${reference}_gt0 $section $config "0"
6879

6980
echo "Running test with relative global timeout..."
70-
run_test_with_global_timeout $input ${output}_gt5r ${reference}_gt5r $config "5r"
81+
run_test_with_global_timeout $input ${output}_gt5r ${reference}_gt5r $section $config "5r"
7182

7283
echo "Running test with absolute global timeout..."
73-
run_test_with_global_timeout $input ${output}_gt5a ${reference}_gt5a $config "5a"
84+
run_test_with_global_timeout $input ${output}_gt5a ${reference}_gt5a $section $config "5a"
7485

7586
done
7687

@@ -79,4 +90,4 @@ if [ "$success" = "true" ]; then
7990
else
8091
echo "Some tests failed."
8192
exit 1
82-
fi
93+
fi

logger/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ pkgdocdir=${docdir}/logger
66
pkgdoc_DATA=README.md
77
EXTRA_DIST=README.md csv2nf.sh
88
include ../aminclude.am
9+
check_PROGRAMS = logger

logreplay/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ pkgdocdir=${docdir}/logreplay
66
pkgdoc_DATA=README.md
77
EXTRA_DIST=README.md
88
include ../aminclude.am
9+
check_PROGRAMS = logreplay

0 commit comments

Comments
 (0)