From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dan.rpsys.net ([93.97.175.187]) by linuxtogo.org with esmtp (Exim 4.72) (envelope-from ) id 1UajwW-0004HN-Uy for openembedded-core@lists.openembedded.org; Fri, 10 May 2013 11:48:54 +0200 Received: from localhost (dan.rpsys.net [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r4A9X2xE022710; Fri, 10 May 2013 10:33:02 +0100 X-Virus-Scanned: Debian amavisd-new at dan.rpsys.net Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id klDTNXW0BI-R; Fri, 10 May 2013 10:33:02 +0100 (BST) Received: from [192.168.3.10] (rpvlan0 [192.168.3.10]) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-2.1ubuntu1) with ESMTP id r4A9WvrJ022688 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NOT); Fri, 10 May 2013 10:32:59 +0100 Message-ID: <1368178218.11129.10.camel@ted> From: Richard Purdie To: Stefan Stanacar Date: Fri, 10 May 2013 10:30:18 +0100 In-Reply-To: <1368177721-28945-1-git-send-email-stefanx.stanacar@intel.com> References: <1368177721-28945-1-git-send-email-stefanx.stanacar@intel.com> X-Mailer: Evolution 3.6.2-0ubuntu0.1 Mime-Version: 1.0 Cc: openembedded-core@lists.openembedded.org Subject: Re: [PATCH] qemuimage-testlib: test all supported FSTYPES X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 May 2013 09:49:03 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Fri, 2013-05-10 at 12:22 +0300, Stefan Stanacar wrote: > Right now qemuimage-testlib hardcodes ext3 as fs type. > We should respect IMAGE_FSTYPES and boot all images > that runqemu supports. > > Signed-off-by: Stefan Stanacar > --- > meta/classes/imagetest-qemu.bbclass | 25 ++++++++++++++----------- > scripts/qemuimage-testlib | 21 ++++++++++----------- > 2 files changed, 24 insertions(+), 22 deletions(-) > > diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass > index 94bed3b..ee1c699 100644 > --- a/meta/classes/imagetest-qemu.bbclass > +++ b/meta/classes/imagetest-qemu.bbclass > @@ -37,6 +37,7 @@ def qemuimagetest_main(d): > resultstr = re.compile(r'\s*(?P\w+)\s*(?P\d+)\s*(?P\d+)\s*(?P\d+)') > machine = d.getVar('MACHINE', True) > pname = d.getVar('PN', True) > + fstypes = d.getVar("IMAGE_FSTYPES", True).split() > > """function to save test cases running status""" > def teststatus(test, status, index, length): > @@ -50,7 +51,7 @@ def qemuimagetest_main(d): > f.close() > > """funtion to run each case under scenario""" > - def runtest(scen, case, fulltestpath): > + def runtest(scen, case, fulltestpath, fstype): > resultpath = d.getVar('TEST_RESULT', True) > tmppath = d.getVar('TEST_TMP', True) > > @@ -75,6 +76,7 @@ def qemuimagetest_main(d): > os.environ["TEST_SERIALIZE"] = d.getVar("TEST_SERIALIZE", True) > os.environ["SDK_NAME"] = d.getVar("SDK_NAME", True) > os.environ["RUNQEMU_LOGFILE"] = d.expand("${T}/log.runqemutest.%s" % os.getpid()) > + os.environ["ROOTFS_EXT"] = fstype > > # Add in all variables from the user's original environment which > # haven't subsequntly been set/changed > @@ -193,21 +195,22 @@ def qemuimagetest_main(d): > os.remove(sresultfile) > subprocess.call("touch %s" % resultfile, shell=True) > os.symlink(resultfile, sresultfile) > - f = open(sresultfile, "a") > - f.write("\tTest Result for %s %s\n" % (machine, pname)) > - f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT")) > - f.close() > > """generate pre-defined testcase list""" > testlist = d.getVar('TEST_SCEN', True) > fulllist = generate_list(testlist) > > """Begin testing""" > - for index,test in enumerate(fulllist): > - (scen, case, fullpath) = test > - teststatus(case, "running", index, (len(fulllist) - 1)) > - runtest(scen, case, fullpath) > - teststatus(case, "finished", index, (len(fulllist) - 1)) > + for type in fstypes: > + if type not in [ "tar.bz2", "live", "cpio.gz" ]: Can we list the types we do support here rather than the ones we don't please? > + with open(sresultfile, "a") as f: > + f.write("\tTest Result for %s %s %s\n" % (machine, pname, type)) > + f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT")) > + for index,test in enumerate(fulllist): > + (scen, case, fullpath) = test > + teststatus(case, "running", index, (len(fulllist) - 1)) > + runtest(scen, case, fullpath, type) > + teststatus(case, "finished", index, (len(fulllist) - 1)) > > """Print Test Result""" > ret = 0 > @@ -230,5 +233,5 @@ def qemuimagetest_main(d): > clean_tmp() > > if ret != 0: > - raise bb.build.FuncFailed("Some testcases fail, pls. check test result and test log!!!") > + raise bb.build.FuncFailed("Some tests failed. Please check the results file: %s and the log files found in: %s." % (resultsfile, d.getVar('TEST_LOG', True))) > > diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib > index 051fee8..4159312 100755 > --- a/scripts/qemuimage-testlib > +++ b/scripts/qemuimage-testlib > @@ -14,8 +14,6 @@ > # Version 2. > # > > -TYPE="ext3" > - > # The folder to hold all scripts running on targets > TOOLS="$COREBASE/scripts/qemuimage-tests/tools" > > @@ -306,19 +304,19 @@ Test_Find_Image() > extension="" > rootfs="" > > - while getopts "l:k:a:t:" Option > + while getopts "l:k:a:t:e:" Option > do > case $Option in > l) where="$OPTARG" > ;; > k) kernel="$OPTARG" > - extension="bin" > ;; > a) arch="$OPTARG" > ;; > t) target="$OPTARG" > - extension="ext3" > ;; > + e) extension="$OPTARG" > + ;; Indentation looks a little wrong here and elsewhere in this patch. Cheers, Richard > *) echo "invalid option: -$Option" && return 1 > ;; > esac > @@ -396,11 +394,11 @@ Test_Create_Qemu() > fi > > if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then > - KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH}) > + KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH} -e "bin") > elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then > KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH}) > elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then > - KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH}) > + KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH} -e "bin") > fi > > # If there is no kernel image found, return failed directly > @@ -409,7 +407,8 @@ Test_Create_Qemu() > return 1 > fi > > - ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH}) > + Test_Info "rootfs image extension selected: $ROOTFS_EXT" > + ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH} -e "$ROOTFS_EXT") > > # If there is no rootfs image found, return failed directly > if [ $? -eq 1 ]; then > @@ -417,7 +416,7 @@ Test_Create_Qemu() > return 1 > fi > > - TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3" > + TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.${ROOTFS_EXT}" > > CP=`which cp` > > @@ -438,8 +437,8 @@ Test_Create_Qemu() > export MACHINE=$QEMUARCH > > # Create Qemu in localhost VNC Port 1 > - echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60' &" > - xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60" & > + echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} ${ROOTFS_EXT} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60' &" > + xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} ${ROOTFS_EXT} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60" & > > # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu > XTERMPID=$!