Skip to contentSkip to conversation

qemuimagetest: Enable toolchain automation tests in qemuimagetest

PATCH RESEND New Jiajun Xu 1 participant 2 messages May 3, 2011

lore
Share & tools
lore

Jiajun Xu

author
#0 lore raw

cover qemuimagetest: Enable toolchain automation tests in qemuimagetest

From: Jiajun Xu <[email protected]>

Three C/C++ test projects are added to test toolchain - cvs, iptables and sudoku-savant. User needs to set TEST_SCEN to "toolchain" in local.conf to enable tests. Test case will check if toolchain tarball exists under "${DEPLOY_DIR}/sdk". And it will extract toolchain tarball into /opt. It requires user to chown /opt to non-root user, who will run qemuimagetest.

Update the patch by inherit imagetest-qemu in meta-toolchain instead of populate_sdk.

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: jxu49/master
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jxu49/master

Thanks,
Jiajun Xu <[email protected]>
---

Jiajun Xu (1):
qemuimagetest: Enable toolchain automation tests in qemuimagetest

 meta-yocto/conf/local.conf.sample                  |    2 +-
 meta/classes/imagetest-qemu.bbclass                |    9 +-
 meta/recipes-core/meta/meta-toolchain.bb           |    3 +-
 scripts/qemuimage-testlib                          |  232 +++++++++++++++++++-
 .../scenario/qemuarm/meta-toolchain-gmae           |    3 +
 .../scenario/qemumips/meta-toolchain-gmae          |    3 +
 .../scenario/qemuppc/meta-toolchain-gmae           |    3 +
 .../scenario/qemux86-64/meta-toolchain-gmae        |    3 +
 .../scenario/qemux86/meta-toolchain-gmae           |    3 +
 scripts/qemuimage-tests/toolchain/cvs              |   31 +++
 scripts/qemuimage-tests/toolchain/iptables         |   31 +++
 scripts/qemuimage-tests/toolchain/sudoku-savant    |   31 +++
 12 files changed, 349 insertions(+), 5 deletions(-)
 create mode 100644 scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/toolchain/cvs
 create mode 100644 scripts/qemuimage-tests/toolchain/iptables
 create mode 100644 scripts/qemuimage-tests/toolchain/sudoku-savant
author
#1 lore raw

PATCH 1/1 qemuimagetest: Enable toolchain automation tests in qemuimagetest

From: Jiajun Xu <[email protected]>

Enable toolchain automation tests in qemuimagetest framework. 3 C/C++ test projects are added to test toolchain - cvs, iptables and sudoku-savant. User needs to set TEST_SCEN to "toolchain" in local.conf to enable tests. Test case will check if toolchain tarball exists under "${DEPLOY_DIR}/sdk". And it will extract toolchain tarball into /opt. It requires user to chown /opt to non-root user, who will run qemuimagetest.

Signed-off-by Jiajun Xu <[email protected]>

---
 meta-yocto/conf/local.conf.sample                  |    2 +-
 meta/classes/imagetest-qemu.bbclass                |    9 +-
 meta/recipes-core/meta/meta-toolchain.bb           |    3 +-
 scripts/qemuimage-testlib                          |  232 +++++++++++++++++++-
 .../scenario/qemuarm/meta-toolchain-gmae           |    3 +
 .../scenario/qemumips/meta-toolchain-gmae          |    3 +
 .../scenario/qemuppc/meta-toolchain-gmae           |    3 +
 .../scenario/qemux86-64/meta-toolchain-gmae        |    3 +
 .../scenario/qemux86/meta-toolchain-gmae           |    3 +
 scripts/qemuimage-tests/toolchain/cvs              |   31 +++
 scripts/qemuimage-tests/toolchain/iptables         |   31 +++
 scripts/qemuimage-tests/toolchain/sudoku-savant    |   31 +++
 12 files changed, 349 insertions(+), 5 deletions(-)
 create mode 100644 scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae
 create mode 100644 scripts/qemuimage-tests/toolchain/cvs
 create mode 100644 scripts/qemuimage-tests/toolchain/iptables
 create mode 100644 scripts/qemuimage-tests/toolchain/sudoku-savant
meta-yocto/conf/local.conf.sample +1 -1
index 740f542..5cf3b26 100644
@@ -175,7 +175,7 @@ ENABLE_BINARY_LOCALE_GENERATION = "1"
 # By default test cases in sanity suite will be ran. If you want to run other 
 # test suite or specific test case(e.g. bat or boot test case under sanity suite), 
 # list them like following.
-#TEST_SCEN = "sanity bat sanity:boot"
+#TEST_SCEN = "sanity bat sanity:boot toolchain"
 
 #Because of the QEMU booting slowness issue(see bug #646 and #618), autobuilder
 #may suffer a timeout issue when running sanity test. We introduce variable
meta/classes/imagetest-qemu.bbclass +7 -2
index daeb8d8..e259ae9 100644
@@ -27,6 +27,7 @@ def qemuimagetest_main(d):
     import sys
     import re
     import os
+    import shutil
     
     """
     Test Controller for automated testing.
@@ -72,6 +73,7 @@ def qemuimagetest_main(d):
         os.environ["TEST_STATUS"] = bb.data.getVar("TEST_STATUS", d, True)
         os.environ["TARGET_IPSAVE"] = bb.data.getVar("TARGET_IPSAVE", d, True)
         os.environ["TEST_SERIALIZE"] = bb.data.getVar("TEST_SERIALIZE", d, True)
+        os.environ["SDK_NAME"] = bb.data.getVar("SDK_NAME", d, True)
 
         """run Test Case"""
         bb.note("Run %s test in scenario %s" % (case, scen))
@@ -120,7 +122,10 @@ def qemuimagetest_main(d):
         if os.path.isdir(tmppath):
             for f in os.listdir(tmppath):
                 tmpfile = os.path.join(tmppath, f)
-                os.remove(tmpfile)
+		if os.path.isfile(tmpfile):
+                    os.remove(tmpfile)
+                elif os.path.isdir(tmpfile):
+                    shutil.rmtree(tmpfile, True)
 
     """Before running testing, clean temp folder first"""
     clean_tmp()
@@ -154,7 +159,7 @@ def qemuimagetest_main(d):
     os.system("touch %s" % resultfile)
     os.symlink(resultfile, sresultfile)
     f = open(sresultfile, "a")
-    f.write("\tTest Result for %s\n" % machine)
+    f.write("\tTest Result for %s %s\n" % (machine, pname))
     f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT"))
     f.close()
     
meta/recipes-core/meta/meta-toolchain.bb +2 -1
index 94c8a91..ab98bf9 100644
@@ -6,6 +6,7 @@ PR = "r4"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-inherit populate_sdk
+IMAGETEST ?= "dummy"
+inherit populate_sdk imagetest-${IMAGETEST}
 
 CONFIG_SITE := "${@siteinfo_get_files(d)}"
scripts/qemuimage-testlib +231 -1

253 lines not on this page · raw message

scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae new file +3 -0
new file mode 100644
index 0000000..199176e
@@ -0,0 +1,3 @@
+toolchain cvs
+toolchain iptables
+toolchain sudoku-savant
scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae new file +3 -0
new file mode 100644
index 0000000..199176e
@@ -0,0 +1,3 @@
+toolchain cvs
+toolchain iptables
+toolchain sudoku-savant
scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae new file +3 -0
new file mode 100644
index 0000000..199176e
@@ -0,0 +1,3 @@
+toolchain cvs
+toolchain iptables
+toolchain sudoku-savant
scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae new file +3 -0
new file mode 100644
index 0000000..199176e
@@ -0,0 +1,3 @@
+toolchain cvs
+toolchain iptables
+toolchain sudoku-savant
scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae new file +3 -0
new file mode 100644
index 0000000..199176e
@@ -0,0 +1,3 @@
+toolchain cvs
+toolchain iptables
+toolchain sudoku-savant
scripts/qemuimage-tests/toolchain/cvs new file +31 -0
new file mode 100644
index 0000000..871d991
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# CVS compile Test for toolchain test
+# The case extract toolchain tarball into temp folder
+# Then compile CVS with the toolchain environment
+#
+# Author: Jiajun Xu <[email protected]>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+. $COREBASE/scripts/qemuimage-testlib
+
+TIMEOUT=120
+
+# Extract and test toolchain tarball
+Test_Toolchain cvs ${TIMEOUT}
+
+if [ $? -eq 0 ]; then
+	Test_Info "CVS Test PASS"
+	Test_Print_Result "CVS" 0
+	exit 0
+elif [ $? -eq 1 ]; then
+	Test_Info "CVS Test FAIL"
+	Test_Print_Result "CVS" 1
+	exit 1
+else
+	Test_Info "Skip CVS Test due to some configuration problem"
+	Test_Print_Result "CVS" 2
+	exit 2
+fi
scripts/qemuimage-tests/toolchain/iptables new file +31 -0
new file mode 100644
index 0000000..af89bbe
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# iptables compile Test for toolchain test
+# The case extract toolchain tarball into temp folder
+# Then compile iptables with the toolchain environment
+#
+# Author: Jiajun Xu <[email protected]>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+. $COREBASE/scripts/qemuimage-testlib
+
+TIMEOUT=120
+
+# Extract and test toolchain tarball
+Test_Toolchain iptables ${TIMEOUT}
+
+if [ $? -eq 0 ]; then
+	Test_Info "iptables Test PASS"
+	Test_Print_Result "iptables" 0
+	exit 0
+elif [ $? -eq 1 ]; then
+	Test_Info "iptables Test FAIL"
+	Test_Print_Result "iptables" 1
+	exit 1
+else
+	Test_Info "Skip iptables Test due to some configuration problem"
+	Test_Print_Result "iptables" 2
+	exit 2
+fi
scripts/qemuimage-tests/toolchain/sudoku-savant new file +31 -0
new file mode 100644
index 0000000..603afe6
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# sudoku-savant compile Test for toolchain test
+# The case extract toolchain tarball into temp folder
+# Then compile sudoku-savant with the toolchain environment
+#
+# Author: Jiajun Xu <[email protected]>
+#
+# This file is licensed under the GNU General Public License,
+# Version 2.
+#
+. $COREBASE/scripts/qemuimage-testlib
+
+TIMEOUT=120
+
+# Extract and test toolchain tarball
+Test_Toolchain sudoku-savant ${TIMEOUT}
+
+if [ $? -eq 0 ]; then
+	Test_Info "sudoku-savant Test PASS"
+	Test_Print_Result "sudoku-savant" 0
+	exit 0
+elif [ $? -eq 1 ]; then
+	Test_Info "sudoku-savant Test FAIL"
+	Test_Print_Result "sudoku-savant" 1
+	exit 1
+else
+	Test_Info "Skip sudoku-savant Test due to some configuration problem"
+	Test_Print_Result "sudoku-savant" 2
+	exit 2
+fi
Signature · 1 line
1.7.1