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