#!/bin/sh # this script runs on UW7, OSR5, and UW2 so Bourne shell only... # # %W% %G% %U% # # # force C locale LC_ALL=C; export LC_ALL # while leaving DISPLAY set can cause problems, we allow it. # unset DISPLAY # This script is only installed when the user has selected the Unisoft # test suite. it is part of the "uts" packaging class. We then know that # our postinstall has created a symlink telling us where TET_ROOT should # point. We use that instead of relying on pkgparam (OSR5 consideration) #TET_ROOT=/usr/src/ihvkit/display/test/xsuite TET_ROOT=`pkgparam xtests TETROOT 2>/dev/null` if [ "${TET_ROOT}" = "" ] ; then # user did not want to install the Unisoft Test Suite when xtests # installed or some kind of pkgparam error occurred. Should # not happen. echo "Unisoft Test Suite not installed, aborting." exit 1 fi OS=`pkgparam xtests OS 2>/dev/null` if [ "${OS}" = "" ] ; then echo "Unknown OS, terminating." exit 1 fi NEEDUDK=`pkgparam xtests NEEDUDK 2>/dev/null` if [ "${NEEDUDK}" = "true" ] ; then if [ "${OS}" = "OSR5" ] ; then ADD1="(requires UDK compiler and xdevsys packages from UDK)" ADD2="(requires OSRcompat package from UDK)" elif [ "${OS}" = "UW2" ] ; then ADD1="(requires UDK compiler and xdevsys packages from UDK)" ADD2="(requires UW2compat package from UDK)" else ADD1="(requires xdevsys packages from UDK)" ADD2="" fi else ADD1="" ADD2="" fi TET_TMP_DIR=/usr/tmp # use UDK binaries first to use UDK [compiler] if running on OpenServer # otherwise put both /usr/X/bin and /usr/bin/X11 styles in PATH # when looking for xdpyinfo and xset. Need /bin and /usr/bin for things # like cut PATH=/udk/bin:/udk/usr/bin:/udk/usr/ccs/bin:/udk/usr/X/bin:/bin:/usr/bin:/usr/X/bin:${TET_ROOT}/scripts:${TET_ROOT}/xtest/bin:/usr/bin/X11:/usr/X11R6.1/bin:$PATH TTY=`tty` # XSERVER correct for UW7/OSR5 too XSERVER=/usr/bin/X11/X # Change this to run other X servers # default is /usr/bin/X11/X CFG_ORIG=tetexec.cfg.orig # Create other cfg templates for custom runs # default is tetexec.cfg.orig GRAFDEV=/usr/lib/grafinfo/grafdev # only present on UW7 and OSR5 export TET_ROOT PATH TET_TMP_DIR ServerTty() { # $1 is server process ID. # do not use awk, the WCHAN column may/may not have value # which skew field numbers depending on if server blocked at this # instant. UW7 prints tty with printf(" %-7.14s", tp); ##ps -lp $1 | awk '/X/ {print $13}' if [ "${OS}" = "UW7" ] ; then ps -lp $1 | tail -1 | cut -c64-78 | awk '{print $1}' elif [ "${OS}" = "UW2" ] ; then ps -lp $1 | tail -1 | cut -c61-75 | awk '{print $1}' elif [ "${OS}" = "OSR5" ] ; then # has field of at least 7 chars bit, no limit ps -lp $1 | tail -1 | cut -c60-80 | awk '{print $1}' fi } cd ${TET_ROOT} while true do if [ "${OS}" = "OSR5" ] ; then echo "\nPlease select one of the following tasks:" echo "1 Build the test suite${ADD1}" echo "2 Run the test suite${ADD2}" echo "3 Generate report from the most recent run" echo "4 Exit" echo "" echo -n "Enter selection [?,??]: " read TASK else TASK=`ckitem -Q -uo -l "Please select one of the following tasks:" \ "1 Build the test suite${ADD1}" \ "2 Run the test suite${ADD2}" \ "3 Generate report from the most recent run" \ "4 Exit"` fi case "${TASK}" in ########################################################### # build using UDK compiler if on OSR5 (revised PATH) # This can take quite a long time depending on the machine. My trick is # to move /bin/make out of the way, create a new /bin/make which echos its # arguments to some tty, then invokes the real make binary. This way you # can track the progress of the build. # # Common problem here is that cc cannot find Xlib.h as xdevsys package has # not been installed yet, tsk tsk. 1) echo "Building tests. This can take a long time, please wait..." make build;; ########################################################### 2) if [ "${OS}" = "OSR5" -o "${OS}" = "UW2" ] ; then # no ckstr on UW2 echo "\nPlease specify the hostname of the machine to which the display is" echo -n "physically attached (default: localhost) [?] " read DH if [ "${DH}" = "" ] ; then DH="localhost" fi echo "\nPlease specify the display and screen to run the test for:" echo " 1 :0.0" echo " 2 :1.0" echo " 3 :2.0" echo " 4 :3.0" echo " 5 :4.0" echo " 6 :5.0" echo "" echo -n "Enter selection (default: :5.0) [?,??]: " read DP if [ "${DP}" = "" ] ; then DP=":5.0" else case "${DP}" in 1) DP=":0.0";; 2) DP=":1.0";; 3) DP=":2.0";; 4) DP=":3.0";; 5) DP=":4.0";; 6) DP=":5.0";; *) DP=":5.0";; esac fi else DH=`ckstr -Q -p \ "Please specify the hostname of the machine to which the display is physically attached" \ -d localhost` DP=`ckitem -Q -o -l \ "Please specify the display and screen to run the test for:" \ -d ":5.0" :0.0 :1.0 :2.0 :3.0 :4.0 :5.0` fi if [ "${DH}" = "localhost" ] ; then echo "Starting ${XSERVER} on ${DH}${DP}" # note this will use UDK version of uname when # run on UW2 and OSR5 due to revised PATH DH=`uname -n` ${XSERVER} ${DP} & S_PID=$! TTY=/dev/`ServerTty ${S_PID}` sleep 10 kill -0 ${S_PID} 2>/dev/null || { echo "trouble starting X server, terminating." exit 1 } else echo "On the remote host ${DH}, please run:" echo " ${XSERVER} ${DP}" echo " DISPLAY=unix${DP}; export DISPLAY" echo " xhost + `uname -n` " if [ "${OS}" = "OSR5" ] ; then # no help option here echo -n "\nIs the remote X server started successfully (default: y) [yes,no,quit] " read junk if [ "${junk}" != "" -a "${junk}" != "y" -a "${junk}" != "yes" -a "${junk}" != "Yes" ] ; then echo "Please run the UTS test suite at a later time." exit 2 fi else # UW2 or UW7 if [ `ckyorn -d y -p "Is the remote X server started successfully"` != y ] ; then echo "Please run the UTS test suite at a later time." exit 2 fi # if remote X server started fi # if running on OSR5 fi # if display host is localhost echo -n "Generating xtest/tetexec.cfg ..." TMPFILE=/tmp/xdpyinfo.${DH}${DP} # we hope X server has started by now, if not this will fail. xdpyinfo -display ${DH}${DP} > ${TMPFILE} 2>/dev/null || { echo "" echo "ERROR!" echo "Could not obtain display information from the X server running" echo "on ${DH}${DP}. Perhaps the X server had trouble starting?" echo "Terminating." exit 1 } # pixmap depth PMD=`grep "depths (" ${TMPFILE} | cut -d ":" -f 2 | awk '{print $1 $2}' | tr "," " "` # black pixel value BP=`grep black ${TMPFILE} | cut -d ":" -f 2 | cut -d "," -f 1 | awk '{print $2}'` # white pixel value WP=`grep white ${TMPFILE} | cut -d ":" -f 2 | cut -d "," -f 2 | awk '{print $2}'` # height mm HMM=`grep millimeters ${TMPFILE} | cut -d "(" -f 2 | cut -d "x" -f 2 | awk '{print $1}'` # width mm WMM=`grep millimeters ${TMPFILE} | cut -d "(" -f 2 | cut -d "x" -f 1` # vendor string VS=`grep "vendor string" ${TMPFILE} | cut -d ":" -f 2 | cut -d " " -f 5-` # vendor release VR=`grep "vendor release number" ${TMPFILE} | cut -d ":" -f 2 | cut -d " " -f 5-` # motion buffer size MBS=`grep "motion buffer size" ${TMPFILE} | cut -d ":" -f 2 | cut -d " " -f 3-` awk -f scripts/tetexec.awk \ DH="${DH}" DP="${DP}" PMD="${PMD}" BP="${BP}" WP="${WP}" \ HMM="${HMM}" WMM="${WMM}" VS="${VS}" VR="${VR}" MBS="${MBS}" \ < xtest/${CFG_ORIG} > xtest/tetexec.cfg /bin/rm -f ${TMPFILE} echo "Done." # when adding fonts we # can not use /usr/lib/X11/fonts/xtest directory # in line below because prototype file does not use this # directory and each OS has symlink mappings for fonts; must # use same directory as found in prototype to ensure # xset can find and use it. # xset fp+ /usr/lib/X11/fonts/xtest -display ${DH}${DP} xset fp+ /usr/X/lib/X11/fonts/xtest -display ${DH}${DP} # build using UDK compiler if on OSR5 (revised PATH) make exec if [ ! -z "${S_PID}" ] then kill -15 ${S_PID} sleep 5 fi;; ########################################################### 3) if [ ! -d reports ] then mkdir reports > /dev/null 2>&1 fi if [ -n "${S_PID}" ]; then RptID="${S_PID}" else RptID=$$ fi # results directory should be there, check to make sure if [ ! -d xtest/results ] ; then echo "${TET_ROOT}/xtest/results directory not found, aborting" exit 1 fi # empty is a zero length file in the results directory NUM=`ls -1 xtest/results | grep -v empty | tail -1` # latest journal if [ ${NUM} = "" ] then echo "No journal present in ${TET_ROOT}/xtest/results." else JOURNAL=`ls -rt xtest/results/*e/journal | tail -1` echo -n "Generating reports for journal file: ${JOURNAL}" # UW2 does not have grafinfo file, must prompt user if [ "${OS}" = "UW2" ] ; then echo "Please select the TTY on which the tests were run(possibly ${TTY})," echo -n "including /dev/ " read TTY else # UW7 or OSR5, use grafdev if available if [ ! -f ${GRAFDEV} ] ; then if [ "${OS}" = "UW7" ] ; then CHOICES="/dev/vt01 /dev/vt02 /dev/vt03 /dev/vt04 /dev/vt05 /dev/vt06 /dev/vt07 /dev/vt08 /dev/vt09 /dev/vt10 /dev/vt11 /dev/vt12" fi if [ "${OS}" = "OSR5" ] ; then CHOICES="/dev/console /dev/tty01 /dev/tty02 /dev/tty03 /dev/tty04 /dev/tty05 /dev/tty06 /dev/tty07 /dev/tty08 /dev/tty09 /dev/tty10 /dev/tty11 /dev/tty12" fi else CHOICES=`cat ${GRAFDEV} | cut -d ":" -f 1` fi if [ "${OS}" = "OSR5" ] ; then echo "\nPlease type the name of the TTY on which the tests " echo "were run from the list below:" echo ${CHOICES} echo "" echo -n "Type the full device name including /dev " read TTY else TTY=`ckitem -Q -o -l "Please select the TTY on which the tests were run:" -d "/dev/vt01" $CHOICES` fi fi echo "Generating reports for journal file: ${JOURNAL} ... \c" if [ -f ${GRAFDEV} ] ; then junk=`grep ${TTY} ${GRAFDEV}` else # UW2, do not both calling xdpyinfo for these values. junk="/some/path:unknown.adapter.resolution.color" fi FILE=`echo ${junk} | cut -d ":" -f 2`.${RptID}.`basename ${XSERVER}` header ${TTY} ${XSERVER} ${JOURNAL} > reports/${FILE}.fail rpt -s > reports/${FILE}.verbose all_summary ${JOURNAL} >> reports/${FILE}.fail nopass reports/${FILE}.verbose >> reports/${FILE}.fail echo "\nDone. Reports are saved as ${TET_ROOT}/reports/${FILE}.fail\n\tand ${FILE}.verbose." fi;; ########################################################### 4) exit 0;; ########################################################### *) echo "Unexpected argument ${TASK}";; esac done