Commit ffb601a5 authored by Rémi Duraffort's avatar Rémi Duraffort

luatelnet auto test: use the current PID as port number.

parent 0656ac9c
#!/bin/sh
TELNET_FAIL="telnet_fail"
PORT=$$
killer()
{
sleep 2 && ps $1 > /dev/null && touch "telnet_fail" && kill -9 $1
sleep 2 && ps $1 > /dev/null && touch $TELNET_FAIL && kill -9 $1
}
wait_or_quit()
{
wait $1
if [ `ls telnet_fail 2> /dev/null | wc -l` = 1 ]
if [ `ls $TELNET_FAIL 2> /dev/null | wc -l` = 1 ]
then
rm -f telnet_fail
rm -f $TELNET_FAIL
exit 1
fi
}
# Remove the fail file if needed
rm -f telnet_fail
rm -f $TELNET_FAIL
# Test that VLC handle options correctly
../vlc -I luatelnet &
../vlc -I luatelnet --telnet-port $PORT &
VLC1=$!
sleep 1
killer $VLC1 &
echo "admin\nshutdown\n" | nc localhost 4212
echo "admin\nshutdown\n" | nc localhost $PORT
wait_or_quit $VLC1
../vlc -I luatelnet --telnet-port 4312 &
../vlc -I luatelnet --telnet-port $PORT --telnet-password bla &
VLC2=$!
sleep 1
killer $VLC2 &
echo "admin\nshutdown\n" | nc localhost 4312
echo "bla\nshutdown\n" | nc localhost $PORT
wait_or_quit $VLC2
../vlc -I luatelnet --telnet-port 1234 --telnet-password bla &
../vlc -I luatelnet --telnet-port $PORT --telnet-password one_long_password &
VLC3=$!
sleep 1
killer $VLC3 &
echo "bla\nshutdown\n" | nc localhost 1234
echo "one_long_password\nshutdown\n" | nc localhost $PORT
wait_or_quit $VLC3
../vlc -I luatelnet --telnet-port 1234 --telnet-password one_long_password &
../vlc -I luatelnet --telnet-port $PORT --telnet-password "" &
VLC4=$!
sleep 1
killer $VLC4 &
echo "one_long_password\nshutdown\n" | nc localhost 1234
echo "\nshutdown\n" | nc localhost $PORT
wait_or_quit $VLC4
exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment