summaryrefslogtreecommitdiff
path: root/scripts/qemuimage-testlib
diff options
context:
space:
mode:
authorJiajun Xu <jiajun.xu@intel.com>2010-08-14 01:52:38 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-13 23:42:03 +0100
commit8c498e5338cfcbf97a4b6a0064e45ed2b755b25d (patch)
treebfbc53091e1c48455e4de69bac4166b55dee0945 /scripts/qemuimage-testlib
parent6fc5bdd1bb7a922e59602cb8ae7153a92b19d3d6 (diff)
downloadopenembedded-core-8c498e5338cfcbf97a4b6a0064e45ed2b755b25d.tar.gz
openembedded-core-8c498e5338cfcbf97a4b6a0064e45ed2b755b25d.tar.bz2
openembedded-core-8c498e5338cfcbf97a4b6a0064e45ed2b755b25d.tar.xz
openembedded-core-8c498e5338cfcbf97a4b6a0064e45ed2b755b25d.zip
testlib: Add support for qemumips/qemuppc/qemux86-64, and add support for testing with images from autobuilder
Signed-off-by Jiajun Xu <jiajun.xu@intel.com>
Diffstat (limited to 'scripts/qemuimage-testlib')
-rw-r--r--scripts/qemuimage-testlib79
1 files changed, 72 insertions, 7 deletions
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index 4e27f8bc6..6dc219da2 100644
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -125,6 +125,71 @@ Test_Check_IP_UP()
fi
}
+# function to find kernel/rootfs image
+Test_Find_Image()
+{
+ where=""
+ kernel=""
+ arch=""
+ target=""
+ extension=""
+ rootfs=""
+
+ while getopts "l:k:a:t:" Option
+ do
+ case $Option in
+ l) where="$OPTARG"
+ ;;
+ k) kernel="$OPTARG"
+ extension="bin"
+ ;;
+ a) arch="$OPTARG"
+ ;;
+ t) target="$OPTARG"
+ extension="ext3"
+ ;;
+ *) echo "invalid option: -$Option" && return 1
+ ;;
+ esac
+ done
+
+ if [ ! -z $kernel ]; then
+ if [ -L ${where}/${kernel}-${arch}.${extension} ]; then
+ echo ${where}/${kernel}-${arch}.${extension}
+ return 0
+ else
+ for i in `dir ${where}`
+ do
+ echo $i | grep -q "${kernel}.*${arch}.*\.${extension}"
+ if [ $? -eq 0 ]; then
+ echo ${where}/${i}
+ return 0
+ fi
+ done
+ return 1
+ fi
+ fi
+
+ if [ ! -z $target ]; then
+ if [ -L ${where}/${target}-${arch}.${extension} ]; then
+ rootfs=`readlink -f ${where}/${target}-${arch}.${extension}`
+ echo ${rootfs}
+ return 0
+ else
+ for i in `dir ${where}`
+ do
+ echo $i | grep -q "${target}-${arch}.*\.${extension}"
+ if [ $? -eq 0 ]; then
+ echo ${where}/${i}
+ return 0
+ fi
+ done
+ return 1
+ fi
+ fi
+ return 1
+}
+
# function to check if qemu and its network
Test_Create_Qemu()
{
@@ -132,8 +197,6 @@ Test_Create_Qemu()
local up_time=0
local ip_addr=$1
local timeout=$2
- local kernel=""
- local rootfs=""
which poky-qemu
if [ $? -eq 0 ]; then
@@ -143,13 +206,15 @@ Test_Create_Qemu()
exit 1
fi
- if [ "$QEMUARCH" = "qemux86" ]; then
- KERNEL=${DEPLOY_DIR}/images/bzImage-${QEMUARCH}.bin
- elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then
- KERNEL=${DEPLOY_DIR}/images/zImage-${QEMUARCH}.bin
+ if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then
+ KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH})
+ elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" -o "$QEMUARCH" = "qemuppc" ]; then
+ KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH})
+ elif [ "$QEMUARCH" = "qemumips" ]; then
+ KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH})
fi
- ROOTFS_IMAGE=`readlink -f ${DEPLOY_DIR}/images/${QEMUTARGET}-${QEMUARCH}.ext3`
+ ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH})
TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3"
CP=`which cp`