Joseph Beckenbach | 169720f | 2014-03-26 15:08:46 +0000 | [diff] [blame] | 1 | #!/bin/bash |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 2 | ################################################################################ |
| 3 | ## ## |
| 4 | ## Copyright (c) International Business Machines Corp., 2001 ## |
| 5 | ## ## |
| 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. ## |
| 10 | ## ## |
| 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. ## |
| 15 | ## ## |
| 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 ## |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 18 | ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 19 | ## ## |
| 20 | ################################################################################ |
| 21 | # |
| 22 | # File: runltp |
| 23 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 24 | # Description: This program is a Graphical User Interface (GUI) |
| 25 | # Control Centre for LTP. The Control Centre provides |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 26 | # functionality to Compile, Execute and View Results of |
| 27 | # LTP test cases. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 28 | # |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 29 | # Author: Manoj Iyer - manjo@mail.utexas.edu |
| 30 | # |
| 31 | # Thanks: Jim Choate - For suggesting the use of dialog command. |
| 32 | # |
| 33 | # History: March 26 2003 - Created. |
| 34 | # |
| 35 | # March 28 2003 - Removed gauges and put make commands in foreground. |
| 36 | # Robbie Williamson - robbiew@us.ibm.com |
| 37 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 38 | # March 31 2003 - Made scenario menu creation dynamic and code |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 39 | # to pull the test descriptions from the scenario files. |
| 40 | # Robbie Williamson - robbiew@us.ibm.com |
| 41 | # |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 42 | # April 17 2003 - Added menu selection to list contents of selected |
| 43 | # scenario file. |
| 44 | # Robbie Williamson - robbiew@us.ibm.com |
| 45 | # |
robbiew | a362bdc | 2003-04-23 18:41:38 +0000 | [diff] [blame] | 46 | # April 23 2003 - Added PID to results filename. |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 47 | # - Added code to allow users to redirect output and |
| 48 | # specify test execution duration. |
| 49 | # Robbie Williamson - robbiew@us.ibm.com |
robbiew | a362bdc | 2003-04-23 18:41:38 +0000 | [diff] [blame] | 50 | # |
robbiew | 3b324ef | 2003-04-30 16:32:06 +0000 | [diff] [blame] | 51 | # April 30, 2003 - Recoded results display to allow selection |
| 52 | # of results file. |
| 53 | # - Created variable to hold results filename |
| 54 | # - Added time to results filename. |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 55 | # Function: cleanup |
| 56 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 57 | # Description: Remove all temporary files created by this program. Cleanup |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 58 | # always called on program exit. |
| 59 | # |
| 60 | # Input: NONE |
| 61 | # |
| 62 | # Output: NONE |
| 63 | cleanup() |
| 64 | { |
| 65 | rm -f /tmp/runltp.* |
| 66 | } |
| 67 | |
| 68 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 69 | # Function: display_info_msg |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 70 | # |
| 71 | # Description: Displays informational messages window. This window may |
| 72 | # may be used to display information like errors, instructions |
| 73 | # etc to the user. The window is dismissed when the user hits |
| 74 | # the [ENTER] key. |
| 75 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 76 | # Input: $1 - Title the needs to be displayed on the window. |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 77 | # eg: ERROR: Compiling LTP |
| 78 | # $2 - Message text. |
| 79 | # |
| 80 | # Output: Information message window. |
| 81 | display_info_msg() |
| 82 | { |
| 83 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 84 | --title " $1 " \ |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 85 | --msgbox " $2 " 10 70 |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 86 | return $? |
| 87 | } |
| 88 | |
| 89 | |
| 90 | # Function: compile_ltp |
| 91 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 92 | # Description: Checks for commands that are pre-reqs for compiling and |
| 93 | # installing LTP. It displays a confirmation window inorder to |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 94 | # confirm the choice made by the user. |
| 95 | # |
| 96 | # Calls: do_make_clean() |
| 97 | # do_make() |
| 98 | # do_make_install() |
| 99 | # |
| 100 | # Input: NONE |
| 101 | # |
| 102 | # Output: Confirmation window. |
| 103 | compile_ltp() |
| 104 | { |
| 105 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 106 | --title "Compiling LTP testsuite"\ |
| 107 | --yesno "This will compile all the test cases in\ |
| 108 | LTP test suite and place the executables\ |
| 109 | in testcases/bin directory. Do\ |
| 110 | you wish to continue ??" 7 70 || RC=$? |
| 111 | case $RC in |
| 112 | 0) \ |
| 113 | for cmd in cc make lex ; |
| 114 | do \ |
Petr Vorel | 2bf2094 | 2016-11-29 09:22:37 +0100 | [diff] [blame] | 115 | which $cmd >/tmp/runltp.err.$$ 2>&1 ; |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 116 | if [ $? -ne 0 ] ; |
| 117 | then \ |
| 118 | display_info_msg "Compiling LTP testsuite" \ |
| 119 | "ERROR: command $cmd not found, $cmd is\ |
| 120 | required to compile LTP test cases. Please\ |
| 121 | install $cmd or export PATH correctly before\ |
| 122 | running this program" ; |
| 123 | return ; |
| 124 | fi ; |
| 125 | done ; |
| 126 | make clean; |
| 127 | if [ $? -ne 0 ];then |
| 128 | echo "ERROR in \'make clean\' - exiting." |
| 129 | exit |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 130 | fi |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 131 | make ; |
| 132 | if [ $? -ne 0 ];then |
| 133 | echo "ERROR in \'make all\' - exiting." |
| 134 | exit |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 135 | fi |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 136 | make install ; |
| 137 | if [ $? -ne 0 ];then |
| 138 | echo "ERROR in \'make install\' - exiting." |
| 139 | exit |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 140 | fi |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 141 | return ;; |
| 142 | |
| 143 | 1) return ;; |
| 144 | |
| 145 | 255) return ;; |
| 146 | esac |
| 147 | } |
| 148 | |
| 149 | |
| 150 | # Function: disp_ltpres |
| 151 | # |
| 152 | # Description: The results generated after the ltp execution located under |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 153 | # ltp-mmddyy/results/ directory in a text (ASCII) file called |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 154 | # results.todaysdate. This function displays this file in a |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 155 | # window. If the results file does not exit it displays an |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 156 | # info message window notifing the user that LTP test cases |
| 157 | # need to be executed inorder to view results. |
| 158 | # |
robbiew | 3b324ef | 2003-04-30 16:32:06 +0000 | [diff] [blame] | 159 | # Input: ltp-mmddyy/results/results.todaysdate.time |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 160 | # |
| 161 | # Output: Window displaying results of testcases that were executed. |
| 162 | disp_ltpres() |
| 163 | { |
| 164 | RC=0 |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 165 | |
robbiew | 43fc249 | 2003-04-30 16:33:51 +0000 | [diff] [blame] | 166 | RESULTS_LIST=$(for i in `ls -1 -A -I "CVS" results`;do echo -n "$i [more...] "; done) |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 167 | if ! [ -z $RESULTS_LIST ] ;then |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 168 | while [ $RC -ne "1" ] |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 169 | do |
robbiew | 3b324ef | 2003-04-30 16:32:06 +0000 | [diff] [blame] | 170 | dialog --clear |
| 171 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 172 | --title "LTP Test Results" \ |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 173 | --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 8 \ |
| 174 | $RESULTS_LIST \ |
| 175 | 2>/tmp/runltp.results.$$ || RC=$? |
| 176 | results_item=$(cat /tmp/runltp.results.$$) |
| 177 | if ! [ -z $results_item ];then |
| 178 | dialog --clear |
| 179 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 180 | --title "LTP Test Results" \ |
| 181 | --textbox results/$results_item 17 70 |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 182 | |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 183 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 184 | --title "LTP Test Results." \ |
| 185 | --yesno "Would you like to share these results with the LTP \ |
| 186 | community by posting it to the LTP results mailing list?" \ |
| 187 | 7 70 || RESPONSE=$? |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 188 | case $RESPONSE in |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 189 | 0) \ |
| 190 | mail ltp-results@lists.sourceforge.net < \ |
| 191 | ./results/$results_item ; |
| 192 | ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 193 | |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 194 | 1) ;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 195 | |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 196 | 255) ;; |
| 197 | esac |
| 198 | fi |
| 199 | done |
| 200 | else |
| 201 | dialog --clear |
| 202 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 203 | --title "LTP Test Results" \ |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 204 | --msgbox "ERROR: No files to view in /results directory." 5 53 |
robbiew | f68ad33 | 2003-04-30 18:32:18 +0000 | [diff] [blame] | 205 | fi |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 206 | return |
| 207 | } |
| 208 | |
| 209 | |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 210 | # Function: flags_prompt |
| 211 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 212 | # Description: Prompt for and record user options for run duration and |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 213 | # test output direction |
| 214 | # |
| 215 | # Input: none |
| 216 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 217 | # Output: none |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 218 | flags_prompt() |
| 219 | { |
| 220 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 221 | --title "Output Direction" --clear\ |
| 222 | --yesno "Would you like test output recorded to a file, instead of STDOUT?" 7 80 |
| 223 | RC=$? |
| 224 | if [ $RC -eq "0" ] |
| 225 | then |
| 226 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 227 | --title "Output Direction" --clear\ |
| 228 | --inputbox " Please enter the full path and \ |
| 229 | name of the file where you wish \ |
| 230 | to redirect output to" 17 80 \ |
| 231 | 2>/tmp/runltp.outdir.$$ ; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 232 | flags_outfile=$(cat /tmp/runltp.outdir.$$ | awk '{print $1}') |
robbiew | c0a2c98 | 2003-05-28 15:23:26 +0000 | [diff] [blame] | 233 | ./ver_linux > $flags_outfile 2>&1 |
| 234 | RUNALL_FLAGS=" -o $flags_outfile" |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 235 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 236 | |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 237 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 238 | --title "Test Duration" --clear\ |
| 239 | --yesno "Would you like to specify test duration? \ |
| 240 | Default is the length of one loop." 7 80 |
| 241 | RC=$? |
| 242 | if [ $RC -eq "0" ] |
| 243 | then |
| 244 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 245 | --title "Test Duration - Interval Selection" --clear\ |
| 246 | --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 4 \ |
| 247 | s "Seconds" \ |
| 248 | m "Minutes" \ |
| 249 | h "Hours" \ |
| 250 | d "Days" \ |
| 251 | 2>/tmp/runltp.interval.$$ ; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 252 | flags_interval=$(cat /tmp/runltp.interval.$$ | awk '{print $1}') |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 253 | case $flags_interval in |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 254 | s) INTERVAL="seconds" ;; |
| 255 | m) INTERVAL="minutes" ;; |
| 256 | h) INTERVAL="hours" ;; |
| 257 | d) INTERVAL="days" ;; |
| 258 | esac |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 259 | |
| 260 | echo $INTERVAL |
| 261 | WINDOW_MSG="Please enter the number of $INTERVAL to run" |
| 262 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 263 | --title "Test Duration - Length Specification" --clear\ |
| 264 | --inputbox "$WINDOW_MSG" 7 80 \ |
| 265 | 2>/tmp/runltp.length.$$ ; |
| 266 | flags_length=$(cat /tmp/runltp.length.$$ | awk '{print $1}') |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 267 | flags_duration="$flags_length$flags_interval" |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 268 | RUNALL_FLAGS=" $RUNALL_FLAGS -t $flags_duration" |
| 269 | fi |
| 270 | } |
| 271 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 272 | # Function: exectest_screenout |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 273 | # |
| 274 | # Description: Execute tests by calling runltp, display test status |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 275 | # in a window. |
| 276 | # |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 277 | # Input: none |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 278 | # |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 279 | # Output: messages printed by testcases. |
| 280 | exectest_screenout() |
| 281 | { |
| 282 | RC=0 # setting return code to 0, to loop in while |
| 283 | |
robbiew | 3b324ef | 2003-04-30 16:32:06 +0000 | [diff] [blame] | 284 | RESULTS_FILE=$(date +%Y-%m-%d.%H.%M.%S).$$ |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 285 | |
robbiew | fb0d934 | 2004-09-30 16:08:25 +0000 | [diff] [blame] | 286 | # execute runltp with user defined command file. |
| 287 | ./runltp -q -p $RUNALL_FLAGS -l results.$RESULTS_FILE \ |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 288 | -f /tmp/runltp.test.list.$$ |
| 289 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 290 | sleep 2 |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 291 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 292 | return |
| 293 | } |
| 294 | |
| 295 | |
| 296 | # Function: execute_ltp |
| 297 | # |
| 298 | # Description: This function provides a menu of testcases that can be |
| 299 | # selected for execution. If networking tests are selected, |
| 300 | # they require a remote machine and remote machines root |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 301 | # users password. The user will be prompted to enter this |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 302 | # information in a text box. |
| 303 | # The function checks to see if the ltp-mmddyy/testcases/bin |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 304 | # directory was created, this directory is created when the |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 305 | # testcases are compiled and installed, if it is not found |
| 306 | # an info message window will notify the user that LTP needs to |
| 307 | # be compiled before tests can be executed. |
| 308 | # This function creates the senatrio file based on the users |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 309 | # choice of testcases and uses the runltp script to |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 310 | # execute these tests. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 311 | # The messages printed by the testcases are displayed on this |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 312 | # terminal. |
| 313 | # |
| 314 | # Input: Users selection of testcases; scenario file. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 315 | # |
| 316 | # Output: Test selection window, Message window, |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 317 | # information message window |
| 318 | execute_ltp() |
| 319 | { |
| 320 | RC=0 |
| 321 | host_name=" " |
| 322 | rhost_passwd=" " |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 323 | run_net_test=" " |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 324 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 325 | if ! [ -d ./testcases/bin ] |
| 326 | then |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 327 | display_info_msg "Executing LTP testcases" \ |
| 328 | "The testcases must to be compiled inorder\ |
| 329 | to execute them. Returning to main menu. \ |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 330 | Please select the Compile option." |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 331 | return |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 332 | fi |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 333 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 334 | LIST=$(for i in `ls -1 -A -I "CVS" runtest`; do echo -n "$i "; j=$(head -n1 runtest/$i | cut -d: -f2|sed s/" "/_/g); echo -n "$j off "; done) |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 335 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 336 | --title "Execute LTP" --clear\ |
| 337 | --checklist "Select [SPACEBAR] tests to run" 20 80 5 \ |
| 338 | $LIST \ |
| 339 | 2>/tmp/runltp.choice.$$ || RC=$? |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 340 | size=`wc -m /tmp/runltp.choice.$$|awk '{print $1}'` |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 341 | if [ $size -eq 0 ];then |
| 342 | tst_choice=$(echo "NULL") |
| 343 | else |
| 344 | tst_choice=$(cat /tmp/runltp.choice.$$) |
| 345 | fi |
| 346 | if [[ $tst_choice == NULL ]];then |
| 347 | RC=1 |
| 348 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 349 | case $RC in |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 350 | 0) \ |
| 351 | for i in $tst_choice ; |
| 352 | do \ |
| 353 | cat ./runtest/$(echo $i | sed -e 's/"//g') \ |
| 354 | >> /tmp/runltp.test.list.$$ ; |
| 355 | if [[ $(echo $i | sed -e 's/"//g') == "tcp_cmds" || \ |
| 356 | $(echo $i | sed -e 's/"//g') == "tcp_cmds_noexpect" || \ |
| 357 | $(echo $i | sed -e 's/"//g') == "multicast" || \ |
| 358 | $(echo $i | sed -e 's/"//g') == "ipv6" || \ |
| 359 | $(echo $i | sed -e 's/"//g') == "ipv6_noexpect" || \ |
| 360 | $(echo $i | sed -e 's/"//g') == "nfs" || \ |
| 361 | $(echo $i | sed -e 's/"//g') == "multicast" ]] ; |
| 362 | then \ |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 363 | run_net_test="Y" ; |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 364 | fi ; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 365 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 366 | done ; |
| 367 | if ! [ -z $run_net_test ] ; |
| 368 | then \ |
| 369 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 370 | --title "Execute LTP test cases" \ |
| 371 | --clear \ |
| 372 | --inputbox "You have chosen to execute testcases \ |
| 373 | that require a Remote Machine. \ |
| 374 | Please enter the fully qualified host \ |
| 375 | name" 17 80 $(hostname --long) \ |
| 376 | 2>/tmp/runltp.out.$$ ; |
| 377 | host_name=$(cat /tmp/runltp.out.$$ | awk '{print $1}') ; |
| 378 | unset $RHOST ; |
| 379 | RHOST=$host_name ; |
| 380 | export RHOST; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 381 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 382 | dialog --backtitle "Linux Test Project Control Centre"\ |
| 383 | --title "Execute LTP test cases" \ |
| 384 | --clear \ |
| 385 | --inputbox " Please enter the root password \ |
| 386 | of this remote machine" 17 80 \ |
| 387 | 2>/tmp/runltp.out.$$ ; |
| 388 | rhost_passwd=$(cat /tmp/runltp.out.$$ | awk '{print $1}') ; |
| 389 | |
| 390 | PASSWD=$rhost_passwd ; |
| 391 | export PASSWD; |
| 392 | fi ; |
| 393 | |
| 394 | if ! [ -d ./testcases/bin ] ; |
| 395 | then \ |
| 396 | display_info_msg "Executing LTP testcases" \ |
| 397 | "The testcases must to be compiled inorder\ |
| 398 | to execute them. Returning to main menu. \ |
| 399 | Please select the Compile option." ; |
| 400 | return ; |
| 401 | fi ; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 402 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 403 | dialog --clear ; |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 404 | |
| 405 | flags_prompt ; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 406 | |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 407 | exectest_screenout ; |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 408 | |
| 409 | return ;; |
| 410 | 1) \ |
| 411 | # echo "Cancel pressed" ; |
| 412 | return ;; |
| 413 | 255) \ |
| 414 | # echo "ESC pressed" ; |
| 415 | return ;; |
| 416 | esac |
| 417 | } |
| 418 | |
| 419 | |
| 420 | # Function: about_ltpcc |
| 421 | # |
| 422 | # Description: This function displays a window containing a brief message |
| 423 | # describing this programs functionality, and credits the author. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 424 | # |
| 425 | # Input: NONE |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 426 | # |
| 427 | # Output: Message window, description of LTP Control Center. |
| 428 | about_ltpcc() |
| 429 | { |
| 430 | display_info_msg "About LTP Control Centre" \ |
| 431 | "The LTP Control Centre can be used to\ |
| 432 | to compile, install and execute\ |
| 433 | The Linux Test Project test suite. Written by\ |
| 434 | Manoj Iyer <manjo@mail.utexas.edu>" |
| 435 | return |
| 436 | } |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 437 | |
| 438 | |
| 439 | # Function: ltp_scenarios |
| 440 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 441 | # Description: This function displays a list of scenario files located |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 442 | # in /runtest. Users can list the contents of each file. |
| 443 | # |
| 444 | # Input: Files from /runtest |
| 445 | # |
| 446 | # Output: 1) Menu selection containing each file as an option to list. |
| 447 | # 2) Contents of selected scenario. |
| 448 | ltp_scenarios() |
| 449 | { |
| 450 | |
| 451 | RC=0 |
robbiew | 43fc249 | 2003-04-30 16:33:51 +0000 | [diff] [blame] | 452 | SCENARIOS=$(for i in `ls -1 -A -I "CVS" runtest`;do echo -n "$i [more...] "; done) |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 453 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 454 | while [ $RC -ne "1" ] |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 455 | do |
| 456 | dialog --clear |
| 457 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 458 | --title "LTP Scenario Files" \ |
| 459 | --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 8 \ |
| 460 | $SCENARIOS \ |
| 461 | 2>/tmp/runltp.scenario.$$ || RC=$? |
| 462 | scenario_item=$(cat /tmp/runltp.scenario.$$) |
| 463 | if ! [ -z $scenario_item ];then |
| 464 | dialog --clear |
| 465 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 466 | --title "LTP Scenario Files" \ |
| 467 | --textbox runtest/$scenario_item 17 70 |
| 468 | fi |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 469 | done |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 473 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 474 | # Function: main |
| 475 | # |
| 476 | # Description: Displays the main menu to the LTP Control Centre. The menu |
| 477 | # provides options to Compile, Execute, and View test execution |
| 478 | # results. |
| 479 | # |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 480 | # Calls: about_ltpcc() |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 481 | # compile_ltp() |
| 482 | # execute_ltp() |
| 483 | # disp_ltpres() |
| 484 | # |
| 485 | # Input: NONE |
| 486 | # |
| 487 | # Output: Menu selection of actions to perform. |
| 488 | |
| 489 | # Global variables. |
| 490 | RC=0 # return code from commands and local functions |
| 491 | mmenu_item=" " |
| 492 | RHOST=" " |
| 493 | PASSWD=" " |
robbiew | 5cc1381 | 2003-04-23 21:37:09 +0000 | [diff] [blame] | 494 | RUNALL_FLAGS=" " |
robbiew | 3b324ef | 2003-04-30 16:32:06 +0000 | [diff] [blame] | 495 | RESULTS_FILE=" " |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 496 | |
robbiew | dc61917 | 2004-09-30 16:13:06 +0000 | [diff] [blame] | 497 | # test for dialog program exist |
| 498 | if [ ! -x /usr/bin/dialog ]; then |
| 499 | echo "Sorry, ltpmenu GUI not available, can't find dialog. Exiting..."; |
| 500 | exit 1; |
| 501 | fi |
| 502 | |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 503 | # call cleanup function on program exit. |
| 504 | trap "cleanup" 0 |
| 505 | |
| 506 | |
| 507 | # wait in a loop until user hits [Cancel] button on the main menu. |
| 508 | while : |
| 509 | do |
| 510 | RC=0 |
| 511 | dialog --clear |
| 512 | dialog --backtitle "Linux Test Project Control Centre" \ |
| 513 | --title "Main Menu" \ |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 514 | --menu "Move using[UP] [DOWN], Select using [ENTER]" 15 70 5 \ |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 515 | About "About LTP Control Centre" \ |
| 516 | Compile "Compile LTP testsuite" \ |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 517 | Details "Details of scenario files" \ |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 518 | Execute "Execute LTP testsuite" \ |
| 519 | Results "Display a summary of test results" \ |
| 520 | 2>/tmp/runltp.mainmenu.$$ || RC=$? |
| 521 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 522 | case $RC in |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 523 | 0) mmenu_item=`cat /tmp/runltp.mainmenu.$$` ; |
| 524 | # echo "return code = $RC" ; |
| 525 | # echo "MENU ITEM = $mmenu_item" ; |
| 526 | case $mmenu_item in |
| 527 | About) about_ltpcc ;; |
| 528 | Compile) compile_ltp ;; |
robbiew | 99a0503 | 2003-04-17 13:53:02 +0000 | [diff] [blame] | 529 | Details) ltp_scenarios ;; |
robbiew | b2f68e5 | 2003-04-16 21:24:10 +0000 | [diff] [blame] | 530 | Execute) execute_ltp ;; |
| 531 | Results) disp_ltpres ;; |
| 532 | esac ;; |
| 533 | |
| 534 | 1) display_info_msg "Good Bye!" \ |
| 535 | "Thank you for using Linux Test Project test suite.\ |
| 536 | Please visit our project website \ |
| 537 | http://ltp.sourceforge.net \ |
| 538 | for latest news on The Linux Test Project. " |
| 539 | exit ;; |
| 540 | |
| 541 | 255) display_info_msg "Good Bye!" \ |
| 542 | "Thank you for using Linux Test Project test suite.\ |
| 543 | Please visit our project website\ |
| 544 | http://ltp.sourceforge.net for latest news\ |
| 545 | on The Linux Test Project. " |
| 546 | exit;; |
| 547 | esac |
| 548 | done |