2 ################################################################################
4 ## Copyright (c) International Business Machines Corp., 2001 ##
6 ## This program is free software; you can redistribute it and#or modify ##
7 ## it under the terms of the GNU General Public License as published by ##
8 ## the Free Software Foundation; either version 2 of the License, or ##
9 ## (at your option) any later version. ##
11 ## This program is distributed in the hope that it will be useful, but ##
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
13 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
14 ## for more details. ##
16 ## You should have received a copy of the GNU General Public License ##
17 ## along with this program; if not, write to the Free Software ##
18 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
20 ################################################################################
24 # Description: This program is a Graphical User Interface (GUI)
25 # Control Centre for LTP. The Control Centre provides
26 # functionality to Compile, Execute and View Results of
29 # Author: Manoj Iyer - manjo@mail.utexas.edu
31 # Thanks: Jim Choate - For suggesting the use of dialog command.
33 # History: March 26 2003 - Created.
35 # March 28 2003 - Removed gauges and put make commands in foreground.
36 # Robbie Williamson - robbiew@us.ibm.com
38 # March 31 2003 - Made scenario menu creation dynamic and code
39 # to pull the test descriptions from the scenario files.
40 # Robbie Williamson - robbiew@us.ibm.com
42 # April 17 2003 - Added menu selection to list contents of selected
44 # Robbie Williamson - robbiew@us.ibm.com
46 # April 23 2003 - Added PID to results filename.
47 # - Added code to allow users to redirect output and
48 # specify test execution duration.
49 # Robbie Williamson - robbiew@us.ibm.com
51 # April 30, 2003 - Recoded results display to allow selection
53 # - Created variable to hold results filename
54 # - Added time to results filename.
60 # Description: Remove all temporary files created by this program. Cleanup
61 # always called on program exit.
68 rm -f $TMPDIR/runltp.
*
72 # Function: display_info_msg
74 # Description: Displays informational messages window. This window may
75 # may be used to display information like errors, instructions
76 # etc to the user. The window is dismissed when the user hits
79 # Input: $1 - Title the needs to be displayed on the window.
80 # eg: ERROR: Compiling LTP
83 # Output: Information message window.
86 dialog
--backtitle "Linux Test Project Control Centre" \
93 # Function: compile_ltp
95 # Description: Checks for commands that are pre-reqs for compiling and
96 # installing LTP. It displays a confirmation window inorder to
97 # confirm the choice made by the user.
99 # Calls: do_make_clean()
105 # Output: Confirmation window.
108 dialog
--backtitle "Linux Test Project Control Centre" \
109 --title "Compiling LTP testsuite"\
110 --yesno "This will compile all the test cases in\
111 LTP test suite and place the executables\
112 in testcases/bin directory. Do\
113 you wish to continue ??" 7 70 || RC
=$?
116 for cmd
in cc
make lex ;
118 which $cmd &>$TMPDIR/runltp.err.$$
;
121 display_info_msg
"Compiling LTP testsuite" \
122 "ERROR: command $cmd not found, $cmd is\
123 required to compile LTP test cases. Please\
124 install $cmd or export PATH correctly before\
125 running this program" ;
131 echo "ERROR in \'make clean\' - exiting."
136 echo "ERROR in \'make all\' - exiting."
141 echo "ERROR in \'make install\' - exiting."
153 # Function: disp_ltpres
155 # Description: The results generated after the ltp execution located under
156 # ltp-mmddyy/results/ directory in a text (ASCII) file called
157 # results.todaysdate. This function displays this file in a
158 # window. If the results file does not exit it displays an
159 # info message window notifing the user that LTP test cases
160 # need to be executed inorder to view results.
162 # Input: ltp-mmddyy/results/results.todaysdate.time
164 # Output: Window displaying results of testcases that were executed.
169 RESULTS_LIST
=$
(for i
in `ls -1 -A -I "CVS" $LTPRESULTS`;do echo -n "$i [more...] "; done)
170 if ! [ -z $RESULTS_LIST ] ;then
171 while [ $RC -ne "1" ]
174 dialog
--backtitle "Linux Test Project Control Centre" \
175 --title "LTP Test Results" \
176 --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 8 \
178 2>$TMPDIR/runltp.results.$$ || RC
=$?
179 results_item
=$
(cat $TMPDIR/runltp.results.$$
)
180 if ! [ -z $results_item ];then
182 dialog
--backtitle "Linux Test Project Control Centre" \
183 --title "LTP Test Results" \
184 --textbox $LTPRESULTS/$results_item 17 70
186 dialog
--backtitle "Linux Test Project Control Centre" \
187 --title "LTP Test Results." \
188 --yesno "Would you like to share these results with the LTP \
189 community by posting it to the LTP results mailing list?" \
193 mail ltp-results@lists.sourceforge.net
< \
194 $LTPRESULTS/$results_item ;
205 dialog
--backtitle "Linux Test Project Control Centre" \
206 --title "LTP Test Results" \
207 --msgbox "ERROR: No files to view in $LTPRESULTS directory." 5 53
213 # Function: flags_prompt
215 # Description: Prompt for and record user options for run duration and
216 # test output direction
223 dialog
--backtitle "Linux Test Project Control Centre"\
224 --title "Output Direction" --clear\
225 --yesno "Would you like test output recorded to a file, instead of STDOUT?" 7 80
229 dialog
--backtitle "Linux Test Project Control Centre"\
230 --title "Output Direction" --clear\
231 --inputbox " Please enter the full path and \
232 name of the file where you wish \
233 to redirect output to" 17 80 \
234 2>$TMPDIR/runltp.outdir.$$
;
235 flags_outfile
=$
(cat $TMPDIR/runltp.outdir.$$ |
awk '{print $1}')
236 $TOOLSDIR/ver_linux
> $flags_outfile 2>&1
237 RUNALL_FLAGS
=" -o $flags_outfile"
240 dialog
--backtitle "Linux Test Project Control Centre"\
241 --title "Test Duration" --clear\
242 --yesno "Would you like to specify test duration? \
243 Default is the length of one loop." 7 80
247 dialog
--backtitle "Linux Test Project Control Centre"\
248 --title "Test Duration - Interval Selection" --clear\
249 --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 4 \
254 2>$TMPDIR/runltp.interval.$$
;
255 flags_interval
=$
(cat $TMPDIR/runltp.interval.$$ |
awk '{print $1}')
256 case $flags_interval in
257 s
) INTERVAL
="seconds" ;;
258 m
) INTERVAL
="minutes" ;;
259 h
) INTERVAL
="hours" ;;
260 d
) INTERVAL
="days" ;;
264 WINDOW_MSG
="Please enter the number of $INTERVAL to run"
265 dialog
--backtitle "Linux Test Project Control Centre"\
266 --title "Test Duration - Length Specification" --clear\
267 --inputbox "$WINDOW_MSG" 7 80 \
268 2>$TMPDIR/runltp.length.$$
;
269 flags_length
=$
(cat $TMPDIR/runltp.length.$$ |
awk '{print $1}')
270 flags_duration
="$flags_length$flags_interval"
271 RUNALL_FLAGS
=" $RUNALL_FLAGS -t $flags_duration"
275 # Function: exectest_screenout
277 # Description: Execute tests by calling runltp, display test status
282 # Output: messages printed by testcases.
285 RC
=0 # setting return code to 0, to loop in while
287 RESULTS_FILE
=$
(date +%Y-
%m-
%d.
%H.
%M.
%S
).$$
289 # execute runltp with user defined command file.
290 $TOOLSDIR/runltp
-q -p $RUNALL_FLAGS -l results.
$RESULTS_FILE \
291 -f $TMPDIR/runltp.
test.list.$$
299 # Function: execute_ltp
301 # Description: This function provides a menu of testcases that can be
302 # selected for execution. If networking tests are selected,
303 # they require a remote machine and remote machines root
304 # users password. The user will be prompted to enter this
305 # information in a text box.
306 # The function checks to see if the ltp-mmddyy/testcases/bin
307 # directory was created, this directory is created when the
308 # testcases are compiled and installed, if it is not found
309 # an info message window will notify the user that LTP needs to
310 # be compiled before tests can be executed.
311 # This function creates the senatrio file based on the users
312 # choice of testcases and uses the runltp script to
313 # execute these tests.
314 # The messages printed by the testcases are displayed on this
317 # Input: Users selection of testcases; scenario file.
319 # Output: Test selection window, Message window,
320 # information message window
328 # Pre-compiled in Debian
329 # if ! [ -d ./testcases/bin ]
331 # display_info_msg "Executing LTP testcases" \
332 # "The testcases must to be compiled inorder\
333 # to execute them. Returning to main menu. \
334 # Please select the Compile option."
338 LIST
=$
(for i
in `ls -1 -A -I "CVS" $LTPROOT/runtest`; do echo -n "$i "; j
=$
(head -n1 $LTPROOT/runtest
/$i | cut
-d: -f2|
sed s
/" "/_
/g
); echo -n "$j off "; done)
339 dialog
--backtitle "Linux Test Project Control Centre"\
340 --title "Execute LTP" --clear\
341 --checklist "Select [SPACEBAR] tests to run" 20 80 5 \
343 2>$TMPDIR/runltp.choice.$$ || RC
=$?
344 size
=`wc -m $TMPDIR/runltp.choice.$$|awk '{print $1}'`
345 if [ $size -eq 0 ];then
346 tst_choice
=$
(echo "NULL")
348 tst_choice
=$
(cat $TMPDIR/runltp.choice.$$
)
350 if [[ $tst_choice == NULL
]];then
355 for i
in $tst_choice ;
357 cat $LTPROOT/runtest
/$
(echo $i |
sed -e 's/"//g') \
358 >> $TMPDIR/runltp.
test.list.$$
;
359 if [[ $
(echo $i |
sed -e 's/"//g') == "tcp_cmds" || \
360 $
(echo $i |
sed -e 's/"//g') == "tcp_cmds_noexpect" || \
361 $
(echo $i |
sed -e 's/"//g') == "multicast" || \
362 $
(echo $i |
sed -e 's/"//g') == "ipv6" || \
363 $
(echo $i |
sed -e 's/"//g') == "ipv6_noexpect" || \
364 $
(echo $i |
sed -e 's/"//g') == "nfs" || \
365 $
(echo $i |
sed -e 's/"//g') == "multicast" ]] ;
371 if ! [ -z $run_net_test ] ;
373 dialog
--backtitle "Linux Test Project Control Centre"\
374 --title "Execute LTP test cases" \
376 --inputbox "You have chosen to execute testcases \
377 that require a Remote Machine. \
378 Please enter the fully qualified host \
379 name" 17 80 $
(hostname
--long) \
380 2>$TMPDIR/runltp.out.$$
;
381 host_name
=$
(cat $TMPDIR/runltp.out.$$ |
awk '{print $1}') ;
386 dialog
--backtitle "Linux Test Project Control Centre"\
387 --title "Execute LTP test cases" \
389 --inputbox " Please enter the root password \
390 of this remote machine" 17 80 \
391 2>$TMPDIR/runltp.out.$$
;
392 rhost_passwd
=$
(cat $TMPDIR/runltp.out.$$ |
awk '{print $1}') ;
394 PASSWD
=$rhost_passwd ;
398 # Precompiled in Debian
399 # if ! [ -d ./testcases/bin ] ;
401 # display_info_msg "Executing LTP testcases" \
402 # "The testcases must to be compiled inorder\
403 # to execute them. Returning to main menu. \
404 # Please select the Compile option." ;
416 # echo "Cancel pressed" ;
419 # echo "ESC pressed" ;
425 # Function: about_ltpcc
427 # Description: This function displays a window containing a brief message
428 # describing this programs functionality, and credits the author.
432 # Output: Message window, description of LTP Control Center.
435 display_info_msg
"About LTP Control Centre" \
436 "The LTP Control Centre can be used to\
437 to compile, install and execute\
438 The Linux Test Project test suite. Written by\
439 Manoj Iyer <manjo@mail.utexas.edu>"
444 # Function: ltp_scenarios
446 # Description: This function displays a list of scenario files located
447 # in $LTPROOT/runtest. Users can list the contents of each file.
449 # Input: Files from $LTPROOT/runtest
451 # Output: 1) Menu selection containing each file as an option to list.
452 # 2) Contents of selected scenario.
457 SCENARIOS
=$
(for i
in `ls -1 -A -I "CVS" $LTPROOT/runtest`;do echo -n "$i [more...] "; done)
459 while [ $RC -ne "1" ]
462 dialog
--backtitle "Linux Test Project Control Centre" \
463 --title "LTP Scenario Files" \
464 --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 8 \
466 2>$TMPDIR/runltp.scenario.$$ || RC
=$?
467 scenario_item
=$
(cat $TMPDIR/runltp.scenario.$$
)
468 if ! [ -z $scenario_item ];then
470 dialog
--backtitle "Linux Test Project Control Centre" \
471 --title "LTP Scenario Files" \
472 --textbox $LTPROOT/runtest
/$scenario_item 17 70
481 # Description: Displays the main menu to the LTP Control Centre. The menu
482 # provides options to Compile, Execute, and View test execution
485 # Calls: about_ltpcc()
492 # Output: Menu selection of actions to perform.
495 RC
=0 # return code from commands and local functions
501 TMPDIR
=${TMPDIR:-/tmp}
502 LTPRESULTS
=/var
/cache
/ltp
/results
503 LTPROOT
=/usr
/lib
/ltp
/tests
/linux
504 TOOLSDIR
=/usr
/lib
/ltp
/tools
506 # test for dialog program exist
507 if [ ! -x /usr
/bin
/dialog
]; then
508 echo "Sorry, ltpmenu GUI not available, can't find dialog. Exiting...";
512 # call cleanup function on program exit.
516 # wait in a loop until user hits [Cancel] button on the main menu.
521 dialog
--backtitle "Linux Test Project Control Centre" \
522 --title "Main Menu" \
523 --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 5 \
524 About
"About LTP Control Centre" \
525 Details
"Details of scenario files" \
526 Execute
"Execute LTP testsuite" \
527 Results
"Display a summary of test results" \
528 2>${TMPDIR:-/tmp}/runltp.mainmenu.$$ || RC
=$?
531 0) mmenu_item
=`cat /tmp/runltp.mainmenu.$$` ;
532 # echo "return code = $RC" ;
533 # echo "MENU ITEM = $mmenu_item" ;
535 About
) about_ltpcc
;;
536 # Compile) compile_ltp ;;
537 Details
) ltp_scenarios
;;
538 Execute
) execute_ltp
;;
539 Results
) disp_ltpres
;;
542 1) display_info_msg
"Good Bye!" \
543 "Thank you for using Linux Test Project test suite.\
544 Please visit our project website \
545 http://ltp.sourceforge.net \
546 for latest news on The Linux Test Project. "
549 255) display_info_msg
"Good Bye!" \
550 "Thank you for using Linux Test Project test suite.\
551 Please visit our project website\
552 http://ltp.sourceforge.net for latest news\
553 on The Linux Test Project. "