From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Guo, Min" Date: Thu, 28 Nov 2002 12:52:46 +0000 Subject: RE: About test suites for linux hot plug Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org Here is my initial test suite for cPCI (ZT5084 platform) and Compaq with e100 and e1000 hotplug network devices, for the other hot plug device and features, I will give out the test suites later.=20 ----------------------------Shell test script for cPCI and Network PCI hotPlug platform----------------------------------------------------------- #!/bin/sh HOTSWAP_TEST_VERSION=3D"0.1" PCI_TOOLS=3D"lspci" HOT_SWAP_KEY=3D"06" COMPACTPCI_HOTPLUG_DEVICE=3D"" DRIVERS_NUMBER=3D`$PCI_TOOLS|awk '{print $1}'` HOT_PLUG_SUPPORT=FAlse HARD_PASS=FAlse value=3D"" link=3D"33" PCI_FILE=3D"pci_file" COMPAQ_PCI_HOTPLUG_DIR=3D"/pcihpfs" #function capfind is used to find the capbilities of PCI devices and see whether #there are some devices support the defined capbilities capfind() { link=3D$1 link_tmp=3D0x$link link_tmp=3D`echo $((link_tmp))` startadd=3D`expr $link_tmp / 16 + 2` mod $link offset=3D`echo $?` offset1=3D`expr $offset + 2` offset=3D`expr $offset + 3` link_offset=3D`echo $((offset))` value_offset=3D`echo $((offset1))` =09 value=3D`cat $PCI_FILE|head -n $startadd|tail -n 1|cut -d ' ' -f $value_offset` link=3D`cat $PCI_FILE|head -n $startadd|tail -n 1|cut -d ' ' -f $link_offset` } #The function to give out the mod number mod() { number_tmp=3D$1 number_tmp=3D0x$number_tmp number=3D`echo $((number_tmp))` while [ "$number" -ge "16" ];do number=3D`expr $number - 16` done return $number } #check which device have compact PCI hot_swap function #if have,give out the the results. check_hotplug_cap() { i=3D0 echo "" > cpci_hotswap for driver in $DRIVERS_NUMBER do #read the capbility number and verify whether the system has hotplug #controller #confighead=3D`lspci -s $driver -xxx|grep -v PCI'` lspci -s $driver -xxx > $PCI_FILE #find the frist capbility link of configure header while [ "$link" !=3D "00" ] do capfind $link=20 if [ "$value" =3D "$HOT_SWAP_KEY" ];then HOT_PLUG_SUPPORT=3Dtrue fi if [ "$HOT_PLUG_SUPPORT" =3D "true" ];then HARD_PASS=3Dtrue COMPACT_HOTPLUG_DEVICE=3D$driver echo $COMPACT_HOTPLUG_DEVICE >> cpci_hotswap echo "The hardware supports cPCI HotSwap function" descript=3D`lspci -s $driver` echo "The Compact PCI Hot Swap device is" \ $descript i=3D`expr $i + 1` fi done link=3D"33" HOT_PLUG_SUPPORT=3D"false" done if [ "$HARD_PASS" =3D "false" ];then echo "Hardware does not support cPCI HotSwap function" return 1 else return 0 fi } #Check whether the device still exist after we remove the compactPCI hot swap de #device check_after_remove() { cPCI_DEVICES=3D`cat cpci_hotswap` if [ "$cPCI_DEVICES" =3D "" ];then echo "There are no devices support cPCI hot plug function" exit 1 fi for device in $cPCI_DEVICES=20 do device=3D`lspci|grep "$device"|awk -F ":" '{print $3}'` if [ $? -eq 0 ];then echo $device "still be pluged or can not be removed successfully"=20 else echo $device "has been removed successfully" return 1 fi done return 0 } #the function is used to check the NET hot swap devices debug_on() { cp -f /sbin/hotplug /sbin/hotplug-bk sed -e 's/#DEBUG/DEBUG/' /sbin/hotplug-bk > /sbin/hotplug dmesg -c } #Auto Enable the hot plug pci_plug() { echo 1 > power } # Auto Disable the Hot plug pci_remove() { echo 0 > power=20 } check_pci_hardware() { =09 HARD_PASS_1=3Dtrue #check whether module has been inserted if [ -d $COMPAQ_PCI_HOTPLUG_DIR ];then cd $COMPAQ_PCI_HOTPLUG_DIR SUB_DIR=3D`ls` if [ "$SUB_DIR" =3D "" ];then echo "Hot Plug driver has not been installed" echo "Or there are no hot plug devices" exit 1 fi else exit 1 fi =09 for dir in $SUB_DIR do cd $dir pci_remove=20 cd .. done for dir in $SUB_DIR do cd $dir pci_plug value=3D`cat power` if [ $value -ne "1" ];then HARD_PASS_1=FAlse echo $HARD_PASS_1 echo "We can not Plug the devices automatically,so check your hardware" fi cd .. done if [ "$HARD_PASS_1" =3D "true" ];then echo "PASS1: HardWare Check" fi =09 } check_pci_hotplug_net_device() { SOFT_PASS=FAlse #check whether module has been inserted if [ -d $COMPAQ_PCI_HOTPLUG_DIR ];then cd $COMPAQ_PCI_HOTPLUG_DIR SUB_DIR=3D`ls` if [ "$SUB_DIR" =3D "" ];then exit 1 fi else exit 1 fi =09 for dir in $SUB_DIR do cd $dir pci_remove=20 cd .. done debug_on > /dev/null 2>&1 # Check whether the network inteface can be booted correctly. ethnum=3D`ifconfig|grep eth|wc -l` for dir in $SUB_DIR do SOFT_PASS=FAlse cd $dir pci_plug ethnum=3D`echo $((ethnum))` ifconfig|grep eth"$ethnum" >/dev/null 2>&1 if [ "$?" -eq 0 ];then echo "The pci hot plug device can been booted automatically" SOFT_PASS=3Dtrue else ifup eth"$ethnum" >/dev/null 2>&1 if [ "$?" -eq 0 ];then echo "The pci hotplug net device can been booted correcty" SOFT_PASS=3Dtrue else SOFT_PASS=FAlse echo "please check your network configuration or hotplug device driver" echo "the message in /var/log/messages will help you locate your error" fi fi =09 cd .. ethnum=3D`expr $ethnum + 1` done if [ $SOFT_PASS =3D "true" ];then echo "PASS2: The software check" fi } hotplug_check() { if [ $# -gt 0 ];then case "$1" in -l) check_hotplug_cap exit 0 ;; -c) check_after_remove $2 exit 0 ;; -n) check_pci_hotplug_net_device ;; -h) check_pci_hardware ;;=09 *) usage ;; esac fi }=20 usage() { cat << EOF Usage: hotplug_test [options]=20 options: --list|-l) list the devices that support CompactPCI hotpwap --platform|-p) platform type (cPCI|PCI_NET|PCI_SCSI) --help|-h) help=20 --version|-v) version device: device address =20 example: hotplug_test -p=3DcPCI EOF exit $1 } if [ $# -eq 0 ];then usage exit fi for option do case "$option" in -*=3D*)=20 optarg=3D`echo "$option" | sed 's/[-_a-zA-Z0-9]*=3D//'` option=3D`echo "$option"|sed 's/=3D.*$//'` ;; *) optarg=3D'' ;; esac case "$option" in --help|-h) echo "Usage: $usage" exit 0 ;; --version|-v) echo "version is" $HOTSWAP_TEST_VERSION exit 0 ;; --platform|-p) case "$optarg" in cPCI) hotplug_check -c=20 ;;=09 PCI_NET) hotplug_check -h hotplug_check -n ;; *) usage exit 1 ;; esac ;; --list|-l) echo "only echo the Devices support cPCI hot swap function" hotplug_check -l exit 1 ;;=09 *) usage exit 1 ;; esac done ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -------------------- Best Regards Guo Min=20 The content of this email message solely contains my own personal views. -----Original Message----- From: Greg KH [mailto:greg@kroah.com] Sent: Thursday, November 28, 2002 12:32 AM To: Guo, Min Cc: David Brownell; Linux-hotplug-devel@lists.sourceforge.net; Wang, Frank; Rusty Lynch; Xie, May Subject: Re: About test suites for linux hot plug On Wed, Nov 27, 2002 at 04:44:44PM +0800, Guo, Min wrote: > Hi >=20 > Thanks for your perfect work! I am interested in the Linux hot swap > project and now doing some validation work about the compactPCI hot > swap. So could you please tell me whether there are some test suites > for linux hot plug, if not, I'd like to write some test suites for the > project! If you take a look at the archives for this list, you will see we just talked about this with another intel employee (who you also copied on the message) :) In short, no there aren't any. Also, this is probably the wrong list for cPCI hotplug specific stuff. > If you agree, could you please give me some requirements and > suggestion about the test suites? Requirements: - whatever makes you, and your employer happy. In short, write up whatever you want and need, and if you could, post it to the list for others to use in the future if they want to do the same. thanks, greg k-h ------------------------------------------------------- This SF.net email is sponsored by: Get the new Palm Tungsten T=20 handheld. Power & Color in a compact size!=20 http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel