Fix nc test to run on computers without dns hostname.

pull/971/head
Fredrik Öhrström 2023-05-27 12:08:23 +02:00
rodzic f377ade8c7
commit 17791e5fb2
3 zmienionych plików z 47 dodań i 3 usunięć

Wyświetl plik

@ -1,7 +1,22 @@
#!/bin/bash
if ! command -v nc > /dev/null 2> /dev/null
then
echo "Skipping nc test, not installed."
exit 0
fi
IS_NC_OPENBSD=$(nc -help 2>&1 | grep -o OpenBSD)
# These tests only work with netcat-openbsd.
if [ "$IS_NC_OPENBSD" != "OpenBSD" ]
then
echo "Skipping nc test, wrong version of nc installed."
exit 0
fi
if nc 2>&1 | grep -q apple
then
echo "Skipping nc test, incorrect version of nc installed."
exit 0
fi
@ -18,7 +33,7 @@ TESTRESULT="ERROR"
PORT=$(( $RANDOM % 10000 + 30000 ))
rm -f $TEST/response
$PROG --silent --oneshot --exitafter=5s --format=fields --selectfields=total_m3 "rtlwmbus:CMD(nc -lkv $PORT)" MyWater iperl 33225544 NOKEY >> $TEST/response 2>&1 &
$PROG --silent --oneshot --exitafter=5s --format=fields --selectfields=total_m3 "rtlwmbus:CMD(nc -lkn $PORT)" MyWater iperl 33225544 NOKEY >> $TEST/response 2>&1 &
sleep 0.5

Wyświetl plik

@ -1,7 +1,21 @@
#!/bin/bash
if ! command -v nc > /dev/null 2> /dev/null
then
echo "Skipping nc test, not installed."
exit 0
fi
IS_NC_OPENBSD=$(nc -help 2>&1 | grep -o OpenBSD)
# These tests only work with netcat-openbsd.
if [ "$IS_NC_OPENBSD" != "OpenBSD" ]
then
echo "Skipping nc test, wrong version of nc installed."
exit 0
fi
if nc 2>&1 | grep -q apple
then
echo "Skipping nc test, incorrect version of nc installed."
exit 0
fi
@ -18,7 +32,7 @@ TESTRESULT="ERROR"
PORT=$(( $RANDOM % 10000 + 30000 ))
rm -f $TEST/response
$PROG --silent --oneshot --exitafter=5s --format=fields --selectfields=total_m3 "hex:CMD(nc -lk $PORT)" MyWater iperl 33225544 NOKEY >> $TEST/response 2>&1 &
$PROG --silent --oneshot --exitafter=5s --format=fields --selectfields=total_m3 "hex:CMD(nc -lkn $PORT)" MyWater iperl 33225544 NOKEY >> $TEST/response 2>&1 &
sleep 0.5

Wyświetl plik

@ -1,7 +1,22 @@
#!/bin/bash
if ! command -v nc > /dev/null 2> /dev/null
then
echo "Skipping nc test, not installed."
exit 0
fi
IS_NC_OPENBSD=$(nc -help 2>&1 | grep -o OpenBSD)
# These tests only work with netcat-openbsd.
if [ "$IS_NC_OPENBSD" != "OpenBSD" ]
then
echo "Skipping nc test, wrong version of nc installed."
exit 0
fi
if nc 2>&1 | grep -q apple
then
echo "Skipping nc test, incorrect version of nc installed."
exit 0
fi
@ -18,7 +33,7 @@ TESTRESULT="ERROR"
PORT=$(( $RANDOM % 10000 + 30000 ))
rm -f $TEST/response
$PROG --silent --oneshot --exitafter=5s --format=fields --selectfields=total_m3 "rawtty:CMD(nc -lk $PORT)" MyWater iperl 33225544 NOKEY >> $TEST/response 2>&1 &
$PROG --silent --oneshot --exitafter=5s --format=fields --selectfields=total_m3 "rawtty:CMD(nc -lkn $PORT)" MyWater iperl 33225544 NOKEY >> $TEST/response 2>&1 &
sleep 0.5