mirror of https://github.com/ntop/n2n.git
Hamish Coleman
3 years ago
9 changed files with 221 additions and 48 deletions
@ -0,0 +1,50 @@ |
|||||
|
#!/bin/sh |
||||
|
# |
||||
|
# This expects to find the tests in the tools dir or scripts dir and the |
||||
|
# expected results in the tests dir. |
||||
|
# |
||||
|
# Run with the name(s) of the tests on the commandline |
||||
|
|
||||
|
# boilerplate so we can support whaky cmake dirs |
||||
|
[ -z "$TOPDIR" ] && TOPDIR="." |
||||
|
[ -z "$BINDIR" ] && BINDIR="." |
||||
|
export TOPDIR |
||||
|
export BINDIR |
||||
|
|
||||
|
if [ -d "$BINDIR/tools" ]; then |
||||
|
TOOLSDIR="$BINDIR/tools" |
||||
|
else |
||||
|
TOOLSDIR="$BINDIR" |
||||
|
fi |
||||
|
|
||||
|
TESTS=$* |
||||
|
|
||||
|
SCRIPTSDIR="$TOPDIR/scripts" |
||||
|
TESTDATA="$TOPDIR/tests" |
||||
|
|
||||
|
# Confirm we have all the tools and data |
||||
|
for i in $TESTS; do |
||||
|
if [ ! -e "$TOOLSDIR/$i" ] && [ ! -e "$SCRIPTSDIR/$i" ]; then |
||||
|
echo "Could not find test $i" |
||||
|
exit 1 |
||||
|
fi |
||||
|
if [ ! -e "$TESTDATA/$i.expected" ]; then |
||||
|
echo "Could not find testdata $TESTDATA/$i.expected" |
||||
|
exit 1 |
||||
|
fi |
||||
|
done |
||||
|
|
||||
|
# Actually run the tests |
||||
|
for i in $TESTS; do |
||||
|
if [ -e "$TOOLSDIR/$i" ]; then |
||||
|
TEST="$TOOLSDIR/$i" |
||||
|
elif [ -e "$SCRIPTSDIR/$i" ]; then |
||||
|
TEST="$SCRIPTSDIR/$i" |
||||
|
fi |
||||
|
|
||||
|
echo "$TEST >$TESTDATA/$i.out" |
||||
|
set -e |
||||
|
"$TEST" >"$TESTDATA/$i.out" |
||||
|
cmp "$TESTDATA/$i.expected" "$TESTDATA/$i.out" |
||||
|
set +e |
||||
|
done |
@ -0,0 +1,11 @@ |
|||||
|
#!/bin/sh |
||||
|
# |
||||
|
# Run all the integration tests via the test harness |
||||
|
|
||||
|
# boilerplate so we can support whaky cmake dirs |
||||
|
[ -z "$TOPDIR" ] && TOPDIR=. |
||||
|
[ -z "$BINDIR" ] && BINDIR=. |
||||
|
export TOPDIR |
||||
|
export BINDIR |
||||
|
|
||||
|
${TOPDIR}/scripts/test_harness.sh test_integration_supernode.sh |
@ -0,0 +1,33 @@ |
|||||
|
#!/bin/sh |
||||
|
# |
||||
|
# Do some quick tests via the Json API against the supernode |
||||
|
# |
||||
|
|
||||
|
AUTH=n2n |
||||
|
|
||||
|
# boilerplate so we can support whaky cmake dirs |
||||
|
[ -z "$TOPDIR" ] && TOPDIR=. |
||||
|
[ -z "$BINDIR" ] && BINDIR=. |
||||
|
|
||||
|
docmd() { |
||||
|
echo "###" |
||||
|
"$@" |
||||
|
echo |
||||
|
} |
||||
|
|
||||
|
# start it running in the background |
||||
|
docmd ${BINDIR}/supernode -v |
||||
|
|
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 communities |
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 packetstats |
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 edges --raw |
||||
|
|
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 verbose |
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 -k $AUTH --write verbose 1 |
||||
|
|
||||
|
# looks strange, but we are querying the state of the "stop" verb |
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 stop |
||||
|
|
||||
|
# stop it |
||||
|
docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 -k $AUTH --write stop |
||||
|
|
@ -0,0 +1,21 @@ |
|||||
|
#!/bin/sh |
||||
|
# |
||||
|
# Run all the unit tests via the test harness |
||||
|
|
||||
|
# boilerplate so we can support whaky cmake dirs |
||||
|
[ -z "$TOPDIR" ] && TOPDIR=. |
||||
|
[ -z "$BINDIR" ] && BINDIR=. |
||||
|
export TOPDIR |
||||
|
export BINDIR |
||||
|
|
||||
|
TESTS=" |
||||
|
tests-auth |
||||
|
tests-compress |
||||
|
tests-elliptic |
||||
|
tests-hashing |
||||
|
tests-transform |
||||
|
tests-wire |
||||
|
" |
||||
|
|
||||
|
# shellcheck disable=SC2086 |
||||
|
${TOPDIR}/scripts/test_harness.sh $TESTS |
@ -1,40 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
# |
|
||||
# This expects to find the tests in the tools dir and the expected results |
|
||||
# in the tests dir. |
|
||||
|
|
||||
TESTS=" |
|
||||
tests-auth |
|
||||
tests-compress |
|
||||
tests-elliptic |
|
||||
tests-hashing |
|
||||
tests-transform |
|
||||
tests-wire |
|
||||
" |
|
||||
|
|
||||
TOOLSDIR=tools |
|
||||
TESTDATA=tests |
|
||||
|
|
||||
# Allow both dirs be overidden |
|
||||
[ -n "$1" ] && TOOLSDIR="$1" |
|
||||
[ -n "$2" ] && TESTDATA="$2" |
|
||||
|
|
||||
# Confirm we have all the tools and data |
|
||||
for i in $TESTS; do |
|
||||
if [ ! -e "$TOOLSDIR/$i" ]; then |
|
||||
echo "Could not find test $TOOLSDIR/$i" |
|
||||
exit 1 |
|
||||
fi |
|
||||
if [ ! -e "$TESTDATA/$i.expected" ]; then |
|
||||
echo "Could not find testdata $TESTDATA/$i.expected" |
|
||||
exit 1 |
|
||||
fi |
|
||||
done |
|
||||
|
|
||||
# Actually run the tests |
|
||||
set -e |
|
||||
for i in $TESTS; do |
|
||||
echo "$TOOLSDIR/$i >$TESTDATA/$i.out" |
|
||||
"$TOOLSDIR/$i" >"$TESTDATA/$i.out" |
|
||||
cmp "$TESTDATA/$i.expected" "$TESTDATA/$i.out" |
|
||||
done |
|
@ -0,0 +1,64 @@ |
|||||
|
### |
||||
|
|
||||
|
### |
||||
|
[ |
||||
|
{ |
||||
|
"community": "-/-", |
||||
|
"ip4addr": "", |
||||
|
"is_federation": 1, |
||||
|
"purgeable": 0 |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
### |
||||
|
[ |
||||
|
{ |
||||
|
"tx_pkt": 0, |
||||
|
"type": "forward" |
||||
|
}, |
||||
|
{ |
||||
|
"tx_pkt": 0, |
||||
|
"type": "broadcast" |
||||
|
}, |
||||
|
{ |
||||
|
"nak": 0, |
||||
|
"rx_pkt": 0, |
||||
|
"type": "reg_super" |
||||
|
}, |
||||
|
{ |
||||
|
"tx_pkt": 0, |
||||
|
"type": "errors" |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
### |
||||
|
[] |
||||
|
|
||||
|
### |
||||
|
[ |
||||
|
{ |
||||
|
"traceLevel": 3 |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
### |
||||
|
[ |
||||
|
{ |
||||
|
"traceLevel": 1 |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
### |
||||
|
[ |
||||
|
{ |
||||
|
"keep_running": 1 |
||||
|
} |
||||
|
] |
||||
|
|
||||
|
### |
||||
|
[ |
||||
|
{ |
||||
|
"keep_running": 0 |
||||
|
} |
||||
|
] |
||||
|
|
Loading…
Reference in new issue