tinc/test/commandline.test

51 lines
1 KiB
Text
Raw Normal View History

2019-08-26 11:44:51 +00:00
#!/bin/sh
2019-08-26 11:44:53 +00:00
. "${0%/*}/testlib.sh"
2019-08-26 11:44:51 +00:00
# Initialize one node
$tinc $c1 <<EOF
init foo
set DeviceType dummy
set Port 0
EOF
cat >$d1/tinc-up <<EOF
#!/bin/sh
read pid rest <$d1/pid
(sleep 0.1; kill \$pid) &
EOF
# Test tincd command line options that should work
$tincd $c1 $r1 -D
$tincd $c1 $r1 --no-detach
$tincd $c1 $r1 -D -d
$tincd $c1 $r1 -D -d2
$tincd $c1 $r1 -D -d 2
$tincd $c1 $r1 -D -n foo
$tincd $c1 $r1 -D -nfoo
$tincd $c1 $r1 -D --net=foo
$tincd $c1 $r1 -D --net foo
# Test tincd command line options that should not work
$tincd $c1 $r1 foo && exit 1 || true
$tincd $c1 $r1 --pidfile && exit 1 || true
$tincd $c1 $r1 --foo && exit 1 || true
# Test tinc command line options that should work
$tinc $c1 get name
$tinc $c1 -n foo get name
$tinc $c1 -nfoo get name
$tinc $c1 --net=foo get name
$tinc $c1 --net foo get name
# Test tinc command line options that should not work
2019-08-26 11:44:51 +00:00
$tinc $c1 -n foo get somethingreallyunknown && exit 1 || true
2019-08-26 11:44:51 +00:00
$tinc $c1 --net && exit 1 || true
$tinc $c1 --net get name && exit 1 || true
$tinc $c1 foo && exit 1 || true