sanitytest: Fix 2 bugs on non-rpm or non-procps installed image
cover sanitytest: Fix 2 bugs on non-rpm or non-procps installed image
Current sanitytest will report failure on non-rpm or non-procps installed image. Add check for busybox/procps and use different option for different ps command. Remove rpm/zypper tests if image is not based on rpm.
The following changes since commit da8425174529f10e16cde21fbea7f804284c38ae:
alsa-lib: add nativesdk BBCLASSEXTEND (2011-11-15 12:22:58 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib jxu49/oe-contrib
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jxu49/oe-contrib
Jiajun Xu (2):
sanitytest: use different option for command ps from busybox and
procps
sanitytest: remove rpm/zypper tests if PACKAGE_CLASSES does not set
package_rpm
meta/classes/imagetest-qemu.bbclass | 25 +++++++++++++++++++++- scripts/qemuimage-tests/tools/connman_test.sh | 28 +++++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-)
PATCH 1/2 sanitytest: use different option for command ps from busybox and procps
Current sanitytest use option -e for ps command, which only works for ps from procps. It fails if ps is provided by busybox. Add check to use different option for command from busybox and procps.
[YOCTO #1756]
--- scripts/qemuimage-tests/tools/connman_test.sh | 28 +++++++++++++++++++++--- 1 files changed, 24 insertions(+), 4 deletions(-)
scripts/qemuimage-tests/tools/connman_test.sh +24 -4
@@ -20,6 +20,16 @@ Target_Err() echo -e "\tTARGET: ##### End #####" } +# Check if ps comes from Procps or busybox first +ls -l `which ps` | grep -q "busybox" +RET=$? + +if [ $RET -eq 0 ]; then + PS="ps" +else + PS="ps -ef" +fi + # Check if connmand is in target if [ ! -f /usr/sbin/connmand ]; then Target_Info "No connmand command found"
@@ -27,21 +37,31 @@ if [ ! -f /usr/sbin/connmand ]; then fi # Check if connmand is running in background -count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` +if [ $RET -eq 0 ]; then + count=`ps | awk '{print $5}' | grep -c connmand` +else + count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` +fi if [ $count -ne 1 ]; then Target_Info "connmand has issue when running in background, Pls, check the output of ps" - ps -ef | grep connmand + ${PS} | grep connmand exit 1 fi # Check if there is always only one connmand running in background if [ connmand > /dev/null 2>&1 ]; then Target_Info "connmand command run without problem" - count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` + + if [ $RET -eq 0 ]; then + count=`ps | awk '{print $5}' | grep -c connmand` + else + count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` + fi + if [ $count -ne 1 ]; then Target_Info "There are more than one connmand running in background, Pls, check the output of ps" - ps -ef | grep connmand + ${PS} | grep connmand exit 1 else Target_Info "There is always one connmand running in background, test pass"
Signature · 1 line
1.7.1
PATCH 2/2 sanitytest: remove rpm/zypper tests if PACKAGE_CLASSES does not set package_rpm
If PACKAGE_CLASSES does not set package_rpm as the first item, the root filesystem will not be generated based on rpm. We need remove rpm/zypper tests against non-rpm filesystem.
[YOCTO #1757]
--- meta/classes/imagetest-qemu.bbclass | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
meta/classes/imagetest-qemu.bbclass +24 -1
@@ -80,9 +80,31 @@ def qemuimagetest_main(d): bb.note("Run %s test in scenario %s" % (case, scen)) os.system("%s" % fulltestpath) + """function to check testcase list and remove inappropriate cases""" + def check_list(list): + final_list = [] + for test in list: + (scen, case, fullpath) = test + + """Skip rpm/zypper if package_rpm not set for PACKAGE_CLASSES""" + if case.find("zypper") != -1 or case.find("rpm") != -1: + if d.getVar("PACKAGE_CLASSES", True).find("rpm", 0, 11) == -1: + bb.note("skip rpm/zypper cases since package_rpm not set in PACKAGE_CLASSES") + continue + else: + final_list.append((scen, case, fullpath)) + else: + final_list.append((scen, case, fullpath)) + + if not final_list: + raise bb.build.FuncFailed("There is no suitable testcase for this target") + + return final_list + """Generate testcase list in runtime""" def generate_list(testlist): list = [] + final_list = [] if len(testlist) == 0: raise bb.build.FuncFailed("No testcase defined in TEST_SCEN")
@@ -114,7 +136,8 @@ def qemuimagetest_main(d): if not os.path.isfile(fulltestcase): raise bb.build.FuncFailed("Testcase %s not found" % fulltestcase) list.append((item, casefile, fulltestcase)) - return list + final_list = check_list(list) + return final_list """Clean tmp folder for testing""" def clean_tmp():
Signature · 1 line
1.7.1
Saul Wold
AppliedQuoted 23 lines · Jiajun Xu
Current sanitytest will report failure on non-rpm or non-procps installed image. Add check for busybox/procps and use different option for different ps command. Remove rpm/zypper tests if image is not based on rpm.
The following changes since commit
da8425174529f10e16cde21fbea7f804284c38ae:alsa-lib: add nativesdk BBCLASSEXTEND (2011-11-15 12:22:58 +0000)are available in the git repository at:
git://git.pokylinux.org/poky-contribjxu49/oe-contrib
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jxu49/oe-contribJiajun Xu (2):
sanitytest: use different option for command ps from busybox and
procps
sanitytest: remove rpm/zypper tests ifPACKAGE_CLASSESdoes not set
package_rpmmeta/classes/imagetest-qemu.bbclass | 25 +++++++++++++++++++++- scripts/qemuimage-tests/tools/connman_test.sh | 28 +++++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-)
Quoted 5 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Merged into OE-Core
Thanks
Sau!