]> git.sesse.net Git - vlc/blob - test/modules/misc/lua/telnet.sh
ML: fix typo (fix missing vtable)
[vlc] / test / modules / misc / lua / telnet.sh
1 #!/bin/sh
2
3 TELNET_FAIL="telnet_fail"
4 PORT=`echo "$$+1024" | bc`
5
6 killer()
7 {
8   sleep 2 && ps $1 > /dev/null && touch $TELNET_FAIL && kill -9 $1
9 }
10
11 wait_or_quit()
12 {
13   wait $1
14   if [ `ls $TELNET_FAIL 2> /dev/null | wc -l` = 1 ]
15   then
16     rm -f $TELNET_FAIL
17     exit 1
18   fi
19 }
20
21 # Remove the fail file if needed
22 rm -f $TELNET_FAIL
23
24 # Test that VLC handle options correctly
25 ../vlc -I luatelnet --telnet-port $PORT &
26 VLC1=$!
27 sleep 1
28 killer $VLC1 &
29 echo "admin\nshutdown\n" | nc localhost $PORT
30 wait_or_quit $VLC1
31
32 ../vlc -I luatelnet --telnet-port $PORT --telnet-password bla &
33 VLC2=$!
34 sleep 1
35 killer $VLC2 &
36 echo "bla\nshutdown\n" | nc localhost $PORT
37 wait_or_quit $VLC2
38
39 ../vlc -I luatelnet --telnet-port $PORT --telnet-password one_long_password &
40 VLC3=$!
41 sleep 1
42 killer $VLC3 &
43 echo "one_long_password\nshutdown\n" | nc localhost $PORT
44 wait_or_quit $VLC3
45
46 ../vlc -I luatelnet --telnet-port $PORT --telnet-password "" &
47 VLC4=$!
48 sleep 1
49 killer $VLC4 &
50 echo "\nshutdown\n" | nc localhost $PORT
51 wait_or_quit $VLC4
52
53 exit 0