From: "Guo, Min" <min.guo@intel.com>
To: linux-hotplug@vger.kernel.org
Subject: RE: About test suites for linux hot plug
Date: Thu, 28 Nov 2002 12:52:46 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-103848831820866@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-103838709921894@msgid-missing>
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.
----------------------------Shell test script for cPCI and Network PCI
hotPlug platform-----------------------------------------------------------
#!/bin/sh
HOTSWAP_TEST_VERSION="0.1"
PCI_TOOLS="lspci"
HOT_SWAP_KEY="06"
COMPACTPCI_HOTPLUG_DEVICE=""
DRIVERS_NUMBER=`$PCI_TOOLS|awk '{print $1}'`
HOT_PLUG_SUPPORTúlse
HARD_PASSúlse
value=""
link="33"
PCI_FILE="pci_file"
COMPAQ_PCI_HOTPLUG_DIR="/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=$1
link_tmp=0x$link
link_tmp=`echo $((link_tmp))`
startadd=`expr $link_tmp / 16 + 2`
mod $link
offset=`echo $?`
offset1=`expr $offset + 2`
offset=`expr $offset + 3`
link_offset=`echo $((offset))`
value_offset=`echo $((offset1))`
value=`cat $PCI_FILE|head -n $startadd|tail -n 1|cut -d ' ' -f
$value_offset`
link=`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=$1
number_tmp=0x$number_tmp
number=`echo $((number_tmp))`
while [ "$number" -ge "16" ];do
number=`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=0
echo "" > cpci_hotswap
for driver in $DRIVERS_NUMBER
do
#read the capbility number and verify whether the system has hotplug
#controller
#confighead=`lspci -s $driver -xxx|grep -v PCI'`
lspci -s $driver -xxx > $PCI_FILE
#find the frist capbility link of configure header
while [ "$link" != "00" ]
do
capfind $link
if [ "$value" = "$HOT_SWAP_KEY" ];then
HOT_PLUG_SUPPORT=true
fi
if [ "$HOT_PLUG_SUPPORT" = "true" ];then
HARD_PASS=true
COMPACT_HOTPLUG_DEVICE=$driver
echo $COMPACT_HOTPLUG_DEVICE >> cpci_hotswap
echo "The hardware supports cPCI HotSwap
function"
descript=`lspci -s $driver`
echo "The Compact PCI Hot Swap device is" \
$descript
i=`expr $i + 1`
fi
done
link="33"
HOT_PLUG_SUPPORT="false"
done
if [ "$HARD_PASS" = "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=`cat cpci_hotswap`
if [ "$cPCI_DEVICES" = "" ];then
echo "There are no devices support cPCI hot plug function"
exit 1
fi
for device in $cPCI_DEVICES
do
device=`lspci|grep "$device"|awk -F ":" '{print $3}'`
if [ $? -eq 0 ];then
echo $device "still be pluged or can not be removed
successfully"
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
}
check_pci_hardware()
{
HARD_PASS_1=true
#check whether module has been inserted
if [ -d $COMPAQ_PCI_HOTPLUG_DIR ];then
cd $COMPAQ_PCI_HOTPLUG_DIR
SUB_DIR=`ls`
if [ "$SUB_DIR" = "" ];then
echo "Hot Plug driver has not been installed"
echo "Or there are no hot plug devices"
exit 1
fi
else
exit 1
fi
for dir in $SUB_DIR
do
cd $dir
pci_remove
cd ..
done
for dir in $SUB_DIR
do
cd $dir
pci_plug
value=`cat power`
if [ $value -ne "1" ];then
HARD_PASS_1úlse
echo $HARD_PASS_1
echo "We can not Plug the devices
automatically,so check your hardware"
fi
cd ..
done
if [ "$HARD_PASS_1" = "true" ];then
echo "PASS1: HardWare Check"
fi
}
check_pci_hotplug_net_device()
{
SOFT_PASSúlse
#check whether module has been inserted
if [ -d $COMPAQ_PCI_HOTPLUG_DIR ];then
cd $COMPAQ_PCI_HOTPLUG_DIR
SUB_DIR=`ls`
if [ "$SUB_DIR" = "" ];then
exit 1
fi
else
exit 1
fi
for dir in $SUB_DIR
do
cd $dir
pci_remove
cd ..
done
debug_on > /dev/null 2>&1
# Check whether the network inteface can be booted correctly.
ethnum=`ifconfig|grep eth|wc -l`
for dir in $SUB_DIR
do
SOFT_PASSúlse
cd $dir
pci_plug
ethnum=`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=true
else
ifup eth"$ethnum" >/dev/null 2>&1
if [ "$?" -eq 0 ];then
echo "The pci hotplug net device can
been booted correcty"
SOFT_PASS=true
else
SOFT_PASSúlse
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
cd ..
ethnum=`expr $ethnum + 1`
done
if [ $SOFT_PASS = "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
;;
*)
usage
;;
esac
fi
}
usage()
{
cat << EOF
Usage: hotplug_test [options]
options:
--list|-l)
list the devices that support CompactPCI hotpwap
--platform|-p)
platform type (cPCI|PCI_NET|PCI_SCSI)
--help|-h)
help
--version|-v)
version
device:
device address
example:
hotplug_test -p=cPCI
EOF
exit $1
}
if [ $# -eq 0 ];then
usage
exit
fi
for option
do
case "$option" in
-*=*)
optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'`
option=`echo "$option"|sed 's/=.*$//'`
;;
*) optarg='' ;;
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
;;
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
;;
*)
usage
exit 1
;;
esac
done
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------------------
Best Regards
Guo Min
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
>
> 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
handheld. Power & Color in a compact size!
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
next prev parent reply other threads:[~2002-11-28 12:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-27 8:44 About test suites for linux hot plug Guo, Min
2002-11-27 16:32 ` Greg KH
2002-11-27 19:38 ` David Brownell
2002-11-28 12:52 ` Guo, Min [this message]
2002-11-29 21:24 ` Scott Murray
2002-12-02 0:59 ` Guo, Min
2002-12-26 7:32 ` Guo, Min
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-103848831820866@msgid-missing \
--to=min.guo@intel.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).