Hi!
On Tue, 2015-01-27 at 19:19 +0300, Alexey Kodanev wrote:
> Hi!
> On 01/27/2015 10:41 AM, Zeng Linggang wrote:
> > Hi!
> > On Fri, 2015-01-23 at 14:01 +0300, Alexey Kodanev wrote:
> >> Hi!
> >> On 21.01.2015 8:28, Zeng Linggang wrote:
> >>> * Add 'TCID' and 'TST_TOTAL'.
> >>> * Use 'test.sh'.
> >>> * Delete some useless comment.
> >>> * Some cleanup.
> >>>
> >>> Signed-off-by: Zeng Linggang<zenglg...@cn.fujitsu.com>
> >>> ---
> >>> -} else {
> >>> -   set LOOPCOUNT 25
> >>> + if [ -z $LOOPCOUNT ]; then
> >>> +         LOOTCOUNT=25
> >>                                              ^
> >>                                              should be 'P' here
> >>
> > What is the 'P' mean?
> 
> sorry, pointed to the wrong (empty) place... "LOOPCOUNT=25", not 
> "LOOTCOUNT=25"
> 

Yep. Thank you very much.

> >>> + fi
> >>>    }
> >>>    
> >>> -# stty echo
> >>> -send_user " Starting\n"
> >>> -
> >>> -# Do foreach host on command line
> >>> -set count 0
> >>> -while {$count < $LOOPCOUNT} {
> >>> -   set count [expr $count+1]
> >>> -   foreach HOST $RHOST {
> >>> -      send_user "Host: $HOST\n"
> >>> -
> >>> -      # telnet to the host
> >>> -      spawn telnet $HOST
> >>> -      expect -re "login:"
> >>> -
> >>> -      send "$RUSER\r"
> >>> -      expect -re "Password:"
> >>> +do_test()
> >>> +{
> >>> + tst_resm TINFO "Starting"
> >>>    
> >>> -      send "$PASSWD\r"
> >>> -
> >>> -      send "PS1=\"$PROMPT\"\r"
> >>> -      # Wait for shell prompt
> >>> -      expect "$PROMPT"
> >>> + for i in $(seq 1 ${LOOPCOUNT})
> >>> + do
> >>> +         telnet_test || return 1
> >>> + done
> >>> +}
> >>>    
> >>> -      # Run passwd command - and respond to its prompts
> >>> -      send "LC_ALL=C ls -l /etc/hosts | wc -w > $TESTLOG/$RUSER.$HOST \r"
> >>> -      # When shell prompt comes back, logout
> >>> +telnet_test()
> >>> +{
> >>> + expect -c "
> >>> +         spawn telnet $RHOST
> >>> +         expect -re \"login:\"
> >>> +         send \"$RUSER\r\"
> >>> +         expect -re \"Password:\"
> >>> +         send \"$PASSWD\r\"
> >>> +
> >>> +         send \"LC_ALL=C ls -l /etc/hosts | wc -w > $RUSER.$RHOST \r\"
> >>> +         expect \"$RUSER@\"
> >> This part needs some extra checking for failed login, e.g. 'incorrect'
> >> password or connection timeout:
> >>
> >> expect -re "incorrect" {
> >>       exit 1
> >> } -re "$USERS@"
> >>
> >>
> > Good idea. Thanks.
> >
> >>> +         exp_send \"logout\r\"
> >>> +
> >> The below part can be changed to:
> >>           tst_resm TINFO "checking telnet status"
> >>           tst_rhost_run -s -c "grep -q 9 $RUSER.$RHOST"
> >>           tst_rhost_run -c "rm -f $RUSER.$RHOST"
> >>
> >> Note, 'tst_rhost_run' with '-s' option should exit with TBROK if remote
> >> command returns non-zero exit status, please find the following patch
> >> with the fix:
> >>
> >> [PATCH v2] lib/test_net.sh: fix 'tst_rhost_run -s' when errors occur.
> >>
> > Thank you. I have found the patch.
> >
> >>> +         send_user \"CHECKING TELNET STATUS\n\"
> >>> +
> >>> +         set nummatch [exec rsh -n -l $RUSER $RHOST \\
> >>> +                       \"grep -c 9 $RUSER.$RHOST\"]
> >>> +         if {\$nummatch==1} {
> >>> +                 exec rsh -n -l $RUSER $RHOST \"rm -f $RUSER.$RHOST\"
> >>> +         } else {
> >>> +                 exit 1
> >>> +         }
> >>> + "
> >>> +}
> >>>    
> >>> -      expect "$PROMPT"
> >>> -      exp_send "logout\r"
> >>> +setup
> >>>    
> >>> -      send_user "CHECKING TELNET STATUS\n"
> >>> -      set nummatch [exec rsh -n -l $RUSER $HOST "cat 
> >>> $TESTLOG/$RUSER.$HOST|grep -c 9"]
> >>> -      if {$nummatch==1} {
> >>> -         send_user "$TC interactive Test Successful in LOOP $count\r"
> >>> -         exec rsh -n -l $RUSER $HOST "rm -f $TESTLOG/$RUSER.$HOST"
> >>> -      } else {
> >>> -         send_user "$TC interactive session failed\n"
> >>> -         exit 1
> >>> -      }
> >>> -   }
> >>> -}
> >>> +do_test
> >>> +if [ $? -ne 0 ]; then
> >>> + tst_resm TFAIL "Test $TCID failed."
> >>> +else
> >>> + tst_resm TPASS "Test $TCID successed."
> >> "'succeeded"
> >>
> > Yep.
> >
> >>> +fi
> >>>    
> >>> -send_user "\nTest PASSES\n\n"
> >>> -exit 0
> >>> +tst_exit
> >> Also, there is too much non-standard LTP output, especially if LOOPCOUNT
> >> is big. Could we send it to a file and only if there are some errors,
> >> print it. Any thoughts?
> >>
> > It is not bad, but we could not sure whether the test is being run when
> > we wait.
> 
> For example, it could be the below messages on each step or something 
> more informative.
> 
> tst_resm TINFO "login with telnet, step $i"
> 
> expect ...
> 
> tst_resm TINFO "checking telnet status"
> ...
> 

That's OK.

Best regards,
Zeng

> Best regards,
> Alexey



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to