[vlc-commits] commit: luatelnet auto test: use the current PID as port number. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Mon Nov 8 18:33:45 CET 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Nov  8 18:27:38 2010 +0100| [ffb601a5f2f74f0298e9eefa7822c06441f967ef] | committer: Rémi Duraffort 

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ffb601a5f2f74f0298e9eefa7822c06441f967ef
---

 test/modules/misc/lua/telnet.sh |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/test/modules/misc/lua/telnet.sh b/test/modules/misc/lua/telnet.sh
index 6dea4c6..d4bca8c 100755
--- a/test/modules/misc/lua/telnet.sh
+++ b/test/modules/misc/lua/telnet.sh
@@ -1,50 +1,53 @@
 #!/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



More information about the vlc-commits mailing list