diff options
54 files changed, 0 insertions, 2411 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass deleted file mode 100644 index 7083a99381..0000000000 --- a/meta/classes/imagetest-qemu.bbclass +++ /dev/null | |||
| @@ -1,238 +0,0 @@ | |||
| 1 | # Test related variables | ||
| 2 | # By default, TEST_DIR is created under WORKDIR | ||
| 3 | TEST_DIR ?= "${WORKDIR}/qemuimagetest" | ||
| 4 | TEST_LOG ?= "${LOG_DIR}/qemuimagetests" | ||
| 5 | TEST_RESULT ?= "${TEST_DIR}/result" | ||
| 6 | TEST_TMP ?= "${TEST_DIR}/tmp" | ||
| 7 | TEST_SCEN ?= "sanity" | ||
| 8 | TEST_STATUS ?= "${TEST_TMP}/status" | ||
| 9 | TARGET_IPSAVE ?= "${TEST_TMP}/target_ip" | ||
| 10 | TEST_SERIALIZE ?= "1" | ||
| 11 | |||
| 12 | python do_qemuimagetest() { | ||
| 13 | qemuimagetest_main(d) | ||
| 14 | } | ||
| 15 | addtask qemuimagetest before do_build after do_rootfs | ||
| 16 | do_qemuimagetest[nostamp] = "1" | ||
| 17 | do_qemuimagetest[depends] += "qemu-native:do_populate_sysroot" | ||
| 18 | |||
| 19 | python do_qemuimagetest_standalone() { | ||
| 20 | qemuimagetest_main(d) | ||
| 21 | } | ||
| 22 | addtask qemuimagetest_standalone | ||
| 23 | do_qemuimagetest_standalone[nostamp] = "1" | ||
| 24 | do_qemuimagetest_standalone[depends] += "qemu-native:do_populate_sysroot" | ||
| 25 | |||
| 26 | def qemuimagetest_main(d): | ||
| 27 | import sys | ||
| 28 | import re | ||
| 29 | import shutil | ||
| 30 | import subprocess | ||
| 31 | |||
| 32 | """ | ||
| 33 | Test Controller for automated testing. | ||
| 34 | """ | ||
| 35 | |||
| 36 | casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\S+$)') | ||
| 37 | resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)') | ||
| 38 | machine = d.getVar('MACHINE', True) | ||
| 39 | pname = d.getVar('PN', True) | ||
| 40 | allfstypes = d.getVar("IMAGE_FSTYPES", True).split() | ||
| 41 | testfstypes = [ "ext2", "ext3", "ext4", "jffs2", "btrfs" ] | ||
| 42 | |||
| 43 | """function to save test cases running status""" | ||
| 44 | def teststatus(test, status, index, length): | ||
| 45 | test_status = d.getVar('TEST_STATUS', True) | ||
| 46 | if not os.path.exists(test_status): | ||
| 47 | raise bb.build.FuncFailed("No test status file existing under TEST_TMP") | ||
| 48 | |||
| 49 | f = open(test_status, "w") | ||
| 50 | f.write("\t%-15s%-15s%-15s%-15s\n" % ("Case", "Status", "Number", "Total")) | ||
| 51 | f.write("\t%-15s%-15s%-15s%-15s\n" % (case, status, index, length)) | ||
| 52 | f.close() | ||
| 53 | |||
| 54 | """funtion to run each case under scenario""" | ||
| 55 | def runtest(scen, case, fulltestpath, fstype): | ||
| 56 | resultpath = d.getVar('TEST_RESULT', True) | ||
| 57 | tmppath = d.getVar('TEST_TMP', True) | ||
| 58 | |||
| 59 | """initialize log file for testcase""" | ||
| 60 | logpath = d.getVar('TEST_LOG', True) | ||
| 61 | bb.utils.mkdirhier("%s/%s" % (logpath, scen)) | ||
| 62 | caselog = os.path.join(logpath, "%s/log_%s.%s" % (scen, case, d.getVar('DATETIME', True))) | ||
| 63 | subprocess.call("touch %s" % caselog, shell=True) | ||
| 64 | |||
| 65 | """export TEST_TMP, TEST_RESULT, DEPLOY_DIR and QEMUARCH""" | ||
| 66 | os.environ["PATH"] = d.getVar("PATH", True) | ||
| 67 | os.environ["TEST_TMP"] = tmppath | ||
| 68 | os.environ["TEST_RESULT"] = resultpath | ||
| 69 | os.environ["DEPLOY_DIR"] = d.getVar("DEPLOY_DIR", True) | ||
| 70 | os.environ["QEMUARCH"] = machine | ||
| 71 | os.environ["QEMUTARGET"] = pname | ||
| 72 | os.environ["COREBASE"] = d.getVar("COREBASE", True) | ||
| 73 | os.environ["TOPDIR"] = d.getVar("TOPDIR", True) | ||
| 74 | os.environ["OE_TMPDIR"] = d.getVar("TMPDIR", True) | ||
| 75 | os.environ["TEST_STATUS"] = d.getVar("TEST_STATUS", True) | ||
| 76 | os.environ["TARGET_IPSAVE"] = d.getVar("TARGET_IPSAVE", True) | ||
| 77 | os.environ["TEST_SERIALIZE"] = d.getVar("TEST_SERIALIZE", True) | ||
| 78 | os.environ["SDK_NAME"] = d.getVar("SDK_NAME", True) | ||
| 79 | os.environ["RUNQEMU_LOGFILE"] = d.expand("${T}/log.runqemutest.%s" % os.getpid()) | ||
| 80 | os.environ["ROOTFS_EXT"] = fstype | ||
| 81 | |||
| 82 | # Add in all variables from the user's original environment which | ||
| 83 | # haven't subsequntly been set/changed | ||
| 84 | origbbenv = d.getVar("BB_ORIGENV", False) or {} | ||
| 85 | for key in origbbenv: | ||
| 86 | if key in os.environ: | ||
| 87 | continue | ||
| 88 | value = origbbenv.getVar(key, True) | ||
| 89 | if value is not None: | ||
| 90 | os.environ[key] = str(value) | ||
| 91 | |||
| 92 | """run Test Case""" | ||
| 93 | bb.note("Run %s test in scenario %s" % (case, scen)) | ||
| 94 | subprocess.call("%s" % fulltestpath, shell=True) | ||
| 95 | |||
| 96 | """function to check testcase list and remove inappropriate cases""" | ||
| 97 | def check_list(list): | ||
| 98 | final_list = [] | ||
| 99 | for test in list: | ||
| 100 | (scen, case, fullpath) = test | ||
| 101 | |||
| 102 | """Skip rpm/smart if package_rpm not set for PACKAGE_CLASSES""" | ||
| 103 | if case.find("smart") != -1 or case.find("rpm") != -1: | ||
| 104 | if d.getVar("PACKAGE_CLASSES", True).find("rpm", 0, 11) == -1: | ||
| 105 | bb.note("skip rpm/smart cases since package_rpm not set in PACKAGE_CLASSES") | ||
| 106 | continue | ||
| 107 | else: | ||
| 108 | final_list.append((scen, case, fullpath)) | ||
| 109 | else: | ||
| 110 | final_list.append((scen, case, fullpath)) | ||
| 111 | |||
| 112 | if not final_list: | ||
| 113 | raise bb.build.FuncFailed("There is no suitable testcase for this target") | ||
| 114 | |||
| 115 | return final_list | ||
| 116 | |||
| 117 | """Generate testcase list in runtime""" | ||
| 118 | def generate_list(testlist): | ||
| 119 | list = [] | ||
| 120 | final_list = [] | ||
| 121 | if len(testlist) == 0: | ||
| 122 | raise bb.build.FuncFailed("No testcase defined in TEST_SCEN") | ||
| 123 | |||
| 124 | """check testcase folder and add case list according to TEST_SCEN""" | ||
| 125 | for item in testlist.split(" "): | ||
| 126 | n = casestr.match(item) | ||
| 127 | if n: | ||
| 128 | item = n.group('scen') | ||
| 129 | casefile = n.group('case') | ||
| 130 | for dir in d.getVar("QEMUIMAGETESTS", True).split(): | ||
| 131 | fulltestcase = os.path.join(dir, item, casefile) | ||
| 132 | if not os.path.isfile(fulltestcase): | ||
| 133 | raise bb.build.FuncFailed("Testcase %s not found" % fulltestcase) | ||
| 134 | list.append((item, casefile, fulltestcase)) | ||
| 135 | else: | ||
| 136 | for dir in d.getVar("QEMUIMAGETESTS", True).split(): | ||
| 137 | scenlist = os.path.join(dir, "scenario", machine, pname) | ||
| 138 | if not os.path.isfile(scenlist): | ||
| 139 | raise bb.build.FuncFailed("No scenario list file named %s found" % scenlist) | ||
| 140 | |||
| 141 | f = open(scenlist, "r") | ||
| 142 | for line in f: | ||
| 143 | if item != line.split()[0]: | ||
| 144 | continue | ||
| 145 | else: | ||
| 146 | casefile = line.split()[1] | ||
| 147 | |||
| 148 | fulltestcase = os.path.join(dir, item, casefile) | ||
| 149 | if not os.path.isfile(fulltestcase): | ||
| 150 | raise bb.build.FuncFailed("Testcase %s not found" % fulltestcase) | ||
| 151 | list.append((item, casefile, fulltestcase)) | ||
| 152 | f.close() | ||
| 153 | final_list = check_list(list) | ||
| 154 | return final_list | ||
| 155 | |||
| 156 | """Clean tmp folder for testing""" | ||
| 157 | def clean_tmp(): | ||
| 158 | tmppath = d.getVar('TEST_TMP', True) | ||
| 159 | |||
| 160 | if os.path.isdir(tmppath): | ||
| 161 | for f in os.listdir(tmppath): | ||
| 162 | tmpfile = os.path.join(tmppath, f) | ||
| 163 | if os.path.isfile(tmpfile): | ||
| 164 | os.remove(tmpfile) | ||
| 165 | elif os.path.isdir(tmpfile): | ||
| 166 | shutil.rmtree(tmpfile, True) | ||
| 167 | |||
| 168 | """Before running testing, clean temp folder first""" | ||
| 169 | clean_tmp() | ||
| 170 | |||
| 171 | """check testcase folder and create test log folder""" | ||
| 172 | testpath = d.getVar('TEST_DIR', True) | ||
| 173 | bb.utils.mkdirhier(testpath) | ||
| 174 | |||
| 175 | logpath = d.getVar('TEST_LOG', True) | ||
| 176 | bb.utils.mkdirhier(logpath) | ||
| 177 | |||
| 178 | tmppath = d.getVar('TEST_TMP', True) | ||
| 179 | bb.utils.mkdirhier(tmppath) | ||
| 180 | |||
| 181 | """initialize test status file""" | ||
| 182 | test_status = d.getVar('TEST_STATUS', True) | ||
| 183 | if os.path.exists(test_status): | ||
| 184 | os.remove(test_status) | ||
| 185 | subprocess.call("touch %s" % test_status, shell=True) | ||
| 186 | |||
| 187 | """initialize result file""" | ||
| 188 | resultpath = d.getVar('TEST_RESULT', True) | ||
| 189 | bb.utils.mkdirhier(resultpath) | ||
| 190 | resultfile = os.path.join(resultpath, "testresult.%s" % d.getVar('DATETIME', True)) | ||
| 191 | sresultfile = os.path.join(resultpath, "testresult.log") | ||
| 192 | |||
| 193 | machine = d.getVar('MACHINE', True) | ||
| 194 | |||
| 195 | if os.path.exists(sresultfile): | ||
| 196 | os.remove(sresultfile) | ||
| 197 | subprocess.call("touch %s" % resultfile, shell=True) | ||
| 198 | os.symlink(resultfile, sresultfile) | ||
| 199 | |||
| 200 | """generate pre-defined testcase list""" | ||
| 201 | testlist = d.getVar('TEST_SCEN', True) | ||
| 202 | fulllist = generate_list(testlist) | ||
| 203 | |||
| 204 | """Begin testing""" | ||
| 205 | for fstype in allfstypes: | ||
| 206 | if fstype in testfstypes: | ||
| 207 | with open(sresultfile, "a") as f: | ||
| 208 | f.write("\tTest Result for %s %s %s\n" % (machine, pname, fstype)) | ||
| 209 | f.write("\t%-15s%-15s%-15s%-15s\n" % ("Testcase", "PASS", "FAIL", "NORESULT")) | ||
| 210 | for index,test in enumerate(fulllist): | ||
| 211 | (scen, case, fullpath) = test | ||
| 212 | teststatus(case, "running", index, (len(fulllist) - 1)) | ||
| 213 | runtest(scen, case, fullpath, fstype) | ||
| 214 | teststatus(case, "finished", index, (len(fulllist) - 1)) | ||
| 215 | |||
| 216 | """Print Test Result""" | ||
| 217 | ret = 0 | ||
| 218 | f = open(sresultfile, "r") | ||
| 219 | for line in f: | ||
| 220 | m = resultstr.match(line) | ||
| 221 | if m: | ||
| 222 | if m.group('fail') == "1": | ||
| 223 | ret = 1 | ||
| 224 | elif m.group('noresult') == "1": | ||
| 225 | ret = 2 | ||
| 226 | line = line.strip('\n') | ||
| 227 | bb.note(line) | ||
| 228 | else: | ||
| 229 | line = line.strip('\n') | ||
| 230 | bb.note(line) | ||
| 231 | f.close() | ||
| 232 | |||
| 233 | """Clean temp files for testing""" | ||
| 234 | clean_tmp() | ||
| 235 | |||
| 236 | if ret != 0: | ||
| 237 | raise bb.build.FuncFailed("Some tests failed. Please check the results file: %s and the log files found in: %s." % (resultfile, d.getVar('TEST_LOG', True))) | ||
| 238 | |||
diff --git a/meta/classes/populate_sdk_base.bbclass b/meta/classes/populate_sdk_base.bbclass index bddcf6213b..b7ea85159c 100644 --- a/meta/classes/populate_sdk_base.bbclass +++ b/meta/classes/populate_sdk_base.bbclass | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | inherit meta toolchain-scripts | 1 | inherit meta toolchain-scripts |
| 2 | inherit populate_sdk_${IMAGE_PKGTYPE} | 2 | inherit populate_sdk_${IMAGE_PKGTYPE} |
| 3 | 3 | ||
| 4 | IMAGETESTCLASS = "${@oe.utils.ifelse(d.getVar('IMAGETEST'),'imagetest-' + (d.getVar('IMAGETEST') or ""),'')}" | ||
| 5 | inherit ${IMAGETESTCLASS} | ||
| 6 | |||
| 7 | SDK_DIR = "${WORKDIR}/sdk" | 4 | SDK_DIR = "${WORKDIR}/sdk" |
| 8 | SDK_OUTPUT = "${SDK_DIR}/image" | 5 | SDK_OUTPUT = "${SDK_DIR}/image" |
| 9 | SDK_DEPLOY = "${TMPDIR}/deploy/sdk" | 6 | SDK_DEPLOY = "${TMPDIR}/deploy/sdk" |
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf index 31c095c2cb..e249a6a43e 100644 --- a/meta/conf/layer.conf +++ b/meta/conf/layer.conf | |||
| @@ -14,9 +14,6 @@ LAYERVERSION_core = "3" | |||
| 14 | # Set a variable to get to the top of the metadata location | 14 | # Set a variable to get to the top of the metadata location |
| 15 | COREBASE = '${@os.path.normpath("${LAYERDIR}/../")}' | 15 | COREBASE = '${@os.path.normpath("${LAYERDIR}/../")}' |
| 16 | 16 | ||
| 17 | # Set path to qemu image tests included in this layer | ||
| 18 | QEMUIMAGETESTS = "${COREBASE}/scripts/qemuimage-tests" | ||
| 19 | |||
| 20 | SIGGEN_EXCLUDERECIPES_ABISAFE += " \ | 17 | SIGGEN_EXCLUDERECIPES_ABISAFE += " \ |
| 21 | sysvinit-inittab \ | 18 | sysvinit-inittab \ |
| 22 | shadow-securetty \ | 19 | shadow-securetty \ |
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib deleted file mode 100755 index adcdf6bfef..0000000000 --- a/scripts/qemuimage-testlib +++ /dev/null | |||
| @@ -1,760 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Common function for test | ||
| 3 | # Expect should be installed for SSH Testing | ||
| 4 | # To execute `runqemu`, NOPASSWD needs to be set in /etc/sudoers for user | ||
| 5 | # For example, for user "builder", /etc/sudoers can be like following: | ||
| 6 | # ######### | ||
| 7 | # #Members of the admin group may gain root privileges | ||
| 8 | # %builder ALL=(ALL) NOPASSWD: NOPASSWD: ALL | ||
| 9 | # ######### | ||
| 10 | # | ||
| 11 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 12 | # | ||
| 13 | # This file is licensed under the GNU General Public License, | ||
| 14 | # Version 2. | ||
| 15 | # | ||
| 16 | |||
| 17 | # The folder to hold all scripts running on targets | ||
| 18 | TOOLS="$COREBASE/scripts/qemuimage-tests/tools" | ||
| 19 | |||
| 20 | # The folder to hold all projects for toolchain testing | ||
| 21 | TOOLCHAIN_PROJECTS="$COREBASE/scripts/qemuimage-tests/toolchain_projects" | ||
| 22 | |||
| 23 | # Test Directory on target for testing | ||
| 24 | TARGET_TEST_DIR="/tmp/test" | ||
| 25 | |||
| 26 | # Global variables for process id | ||
| 27 | XTERMPID=0 | ||
| 28 | QEMUPID=0 | ||
| 29 | |||
| 30 | # Global variable for target ip address | ||
| 31 | TARGET_IPADDR=0 | ||
| 32 | |||
| 33 | # Global variable for test project version during toolchain test | ||
| 34 | # Version of cvs is 1.12.13 | ||
| 35 | # Version of iptables is 1.4.11 | ||
| 36 | # Version of sudoku-savant is 1.3 | ||
| 37 | PROJECT_PV=0 | ||
| 38 | |||
| 39 | # Global variable for test project download URL during toolchain test | ||
| 40 | # URL of cvs is http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2 | ||
| 41 | # URL of iptables is http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2 | ||
| 42 | # URL of sudoku-savant is http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2 | ||
| 43 | PROJECT_DOWNLOAD_URL=0 | ||
| 44 | |||
| 45 | # SDK folder to hold toolchain tarball | ||
| 46 | TOOLCHAIN_DIR="${DEPLOY_DIR}/sdk" | ||
| 47 | |||
| 48 | # Toolchain test folder to hold extracted toolchain tarball | ||
| 49 | TOOLCHAIN_TEST="/opt" | ||
| 50 | |||
| 51 | # common function for information print | ||
| 52 | Test_Error() | ||
| 53 | { | ||
| 54 | echo -e "\tTest_Error: $*" | ||
| 55 | } | ||
| 56 | |||
| 57 | Test_Info() | ||
| 58 | { | ||
| 59 | echo -e "\tTest_Info: $*" | ||
| 60 | } | ||
| 61 | |||
| 62 | # function to update target ip address | ||
| 63 | # $1 is the process id of the process, which starts the qemu target | ||
| 64 | # $2 is the ip address of the target | ||
| 65 | Test_Update_IPSAVE() | ||
| 66 | { | ||
| 67 | local pid=$1 | ||
| 68 | local ip_addr=$2 | ||
| 69 | |||
| 70 | if [ "$TEST_SERIALIZE" -eq 1 -a "$pid" != "0" -a "$pid" != "" -a "$ip_addr" != "" -a "$ip_addr" != "" ]; then | ||
| 71 | echo "Saving $pid $ip_addr to $TARGET_IPSAVE" | ||
| 72 | echo "$pid $ip_addr" > $TARGET_IPSAVE | ||
| 73 | fi | ||
| 74 | } | ||
| 75 | |||
| 76 | # function to copy files from host into target | ||
| 77 | # $1 is the ip address of target | ||
| 78 | # $2 is the files, which need to be copied into target | ||
| 79 | # $3 is the path on target, where files are copied into | ||
| 80 | Test_SCP() | ||
| 81 | { | ||
| 82 | local ip_addr=$1 | ||
| 83 | local src=$2 | ||
| 84 | local des=$3 | ||
| 85 | local time_out=60 | ||
| 86 | local ret=0 | ||
| 87 | |||
| 88 | # We use expect to interactive with target by ssh | ||
| 89 | local exp_cmd=`cat << EOF | ||
| 90 | eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$src" root@$ip_addr:"$des" | ||
| 91 | set timeout $time_out | ||
| 92 | expect { | ||
| 93 | "*assword:" { send "\r"; exp_continue} | ||
| 94 | "*(yes/no)?" { send "yes\r"; exp_continue } | ||
| 95 | eof { exit [ lindex [wait] 3 ] } | ||
| 96 | } | ||
| 97 | EOF` | ||
| 98 | |||
| 99 | expect=`which expect` | ||
| 100 | if [ ! -x "$expect" ]; then | ||
| 101 | Test_Error "ERROR: Please install expect" | ||
| 102 | return 1 | ||
| 103 | fi | ||
| 104 | |||
| 105 | expect -c "$exp_cmd" | ||
| 106 | ret=$? | ||
| 107 | return $ret | ||
| 108 | } | ||
| 109 | |||
| 110 | # function to copy files from target to host | ||
| 111 | # $1 is the ip address of target | ||
| 112 | # $2 is the files, which need to be copied into target | ||
| 113 | # $3 is the path on target, where files are copied into | ||
| 114 | Test_SCP_From() | ||
| 115 | { | ||
| 116 | local ip_addr=$1 | ||
| 117 | local src=$2 | ||
| 118 | local des=$3 | ||
| 119 | local time_out=60 | ||
| 120 | local ret=0 | ||
| 121 | |||
| 122 | # We use expect to interactive with target by ssh | ||
| 123 | local exp_cmd=`cat << EOF | ||
| 124 | eval spawn scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr:"$src" "$des" | ||
| 125 | set timeout $time_out | ||
| 126 | expect { | ||
| 127 | "*assword:" { send "\r"; exp_continue} | ||
| 128 | "*(yes/no)?" { send "yes\r"; exp_continue } | ||
| 129 | eof { exit [ lindex [wait] 3 ] } | ||
| 130 | } | ||
| 131 | EOF` | ||
| 132 | |||
| 133 | expect=`which expect` | ||
| 134 | if [ ! -x "$expect" ]; then | ||
| 135 | Test_Error "ERROR: Please install expect" | ||
| 136 | return 1 | ||
| 137 | fi | ||
| 138 | |||
| 139 | expect -c "$exp_cmd" | ||
| 140 | ret=$? | ||
| 141 | return $ret | ||
| 142 | } | ||
| 143 | |||
| 144 | # function to run command in $ip_addr via ssh | ||
| 145 | Test_SSH() | ||
| 146 | { | ||
| 147 | local ip_addr="$1" | ||
| 148 | local command="$2" | ||
| 149 | |||
| 150 | if [ $# -eq 3 ]; then | ||
| 151 | local time_out=$3 | ||
| 152 | else | ||
| 153 | local time_out=60 | ||
| 154 | fi | ||
| 155 | |||
| 156 | local ret=0 | ||
| 157 | local exp_cmd=`cat << EOF | ||
| 158 | eval spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$ip_addr "$command" | ||
| 159 | set timeout $time_out | ||
| 160 | expect { | ||
| 161 | "*assword:" { send "\r"; exp_continue} | ||
| 162 | "*(yes/no)?" { send "yes\r"; exp_continue } | ||
| 163 | eof { exit [ lindex [wait] 3 ] } | ||
| 164 | } | ||
| 165 | EOF` | ||
| 166 | |||
| 167 | expect=`which expect` | ||
| 168 | if [ ! -x "$expect" ]; then | ||
| 169 | Test_Error "ERROR: Please install expect" | ||
| 170 | return 1 | ||
| 171 | fi | ||
| 172 | |||
| 173 | expect -c "$exp_cmd" | ||
| 174 | ret=$? | ||
| 175 | return $ret | ||
| 176 | } | ||
| 177 | |||
| 178 | # function to check if ssh is up in $ip_addr | ||
| 179 | Test_SSH_UP() | ||
| 180 | { | ||
| 181 | local ip_addr=$1 | ||
| 182 | local timeout=$2 | ||
| 183 | local interval=0 | ||
| 184 | |||
| 185 | # If TEST_SERIALIZE is set, use existing running qemu for testing | ||
| 186 | if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TARGET_IPSAVE} ]; then | ||
| 187 | timeout=50 | ||
| 188 | fi | ||
| 189 | |||
| 190 | while [ ${interval} -lt ${timeout} ] | ||
| 191 | do | ||
| 192 | Test_SSH ${ip_addr} "hostname" | ||
| 193 | if [ $? -ne 0 ]; then | ||
| 194 | interval=`expr $interval + 10` | ||
| 195 | sleep 10 | ||
| 196 | else | ||
| 197 | Test_Info "We can ssh on ${ip_addr} within ${interval} seconds" | ||
| 198 | return 0 | ||
| 199 | fi | ||
| 200 | |||
| 201 | done | ||
| 202 | |||
| 203 | Test_Info "We can not ssh on ${ip_addr} in ${timeout} seconds" | ||
| 204 | return 1 | ||
| 205 | } | ||
| 206 | |||
| 207 | # function to prepare target test environment | ||
| 208 | # $1 is the ip address of target system | ||
| 209 | # $2 is the files, which needs to be copied into target | ||
| 210 | Test_Target_Pre() | ||
| 211 | { | ||
| 212 | local ip_addr=$1 | ||
| 213 | local testscript=$2 | ||
| 214 | |||
| 215 | # Create a pre-defined folder for test scripts | ||
| 216 | Test_SSH $ip_addr "mkdir -p $TARGET_TEST_DIR" | ||
| 217 | if [ $? -eq 0 ]; then | ||
| 218 | # Copy test scripts into target | ||
| 219 | Test_SCP $ip_addr $testscript $TARGET_TEST_DIR && return 0 | ||
| 220 | else | ||
| 221 | Test_Error "Fail to create $TARGET_TEST_DIR on target" | ||
| 222 | return 1 | ||
| 223 | fi | ||
| 224 | |||
| 225 | return 1 | ||
| 226 | } | ||
| 227 | |||
| 228 | # function to record test result in $TEST_RESULT/testresult.log | ||
| 229 | Test_Print_Result() | ||
| 230 | { | ||
| 231 | local PASS=0 | ||
| 232 | local FAIL=0 | ||
| 233 | local NORESULT=0 | ||
| 234 | if [ $2 -eq 0 ]; then | ||
| 235 | PASS=1 | ||
| 236 | elif [ $2 -eq 1 ]; then | ||
| 237 | FAIL=1 | ||
| 238 | else | ||
| 239 | NORESULT=1 | ||
| 240 | fi | ||
| 241 | |||
| 242 | # Format the output of the test result | ||
| 243 | echo -e "$1 $PASS $FAIL $NORESULT" | awk '{printf("\t"); for(i=1;i<=NF;i++) printf("%-15s",$i); printf("\n");}' >> $TEST_RESULT/testresult.log | ||
| 244 | } | ||
| 245 | |||
| 246 | # Test_Kill_Qemu to kill child pid with parent pid given | ||
| 247 | # $1 is qemu process id, which needs to be killed | ||
| 248 | Test_Kill_Qemu() | ||
| 249 | { | ||
| 250 | local index=0 | ||
| 251 | local total=0 | ||
| 252 | local k=0 | ||
| 253 | |||
| 254 | # When TEST_SERIALIZE is set, qemu process will not be | ||
| 255 | # killed until all the cases are finished | ||
| 256 | if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TEST_STATUS} ]; then | ||
| 257 | index=`sed -n 2p ${TEST_STATUS} | awk '{print $3}'` | ||
| 258 | total=`sed -n 2p ${TEST_STATUS} | awk '{print $4}'` | ||
| 259 | if [ ${index} != ${total} ]; then | ||
| 260 | Test_Info "Do not kill the qemu process and use it for later testing (step $index of $total)" | ||
| 261 | Test_Update_IPSAVE $XTERMPID $TARGET_IPADDR | ||
| 262 | else | ||
| 263 | k=1 | ||
| 264 | fi | ||
| 265 | else | ||
| 266 | k=1 | ||
| 267 | fi | ||
| 268 | |||
| 269 | if [ $k -eq 1 ]; then | ||
| 270 | if [ "$QEMUPID" != "0" -a "$QEMUPID" != "" ]; then | ||
| 271 | running=`ps -wwfp $QEMUPID` | ||
| 272 | if [ $? -eq 0 ]; then | ||
| 273 | echo "killing $QEMUPID" | ||
| 274 | kill $QEMUPID | ||
| 275 | fi | ||
| 276 | fi | ||
| 277 | if [ "$XTERMPID" != "0" -a "$XTERMPID" != "" ]; then | ||
| 278 | running=`ps -wwfp $XTERMPID` | ||
| 279 | if [ $? -eq 0 ]; then | ||
| 280 | echo "killing $XTERMPID" | ||
| 281 | kill $XTERMPID | ||
| 282 | fi | ||
| 283 | fi | ||
| 284 | fi | ||
| 285 | |||
| 286 | return | ||
| 287 | } | ||
| 288 | |||
| 289 | # function to check if network is up | ||
| 290 | Test_Check_IP_UP() | ||
| 291 | { | ||
| 292 | ping -c1 $1 1> /dev/null | ||
| 293 | if [ $? -ne 0 ]; then | ||
| 294 | Test_Info "IP $1 is not up" | ||
| 295 | return 1 | ||
| 296 | else | ||
| 297 | Test_Info "IP $1 is up" | ||
| 298 | return 0 | ||
| 299 | fi | ||
| 300 | } | ||
| 301 | |||
| 302 | # function to find kernel/rootfs image | ||
| 303 | Test_Find_Image() | ||
| 304 | { | ||
| 305 | where="" | ||
| 306 | kernel="" | ||
| 307 | arch="" | ||
| 308 | target="" | ||
| 309 | extension="" | ||
| 310 | rootfs="" | ||
| 311 | |||
| 312 | while getopts "l:k:a:t:e:" Option | ||
| 313 | do | ||
| 314 | case $Option in | ||
| 315 | l) where="$OPTARG" | ||
| 316 | ;; | ||
| 317 | k) kernel="$OPTARG" | ||
| 318 | ;; | ||
| 319 | a) arch="$OPTARG" | ||
| 320 | ;; | ||
| 321 | t) target="$OPTARG" | ||
| 322 | ;; | ||
| 323 | e) extension="$OPTARG" | ||
| 324 | ;; | ||
| 325 | *) echo "invalid option: -$Option" && return 1 | ||
| 326 | ;; | ||
| 327 | esac | ||
| 328 | done | ||
| 329 | |||
| 330 | if [ ! -z $kernel ]; then | ||
| 331 | if [ -L ${where}/${kernel}-${arch}.${extension} ]; then | ||
| 332 | echo ${where}/${kernel}-${arch}.${extension} | ||
| 333 | return 0 | ||
| 334 | else | ||
| 335 | for i in `dir ${where}` | ||
| 336 | do | ||
| 337 | # Exclude qemux86-64 when target is qemux86 | ||
| 338 | echo $i | grep "${kernel}.*${arch}.*\.${extension}" | grep -qv "${kernel}.*${arch}-64.*\.${extension}" | ||
| 339 | if [ $? -eq 0 ]; then | ||
| 340 | echo ${where}/${i} | ||
| 341 | return 0 | ||
| 342 | fi | ||
| 343 | done | ||
| 344 | return 1 | ||
| 345 | fi | ||
| 346 | fi | ||
| 347 | |||
| 348 | if [ ! -z $target ]; then | ||
| 349 | if [ -L ${where}/${target}-${arch}.${extension} ]; then | ||
| 350 | rootfs=`readlink -f ${where}/${target}-${arch}.${extension}` | ||
| 351 | echo ${rootfs} | ||
| 352 | return 0 | ||
| 353 | else | ||
| 354 | for i in `dir ${where}` | ||
| 355 | do | ||
| 356 | # Exclude qemux86-64 when target is qemux86 | ||
| 357 | echo $i | grep "${target}-${arch}.*\.${extension}" | grep -qv "${target}-${arch}-64.*\.${extension}" | ||
| 358 | if [ $? -eq 0 ]; then | ||
| 359 | echo ${where}/${i} | ||
| 360 | return 0 | ||
| 361 | fi | ||
| 362 | done | ||
| 363 | return 1 | ||
| 364 | fi | ||
| 365 | fi | ||
| 366 | return 1 | ||
| 367 | } | ||
| 368 | |||
| 369 | # function to parse IP address of target | ||
| 370 | # $1 is the pid of qemu startup process | ||
| 371 | Test_Fetch_Target_IP() | ||
| 372 | { | ||
| 373 | local opid=$1 | ||
| 374 | local ip_addr=0 | ||
| 375 | |||
| 376 | if [ "$opid" = "0" -o "$opid" = "" ]; then | ||
| 377 | echo "" | ||
| 378 | return | ||
| 379 | fi | ||
| 380 | |||
| 381 | # Check if $1 pid exists and contains ipaddr of target | ||
| 382 | ip_addr=`ps -wwfp $opid | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" '{print $1}'` | ||
| 383 | |||
| 384 | echo $ip_addr | ||
| 385 | |||
| 386 | return | ||
| 387 | } | ||
| 388 | |||
| 389 | # function to check if qemu and its network | ||
| 390 | Test_Create_Qemu() | ||
| 391 | { | ||
| 392 | local timeout=$1 | ||
| 393 | shift | ||
| 394 | local extraargs="$@" | ||
| 395 | local up_time=0 | ||
| 396 | |||
| 397 | RUNQEMU=`which runqemu` | ||
| 398 | if [ $? -ne 0 ]; then | ||
| 399 | Test_Error "Can not find runqemu in \$PATH, return fail" | ||
| 400 | return 1 | ||
| 401 | fi | ||
| 402 | |||
| 403 | if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then | ||
| 404 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH} -e "bin") | ||
| 405 | elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then | ||
| 406 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH}) | ||
| 407 | elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then | ||
| 408 | KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH} -e "bin") | ||
| 409 | fi | ||
| 410 | |||
| 411 | # If there is no kernel image found, return failed directly | ||
| 412 | if [ $? -eq 1 ]; then | ||
| 413 | Test_Info "No kernel image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check" | ||
| 414 | return 1 | ||
| 415 | fi | ||
| 416 | |||
| 417 | Test_Info "rootfs image extension selected: $ROOTFS_EXT" | ||
| 418 | ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH} -e "$ROOTFS_EXT") | ||
| 419 | |||
| 420 | # If there is no rootfs image found, return failed directly | ||
| 421 | if [ $? -eq 1 ]; then | ||
| 422 | Test_Info "No ${QEMUTARGET} rootfs image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check" | ||
| 423 | return 1 | ||
| 424 | fi | ||
| 425 | |||
| 426 | TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.${ROOTFS_EXT}" | ||
| 427 | |||
| 428 | CP=`which cp` | ||
| 429 | |||
| 430 | # When TEST_SERIALIZE is set, we use the existing image under tmp folder | ||
| 431 | if [ ${TEST_SERIALIZE} -eq 1 -a -e "$TARGET_IPSAVE" ]; then | ||
| 432 | # If TARGET_IPSAVE exists, check PID of the qemu process from it | ||
| 433 | XTERMPID=`awk '{print $1}' $TARGET_IPSAVE` | ||
| 434 | timeout=50 | ||
| 435 | else | ||
| 436 | rm -rf $TEST_ROOTFS_IMAGE | ||
| 437 | echo "Copying rootfs $ROOTFS_IMAGE to $TEST_ROOTFS_IMAGE" | ||
| 438 | $CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE | ||
| 439 | if [ $? -ne 0 ]; then | ||
| 440 | Test_Info "Image ${ROOTFS_IMAGE} copy to ${TEST_ROOTFS_IMAGE} failed, return fail" | ||
| 441 | return 1 | ||
| 442 | fi | ||
| 443 | |||
| 444 | export MACHINE=$QEMUARCH | ||
| 445 | |||
| 446 | # Create Qemu in localhost VNC Port 1 | ||
| 447 | echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} ${extraargs} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60' &" | ||
| 448 | xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} ${extraargs} 2>&1 | tee ${RUNQEMU_LOGFILE} || /bin/sleep 60" & | ||
| 449 | |||
| 450 | # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu | ||
| 451 | XTERMPID=$! | ||
| 452 | echo "XTERMPID is $XTERMPID" | ||
| 453 | # When starting, qemu can reexecute itself and change PID so wait a short while for things to settle | ||
| 454 | sleep 5 | ||
| 455 | fi | ||
| 456 | |||
| 457 | while [ ${up_time} -lt 30 ] | ||
| 458 | do | ||
| 459 | QEMUPID=`qemuimage-testlib-pythonhelper --findqemu $XTERMPID 2>/dev/null` | ||
| 460 | if [ $? -ne 0 ]; then | ||
| 461 | Test_Info "Wait for qemu up..." | ||
| 462 | up_time=`expr $up_time + 5` | ||
| 463 | sleep 5 | ||
| 464 | else | ||
| 465 | Test_Info "Begin to check if qemu network is up" | ||
| 466 | echo "QEMUPID is $QEMUPID" | ||
| 467 | break | ||
| 468 | fi | ||
| 469 | done | ||
| 470 | |||
| 471 | if [ ${up_time} == 30 ]; then | ||
| 472 | Test_Info "No qemu process appeared to start, exiting" | ||
| 473 | ps axww -O ppid | ||
| 474 | Test_Info "Process list dumped for debugging purposes" | ||
| 475 | Test_Info "runqemu output log:" | ||
| 476 | cat ${RUNQEMU_LOGFILE} | ||
| 477 | echo | ||
| 478 | return 1 | ||
| 479 | fi | ||
| 480 | |||
| 481 | up_time=0 | ||
| 482 | # Parse IP address of target from the qemu command line | ||
| 483 | TARGET_IPADDR=`Test_Fetch_Target_IP $QEMUPID` | ||
| 484 | echo "Target IP is ${TARGET_IPADDR}" | ||
| 485 | if [ "${TARGET_IPADDR}" = "" -o "${TARGET_IPADDR}" = "0" ]; then | ||
| 486 | Test_Info "There is no qemu process or qemu ip address found, return failed" | ||
| 487 | ps -wwf | ||
| 488 | ps axww -O ppid | ||
| 489 | Test_Info "runqemu output log:" | ||
| 490 | cat ${RUNQEMU_LOGFILE} | ||
| 491 | echo | ||
| 492 | return 1 | ||
| 493 | fi | ||
| 494 | |||
| 495 | while [ ${up_time} -lt ${timeout} ] | ||
| 496 | do | ||
| 497 | Test_Check_IP_UP ${TARGET_IPADDR} | ||
| 498 | if [ $? -eq 0 ]; then | ||
| 499 | Test_Info "Qemu Network is up, ping with ${TARGET_IPADDR} is OK within ${up_time} seconds" | ||
| 500 | return 0 | ||
| 501 | else | ||
| 502 | Test_Info "Wait for Qemu Network up" | ||
| 503 | up_time=`expr $up_time + 5` | ||
| 504 | sleep 5 | ||
| 505 | fi | ||
| 506 | done | ||
| 507 | |||
| 508 | Test_Info "Process list dumped for debugging purposes:" | ||
| 509 | ps axww -O ppid | ||
| 510 | Test_Info "runqemu output log:" | ||
| 511 | cat ${RUNQEMU_LOGFILE} | ||
| 512 | Test_Info "Qemu or its network is not up in ${timeout} seconds" | ||
| 513 | Test_Update_IPSAVE $XTERMPID $TARGET_IPADDR | ||
| 514 | return 1 | ||
| 515 | } | ||
| 516 | |||
| 517 | # Function to prepare test project for toolchain test | ||
| 518 | # $1 is the folder holding test project file | ||
| 519 | # $2 is the test project name | ||
| 520 | Test_Project_Prepare() | ||
| 521 | { | ||
| 522 | local toolchain_dir=$1 | ||
| 523 | |||
| 524 | if [ ! -d ${toolchain_dir} ]; then | ||
| 525 | mkdir -p ${toolchain_dir} | ||
| 526 | if [ $? -ne 0 ]; then | ||
| 527 | ret=$? | ||
| 528 | Test_Info "Create ${toolchain_dir} fail, return" | ||
| 529 | return $ret | ||
| 530 | fi | ||
| 531 | fi | ||
| 532 | |||
| 533 | # Download test project tarball if it does not exist | ||
| 534 | if [ ! -f ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} ]; then | ||
| 535 | wget -c -t 5 $PROJECT_DOWNLOAD_URL -O ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} | ||
| 536 | if [ $? -ne 0 ]; then | ||
| 537 | ret=$? | ||
| 538 | Test_Info "Fail to download ${2}-${PROJECT_PV}.${suffix} from $PROJECT_DOWNLOAD_URL" | ||
| 539 | rm -rf ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} | ||
| 540 | return $ret | ||
| 541 | fi | ||
| 542 | fi | ||
| 543 | |||
| 544 | # Extract the test project into ${TEST_TMP} | ||
| 545 | tar jxf ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} -C ${TEST_TMP} | ||
| 546 | if [ $? -ne 0 ]; then | ||
| 547 | ret=$? | ||
| 548 | Test_Info "Fail to extract ${2}-${PROJECT_PV}.${suffix} into ${TEST_TMP}" | ||
| 549 | return $ret | ||
| 550 | fi | ||
| 551 | Test_Info "Extract ${2}-${PROJECT_PV}.${suffix} into ${TEST_TMP} successfully" | ||
| 552 | return 0 | ||
| 553 | } | ||
| 554 | |||
| 555 | # Function to prepare toolchain environment | ||
| 556 | # $1 is toolchain directory to hold toolchain tarball | ||
| 557 | # $2 is prefix name for toolchain tarball | ||
| 558 | Test_Toolchain_Prepare() | ||
| 559 | { | ||
| 560 | local toolchain_dir=$1 | ||
| 561 | local sdk_name=$2 | ||
| 562 | local ret=1 | ||
| 563 | |||
| 564 | if [ ! -d ${toolchain_dir} ]; then | ||
| 565 | Test_Info "No directory ${toolchain_dir}, which holds toolchain tarballs" | ||
| 566 | return 1 | ||
| 567 | fi | ||
| 568 | |||
| 569 | # Check if there is any toolchain tarball under $toolchain_dir with prefix $sdk_name | ||
| 570 | for i in `dir ${toolchain_dir}` | ||
| 571 | do | ||
| 572 | echo $i | grep "${sdk_name}-toolchain-gmae" | ||
| 573 | if [ $? -eq 0 ]; then | ||
| 574 | rm -rf ${TEST_TMP}/opt | ||
| 575 | tar jxf ${toolchain_dir}/${i} -C ${TEST_TMP} | ||
| 576 | ret=$? | ||
| 577 | break | ||
| 578 | fi | ||
| 579 | done | ||
| 580 | |||
| 581 | if [ $ret -eq 0 ]; then | ||
| 582 | Test_Info "Check if /opt is accessible for non-root user" | ||
| 583 | |||
| 584 | # Check if the non-root test user has write access of $TOOLCHAIN_TEST | ||
| 585 | if [ -d ${TOOLCHAIN_TEST} ]; then | ||
| 586 | touch ${TOOLCHAIN_TEST} | ||
| 587 | if [ $? -ne 0 ]; then | ||
| 588 | Test_Info "Has no right to modify folder $TOOLCHAIN_TEST, pls. chown it to test user" | ||
| 589 | return 2 | ||
| 590 | fi | ||
| 591 | else | ||
| 592 | mkdir -p ${TOOLCHAIN_TEST} | ||
| 593 | if [ $? -ne 0 ]; then | ||
| 594 | Test_Info "Has no right to create folder $TOOLCHAIN_TEST, pls. create it and chown it to test user" | ||
| 595 | return 2 | ||
| 596 | fi | ||
| 597 | fi | ||
| 598 | |||
| 599 | # If there is a toolchain folder under $TOOLCHAIN_TEST, let's remove it | ||
| 600 | if [ -d ${TOOLCHAIN_TEST}/poky ]; then | ||
| 601 | rm -rf ${TOOLCHAIN_TEST}/poky | ||
| 602 | fi | ||
| 603 | |||
| 604 | # Copy toolchain into $TOOLCHAIN_TEST | ||
| 605 | cp -r ${TEST_TMP}/opt/poky ${TOOLCHAIN_TEST} | ||
| 606 | ret=$? | ||
| 607 | |||
| 608 | if [ $ret -eq 0 ]; then | ||
| 609 | Test_Info "Successfully copy toolchain into $TOOLCHAIN_TEST" | ||
| 610 | return $ret | ||
| 611 | else | ||
| 612 | Test_Info "Meet error when copy toolchain into $TOOLCHAIN_TEST" | ||
| 613 | return $ret | ||
| 614 | fi | ||
| 615 | else | ||
| 616 | Test_Info "No tarball named ${sdk_name}-toolchain-gmae under ${toolchain_dir}" | ||
| 617 | return $ret | ||
| 618 | fi | ||
| 619 | } | ||
| 620 | |||
| 621 | # Function to execute command and exit if run out of time | ||
| 622 | # $1 is timeout value | ||
| 623 | # $2 is the command to be executed | ||
| 624 | Test_Time_Out() | ||
| 625 | { | ||
| 626 | local timeout=$1 | ||
| 627 | shift | ||
| 628 | local command=$* | ||
| 629 | local date=0 | ||
| 630 | local tmp=`mktemp` | ||
| 631 | local ret=1 | ||
| 632 | local pid=0 | ||
| 633 | local ppid=0 | ||
| 634 | local i=0 | ||
| 635 | declare local pid_l | ||
| 636 | |||
| 637 | # Run command in background | ||
| 638 | ($command; echo $? > $tmp) & | ||
| 639 | pid=$! | ||
| 640 | while ps -e -o pid | grep -qw $pid; do | ||
| 641 | if [ $date -ge $timeout ]; then | ||
| 642 | Test_Info "$timeout Timeout when running command $command" | ||
| 643 | rm -rf $tmp | ||
| 644 | |||
| 645 | # Find all child processes of pid and kill them | ||
| 646 | ppid=$pid | ||
| 647 | ps -f --ppid $ppid | ||
| 648 | ret=$? | ||
| 649 | |||
| 650 | while [ $ret -eq 0 ] | ||
| 651 | do | ||
| 652 | # If yes, get the child pid and check if the child pid has other child pid | ||
| 653 | # Continue the while loop until there is no child pid found | ||
| 654 | pid_l[$i]=`ps -f --ppid $ppid | awk '{if ($2 != "PID") print $2}'` | ||
| 655 | ppid=${pid_l[$i]} | ||
| 656 | i=$((i+1)) | ||
| 657 | ps -f --ppid $ppid | ||
| 658 | ret=$? | ||
| 659 | done | ||
| 660 | |||
| 661 | # Kill these children pids from the last one | ||
| 662 | while [ $i -ne 0 ] | ||
| 663 | do | ||
| 664 | i=$((i-1)) | ||
| 665 | kill ${pid_l[$i]} | ||
| 666 | sleep 2 | ||
| 667 | done | ||
| 668 | |||
| 669 | # Kill the parent id | ||
| 670 | kill $pid | ||
| 671 | return 1 | ||
| 672 | fi | ||
| 673 | sleep 5 | ||
| 674 | date=`expr $date + 5` | ||
| 675 | done | ||
| 676 | ret=`cat $tmp` | ||
| 677 | rm -rf $tmp | ||
| 678 | return $ret | ||
| 679 | } | ||
| 680 | |||
| 681 | # Function to test toolchain | ||
| 682 | # $1 is test project name | ||
| 683 | # $2 is the timeout value | ||
| 684 | Test_Toolchain() | ||
| 685 | { | ||
| 686 | local test_project=$1 | ||
| 687 | local timeout=$2 | ||
| 688 | local ret=1 | ||
| 689 | local suffix="tar.bz2" | ||
| 690 | local env_setup="" | ||
| 691 | local pro_install="${TEST_TMP}/pro_install" | ||
| 692 | |||
| 693 | # Set value for PROJECT_PV and PROJECT_DOWNLOAD_URL accordingly | ||
| 694 | if [ $test_project == "cvs" ]; then | ||
| 695 | PROJECT_PV=1.12.13 | ||
| 696 | PROJECT_DOWNLOAD_URL="http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2" | ||
| 697 | elif [ $test_project == "iptables" ]; then | ||
| 698 | PROJECT_PV=1.4.11 | ||
| 699 | PROJECT_DOWNLOAD_URL="http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2" | ||
| 700 | elif [ $test_project == "sudoku-savant" ]; then | ||
| 701 | PROJECT_PV=1.3 | ||
| 702 | PROJECT_DOWNLOAD_URL="http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2" | ||
| 703 | else | ||
| 704 | Test_Info "Unknown test project name $test_project" | ||
| 705 | return 1 | ||
| 706 | fi | ||
| 707 | |||
| 708 | # Download test project and extract it | ||
| 709 | Test_Project_Prepare $TOOLCHAIN_PROJECTS $test_project | ||
| 710 | if [ $? -ne 0 ]; then | ||
| 711 | Test_Info "Prepare test project file failed" | ||
| 712 | return 1 | ||
| 713 | fi | ||
| 714 | |||
| 715 | # Extract toolchain tarball into ${TEST_TMP} | ||
| 716 | Test_Toolchain_Prepare $TOOLCHAIN_DIR $SDK_NAME | ||
| 717 | ret=$? | ||
| 718 | if [ $ret -ne 0 ]; then | ||
| 719 | Test_Info "Prepare toolchain test environment failed" | ||
| 720 | return $ret | ||
| 721 | fi | ||
| 722 | |||
| 723 | if [ ! -d ${pro_install} ]; then | ||
| 724 | mkdir -p ${pro_install} | ||
| 725 | fi | ||
| 726 | |||
| 727 | # Begin to build test project in toolchain environment | ||
| 728 | env_setup=`find ${TOOLCHAIN_TEST}/poky -name "environment-setup*"` | ||
| 729 | |||
| 730 | source $env_setup | ||
| 731 | |||
| 732 | if [ $test_project == "cvs" -o $test_project == "iptables" ]; then | ||
| 733 | cd ${TEST_TMP}/${test_project}-${PROJECT_PV} | ||
| 734 | Test_Time_Out $timeout ./configure ${CONFIGURE_FLAGS} || { Test_Info "configure failed with $test_project"; return 1; } | ||
| 735 | Test_Time_Out $timeout make -j4 || { Test_Info "make failed with $test_project"; return 1; } | ||
| 736 | Test_Time_Out $timeout make install DESTDIR=${pro_install} || { Test_Info "make failed with $test_project"; return 1; } | ||
| 737 | cd - | ||
| 738 | ret=0 | ||
| 739 | elif [ $test_project == "sudoku-savant" ]; then | ||
| 740 | cd ${TEST_TMP}/${test_project}-${PROJECT_PV} | ||
| 741 | Test_Time_Out $timeout ./configure ${CONFIGURE_FLAGS} || { Test_Info "configure failed with $test_project"; return 1; } | ||
| 742 | Test_Time_Out $timeout make -j4 || { Test_Info "make failed with $test_project"; return 1; } | ||
| 743 | cd - | ||
| 744 | ret=0 | ||
| 745 | else | ||
| 746 | Test_Info "Unknown test project $test_project" | ||
| 747 | ret=1 | ||
| 748 | fi | ||
| 749 | |||
| 750 | return $ret | ||
| 751 | } | ||
| 752 | |||
| 753 | Test_Display_Syslog() | ||
| 754 | { | ||
| 755 | local tmplog=`mktemp` | ||
| 756 | Test_SCP_From ${TARGET_IPADDR} /var/log/messages $tmplog | ||
| 757 | echo "System logs:" | ||
| 758 | cat $tmplog | ||
| 759 | rm -f $tmplog | ||
| 760 | } | ||
diff --git a/scripts/qemuimage-testlib-pythonhelper b/scripts/qemuimage-testlib-pythonhelper deleted file mode 100755 index 6435dd8f18..0000000000 --- a/scripts/qemuimage-testlib-pythonhelper +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | #!/usr/bin/env python | ||
| 2 | |||
| 3 | import optparse | ||
| 4 | import subprocess | ||
| 5 | import sys | ||
| 6 | import os | ||
| 7 | |||
| 8 | parser = optparse.OptionParser( | ||
| 9 | usage = """ | ||
| 10 | %prog [options] | ||
| 11 | """) | ||
| 12 | |||
| 13 | parser.add_option("-q", "--findqemu", | ||
| 14 | help = "find a qemu beneath the process <pid>", | ||
| 15 | action="store", dest="findqemu") | ||
| 16 | |||
| 17 | options, args = parser.parse_args(sys.argv) | ||
| 18 | |||
| 19 | if options.findqemu: | ||
| 20 | # | ||
| 21 | # Walk the process tree from the process specified looking for a qemu-system. Return its pid. | ||
| 22 | # | ||
| 23 | ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0] | ||
| 24 | processes = ps.split('\n') | ||
| 25 | nfields = len(processes[0].split()) - 1 | ||
| 26 | pids = {} | ||
| 27 | commands = {} | ||
| 28 | for row in processes[1:]: | ||
| 29 | data = row.split(None, nfields) | ||
| 30 | if len(data) != 3: | ||
| 31 | continue | ||
| 32 | if data[1] not in pids: | ||
| 33 | pids[data[1]] = [] | ||
| 34 | pids[data[1]].append(data[0]) | ||
| 35 | commands[data[0]] = data[2] | ||
| 36 | |||
| 37 | if options.findqemu not in pids: | ||
| 38 | sys.stderr.write("No children found matching %s" % options.findqemu) | ||
| 39 | sys.exit(1) | ||
| 40 | |||
| 41 | parents = [] | ||
| 42 | newparents = pids[options.findqemu] | ||
| 43 | while newparents: | ||
| 44 | next = [] | ||
| 45 | for p in newparents: | ||
| 46 | if p in pids: | ||
| 47 | for n in pids[p]: | ||
| 48 | if n not in parents and n not in next: | ||
| 49 | next.append(n) | ||
| 50 | |||
| 51 | if p not in parents: | ||
| 52 | parents.append(p) | ||
| 53 | newparents = next | ||
| 54 | #print "Children matching %s:" % str(parents) | ||
| 55 | for p in parents: | ||
| 56 | # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx" | ||
| 57 | # Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx" | ||
| 58 | basecmd = commands[p].split()[0] | ||
| 59 | basecmd = os.path.basename(basecmd) | ||
| 60 | if "qemu-system" in basecmd and "192.168" in commands[p]: | ||
| 61 | print p | ||
| 62 | sys.exit(0) | ||
| 63 | sys.exit(1) | ||
| 64 | else: | ||
| 65 | parser.print_help() | ||
| 66 | |||
diff --git a/scripts/qemuimage-tests/sanity/boot b/scripts/qemuimage-tests/sanity/boot deleted file mode 100755 index 5a8c01c9ac..0000000000 --- a/scripts/qemuimage-tests/sanity/boot +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # Boot Test Case for Sanity Test | ||
| 4 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 5 | # Then check if qemu and qemu network is up. | ||
| 6 | # | ||
| 7 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 8 | # | ||
| 9 | # This file is licensed under the GNU General Public License, | ||
| 10 | # Version 2. | ||
| 11 | # | ||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | |||
| 16 | # Start qemu and check its network | ||
| 17 | Test_Create_Qemu ${TIMEOUT} | ||
| 18 | |||
| 19 | if [ $? -eq 0 ]; then | ||
| 20 | Test_Info "Boot Test PASS" | ||
| 21 | Test_Kill_Qemu | ||
| 22 | Test_Print_Result "Boot" 0 | ||
| 23 | exit 0 | ||
| 24 | else | ||
| 25 | Test_Info "Boot Test FAIL" | ||
| 26 | Test_Kill_Qemu | ||
| 27 | Test_Print_Result "Boot" 1 | ||
| 28 | exit 1 | ||
| 29 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/compiler b/scripts/qemuimage-tests/sanity/compiler deleted file mode 100755 index ef0700732d..0000000000 --- a/scripts/qemuimage-tests/sanity/compiler +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Compiler Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if gcc/g++/make command can work in target. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | # Check if gcc/g++/make can work in target | ||
| 30 | if [ $RET -eq 0 -a -f $TOOLS/compiler_test.sh ]; then | ||
| 31 | # Copy compiler_test.sh into target | ||
| 32 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/compiler_test.sh | ||
| 33 | if [ $? -eq 0 ]; then | ||
| 34 | # Run compiler_test.sh to check if gcc/g++/make can work in target | ||
| 35 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/compiler_test.sh" | ||
| 36 | RET=$? | ||
| 37 | else | ||
| 38 | RET=1 | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${RET} -eq 0 ]; then | ||
| 43 | Test_Info "Compiler Test PASS" | ||
| 44 | Test_Kill_Qemu | ||
| 45 | Test_Print_Result "compiler" 0 | ||
| 46 | exit 0 | ||
| 47 | else | ||
| 48 | Test_Info "Compiler FAIL, Pls. check above error log" | ||
| 49 | Test_Kill_Qemu | ||
| 50 | Test_Print_Result "compiler" 1 | ||
| 51 | exit 1 | ||
| 52 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/connman b/scripts/qemuimage-tests/sanity/connman deleted file mode 100755 index b3332012fa..0000000000 --- a/scripts/qemuimage-tests/sanity/connman +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Conmman Check Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if connman can work in target. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | # Check if connman can work in target | ||
| 30 | if [ $RET -eq 0 -a -f $TOOLS/connman_test.sh ]; then | ||
| 31 | # Copy connman_test.sh into target | ||
| 32 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/connman_test.sh | ||
| 33 | if [ $? -eq 0 ]; then | ||
| 34 | # Run connman_test.sh to check if connman can work in target | ||
| 35 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/connman_test.sh" | ||
| 36 | RET=$? | ||
| 37 | else | ||
| 38 | RET=1 | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${RET} -eq 0 ]; then | ||
| 43 | Test_Info "Connman Test PASS" | ||
| 44 | Test_Kill_Qemu | ||
| 45 | Test_Print_Result "connman" 0 | ||
| 46 | exit 0 | ||
| 47 | else | ||
| 48 | Test_Info "Connman Test FAIL, Pls. check above error log" | ||
| 49 | Test_Display_Syslog | ||
| 50 | Test_Kill_Qemu | ||
| 51 | Test_Print_Result "connman" 1 | ||
| 52 | exit 1 | ||
| 53 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/dmesg b/scripts/qemuimage-tests/sanity/dmesg deleted file mode 100755 index aed29e05eb..0000000000 --- a/scripts/qemuimage-tests/sanity/dmesg +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Dmesg Check Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if there is any error log in dmesg. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | # Check if there is any error log in dmesg | ||
| 30 | if [ $RET -eq 0 -a -f $TOOLS/dmesg.sh ]; then | ||
| 31 | # Copy dmesg.sh into target | ||
| 32 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/dmesg.sh | ||
| 33 | if [ $? -eq 0 ]; then | ||
| 34 | # Run dmesg.sh to check if there is any error message with command dmesg | ||
| 35 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/dmesg.sh" | ||
| 36 | RET=$? | ||
| 37 | else | ||
| 38 | RET=1 | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${RET} -eq 0 ]; then | ||
| 43 | Test_Info "Dmesg Test PASS" | ||
| 44 | Test_Kill_Qemu | ||
| 45 | Test_Print_Result "dmesg" 0 | ||
| 46 | exit 0 | ||
| 47 | else | ||
| 48 | Test_Info "Dmesg Test FAIL, Pls. check above error log" | ||
| 49 | Test_Kill_Qemu | ||
| 50 | Test_Print_Result "dmesg" 1 | ||
| 51 | exit 1 | ||
| 52 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/rpm_query b/scripts/qemuimage-tests/sanity/rpm_query deleted file mode 100755 index dd652bd998..0000000000 --- a/scripts/qemuimage-tests/sanity/rpm_query +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # RPM Check Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if rpm command can work in target. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | # Check if rpm query can work in target | ||
| 30 | if [ $RET -eq 0 -a -f $TOOLS/rpm_test.sh ]; then | ||
| 31 | # Copy rpm_test.sh into target | ||
| 32 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/rpm_test.sh | ||
| 33 | if [ $? -eq 0 ]; then | ||
| 34 | # Run rpm_test.sh to check if rpm query can work in target | ||
| 35 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/rpm_test.sh -qa" | ||
| 36 | RET=$? | ||
| 37 | else | ||
| 38 | RET=1 | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${RET} -eq 0 ]; then | ||
| 43 | Test_Info "rpm query Test PASS" | ||
| 44 | Test_Kill_Qemu | ||
| 45 | Test_Print_Result "rpm_query" 0 | ||
| 46 | exit 0 | ||
| 47 | else | ||
| 48 | Test_Info "rpm query FAIL, Pls. check above error log" | ||
| 49 | Test_Kill_Qemu | ||
| 50 | Test_Print_Result "rpm_query" 1 | ||
| 51 | exit 1 | ||
| 52 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/scp b/scripts/qemuimage-tests/sanity/scp deleted file mode 100755 index b0b693d0c8..0000000000 --- a/scripts/qemuimage-tests/sanity/scp +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # SCP Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if file can be copied into target with scp command. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | SPID=0 | ||
| 17 | i=0 | ||
| 18 | |||
| 19 | # Start qemu and check its network | ||
| 20 | Test_Create_Qemu ${TIMEOUT} | ||
| 21 | |||
| 22 | # If qemu network is up, check ssh service in qemu | ||
| 23 | if [ $? -eq 0 ]; then | ||
| 24 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 25 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 26 | RET=$? | ||
| 27 | else | ||
| 28 | RET=1 | ||
| 29 | fi | ||
| 30 | |||
| 31 | # Check if file can be copied from host into target | ||
| 32 | # For qemu target, the file is 5M | ||
| 33 | if [ $RET -eq 0 ]; then | ||
| 34 | echo $QEMUARCH | grep -q "qemu" | ||
| 35 | |||
| 36 | if [ $? -eq 0 ]; then | ||
| 37 | dd if=/dev/zero of=${TEST_TMP}/scp_test_file bs=512k count=10 | ||
| 38 | Test_SCP ${TARGET_IPADDR} ${TEST_TMP}/scp_test_file /home/root & | ||
| 39 | SPID=$! | ||
| 40 | fi | ||
| 41 | |||
| 42 | # Check if scp finished or not | ||
| 43 | while [ $i -lt $TIMEOUT ] | ||
| 44 | do | ||
| 45 | ps -fp $SPID > /dev/null | ||
| 46 | if [ $? -ne 0 ]; then | ||
| 47 | RET=0 | ||
| 48 | break | ||
| 49 | fi | ||
| 50 | i=$((i+5)) | ||
| 51 | sleep 5 | ||
| 52 | done | ||
| 53 | |||
| 54 | # Kill scp process if scp is not finished in time | ||
| 55 | if [ $i -ge $TIMEOUT ]; then | ||
| 56 | RET=1 | ||
| 57 | kill $SPID | ||
| 58 | fi | ||
| 59 | fi | ||
| 60 | |||
| 61 | if [ ${RET} -eq 0 ]; then | ||
| 62 | Test_Info "SCP Test PASS" | ||
| 63 | Test_Kill_Qemu | ||
| 64 | Test_Print_Result "SCP" 0 | ||
| 65 | exit 0 | ||
| 66 | else | ||
| 67 | Test_Info "SCP Test FAIL" | ||
| 68 | Test_Kill_Qemu | ||
| 69 | Test_Print_Result "SCP" 1 | ||
| 70 | exit 1 | ||
| 71 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/shutdown b/scripts/qemuimage-tests/sanity/shutdown deleted file mode 100755 index c9e931c4c2..0000000000 --- a/scripts/qemuimage-tests/sanity/shutdown +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Shutdown Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if target can shutdown | ||
| 5 | # For qemux86/x86-64, we use command "poweroff" for target shutdown | ||
| 6 | # For non-x86 targets, we use command "reboot" for target shutdown | ||
| 7 | # | ||
| 8 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 9 | # | ||
| 10 | # This file is licensed under the GNU General Public License, | ||
| 11 | # Version 2. | ||
| 12 | # | ||
| 13 | |||
| 14 | . $COREBASE/scripts/qemuimage-testlib | ||
| 15 | |||
| 16 | TIMEOUT=400 | ||
| 17 | |||
| 18 | RET=1 | ||
| 19 | i=0 | ||
| 20 | |||
| 21 | # Start qemu and check its network | ||
| 22 | Test_Create_Qemu ${TIMEOUT} | ||
| 23 | |||
| 24 | # If qemu network is up, check ssh service in qemu | ||
| 25 | if [ $? -eq 0 ]; then | ||
| 26 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 27 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 28 | RET=$? | ||
| 29 | else | ||
| 30 | RET=1 | ||
| 31 | fi | ||
| 32 | |||
| 33 | # Check if target can shutdown | ||
| 34 | if [ $RET -eq 0 ]; then | ||
| 35 | echo $QEMUARCH | grep -q "qemux86" | ||
| 36 | |||
| 37 | # For qemux86/x86-64, command "poweroff" is used | ||
| 38 | # For non x86 qemu targets, command "reboot" is used because of BUG #100 | ||
| 39 | if [ $? -eq 0 ]; then | ||
| 40 | Test_SSH ${TARGET_IPADDR} "/sbin/poweroff" | ||
| 41 | else | ||
| 42 | Test_SSH ${TARGET_IPADDR} "/sbin/reboot" | ||
| 43 | fi | ||
| 44 | |||
| 45 | # If qemu start up process ends up, it means shutdown completes | ||
| 46 | while [ $i -lt $TIMEOUT ] | ||
| 47 | do | ||
| 48 | ps -fp $QEMUPID > /dev/null 2> /dev/null | ||
| 49 | if [ $? -ne 0 ]; then | ||
| 50 | RET=0 | ||
| 51 | break | ||
| 52 | fi | ||
| 53 | i=$((i+5)) | ||
| 54 | sleep 5 | ||
| 55 | done | ||
| 56 | |||
| 57 | if [ $i -ge $TIMEOUT ]; then | ||
| 58 | RET=1 | ||
| 59 | fi | ||
| 60 | fi | ||
| 61 | |||
| 62 | if [ ${RET} -eq 0 ]; then | ||
| 63 | Test_Info "Shutdown Test PASS" | ||
| 64 | Test_Print_Result "shutdown" 0 | ||
| 65 | |||
| 66 | # Remove TARGET_IPSAVE since no existing qemu running now | ||
| 67 | if [ -e ${TARGET_IPSAVE} ]; then | ||
| 68 | rm -rf ${TARGET_IPSAVE} | ||
| 69 | fi | ||
| 70 | exit 0 | ||
| 71 | else | ||
| 72 | Test_Info "Shutdown Test FAIL" | ||
| 73 | Test_Kill_Qemu | ||
| 74 | Test_Print_Result "shutdown" 1 | ||
| 75 | exit 1 | ||
| 76 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/smart_help b/scripts/qemuimage-tests/sanity/smart_help deleted file mode 100755 index 0eeac26493..0000000000 --- a/scripts/qemuimage-tests/sanity/smart_help +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Smart Check Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if smart command can work in target. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | # Check if smart --help can work in target | ||
| 30 | if [ $RET -eq 0 -a -f $TOOLS/smart_test.sh ]; then | ||
| 31 | # Copy smart_test.sh into target | ||
| 32 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/smart_test.sh | ||
| 33 | if [ $? -eq 0 ]; then | ||
| 34 | # Run smart_test.sh to check if smart --help can work in target | ||
| 35 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/smart_test.sh --help" | ||
| 36 | RET=$? | ||
| 37 | else | ||
| 38 | RET=1 | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${RET} -eq 0 ]; then | ||
| 43 | Test_Info "smart --help Test PASS" | ||
| 44 | Test_Kill_Qemu | ||
| 45 | Test_Print_Result "smart_help" 0 | ||
| 46 | exit 0 | ||
| 47 | else | ||
| 48 | Test_Info "smart --help FAIL, Pls. check above error log" | ||
| 49 | Test_Kill_Qemu | ||
| 50 | Test_Print_Result "smart_help" 1 | ||
| 51 | exit 1 | ||
| 52 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/smart_query b/scripts/qemuimage-tests/sanity/smart_query deleted file mode 100755 index 779ee630b3..0000000000 --- a/scripts/qemuimage-tests/sanity/smart_query +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Smart Check Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if smart command can work in target. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | # Check if smart query can work in target | ||
| 30 | if [ $RET -eq 0 -a -f $TOOLS/smart_test.sh ]; then | ||
| 31 | # Copy smart_test.sh into target | ||
| 32 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/smart_test.sh | ||
| 33 | if [ $? -eq 0 ]; then | ||
| 34 | # Run smart_test.sh to check if smart query can work in target | ||
| 35 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/smart_test.sh query avahi*" | ||
| 36 | RET=$? | ||
| 37 | else | ||
| 38 | RET=1 | ||
| 39 | fi | ||
| 40 | fi | ||
| 41 | |||
| 42 | if [ ${RET} -eq 0 ]; then | ||
| 43 | Test_Info "smart query package avahi Test PASS" | ||
| 44 | Test_Kill_Qemu | ||
| 45 | Test_Print_Result "smart_query" 0 | ||
| 46 | exit 0 | ||
| 47 | else | ||
| 48 | Test_Info "smart query package avahi FAIL, Pls. check above error log" | ||
| 49 | Test_Kill_Qemu | ||
| 50 | Test_Print_Result "smart_query" 1 | ||
| 51 | exit 1 | ||
| 52 | fi | ||
diff --git a/scripts/qemuimage-tests/sanity/ssh b/scripts/qemuimage-tests/sanity/ssh deleted file mode 100755 index 181296b0b5..0000000000 --- a/scripts/qemuimage-tests/sanity/ssh +++ /dev/null | |||
| @@ -1,39 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # SSH Test Case for Sanity Test | ||
| 3 | # The case boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # Then check if ssh service in qemu is up. | ||
| 5 | # | ||
| 6 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | # If qemu network is up, check ssh service in qemu | ||
| 21 | if [ $? -eq 0 ]; then | ||
| 22 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 23 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 24 | RET=$? | ||
| 25 | else | ||
| 26 | RET=1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | if [ ${RET} -eq 0 ]; then | ||
| 30 | Test_Info "SSH Test PASS" | ||
| 31 | Test_Kill_Qemu | ||
| 32 | Test_Print_Result "SSH" 0 | ||
| 33 | exit 0 | ||
| 34 | else | ||
| 35 | Test_Info "SSH Test FAIL" | ||
| 36 | Test_Kill_Qemu | ||
| 37 | Test_Print_Result "SSH" 1 | ||
| 38 | exit 1 | ||
| 39 | fi | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-lsb b/scripts/qemuimage-tests/scenario/qemuarm/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-lsb +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity dmesg | ||
| 7 | sanity shutdown | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-minimal b/scripts/qemuimage-tests/scenario/qemuarm/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-minimal +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | sanity boot | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato b/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity connman | ||
| 7 | sanity dmesg | ||
| 8 | sanity shutdown | ||
| 9 | systemusage bash | ||
| 10 | systemusage df | ||
| 11 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/core-image-sato-sdk +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity compiler | ||
| 7 | sanity connman | ||
| 8 | sanity dmesg | ||
| 9 | sanity shutdown | ||
| 10 | systemusage bash | ||
| 11 | systemusage df | ||
| 12 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuarm/meta-toolchain-gmae +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | toolchain cvs | ||
| 2 | toolchain iptables | ||
| 3 | toolchain sudoku-savant | ||
diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-lsb b/scripts/qemuimage-tests/scenario/qemumips/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-lsb +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity dmesg | ||
| 7 | sanity shutdown | ||
diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-minimal b/scripts/qemuimage-tests/scenario/qemumips/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-minimal +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | sanity boot | ||
diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato b/scripts/qemuimage-tests/scenario/qemumips/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity connman | ||
| 7 | sanity dmesg | ||
| 8 | sanity shutdown | ||
| 9 | systemusage bash | ||
| 10 | systemusage df | ||
| 11 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemumips/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/core-image-sato-sdk +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity compiler | ||
| 7 | sanity connman | ||
| 8 | sanity dmesg | ||
| 9 | sanity shutdown | ||
| 10 | systemusage bash | ||
| 11 | systemusage df | ||
| 12 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemumips/meta-toolchain-gmae +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | toolchain cvs | ||
| 2 | toolchain iptables | ||
| 3 | toolchain sudoku-savant | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-lsb b/scripts/qemuimage-tests/scenario/qemuppc/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-lsb +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity dmesg | ||
| 7 | sanity shutdown | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-minimal b/scripts/qemuimage-tests/scenario/qemuppc/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-minimal +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | sanity boot | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato b/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity connman | ||
| 7 | sanity dmesg | ||
| 8 | sanity shutdown | ||
| 9 | systemusage bash | ||
| 10 | systemusage df | ||
| 11 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/core-image-sato-sdk +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity compiler | ||
| 7 | sanity connman | ||
| 8 | sanity dmesg | ||
| 9 | sanity shutdown | ||
| 10 | systemusage bash | ||
| 11 | systemusage df | ||
| 12 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemuppc/meta-toolchain-gmae +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | toolchain cvs | ||
| 2 | toolchain iptables | ||
| 3 | toolchain sudoku-savant | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-lsb b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-lsb +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity dmesg | ||
| 7 | sanity shutdown | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-minimal b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-minimal +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | sanity boot | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity connman | ||
| 7 | sanity dmesg | ||
| 8 | sanity shutdown | ||
| 9 | systemusage bash | ||
| 10 | systemusage df | ||
| 11 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/core-image-sato-sdk +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity compiler | ||
| 7 | sanity connman | ||
| 8 | sanity dmesg | ||
| 9 | sanity shutdown | ||
| 10 | systemusage bash | ||
| 11 | systemusage df | ||
| 12 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86-64/meta-toolchain-gmae +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | toolchain cvs | ||
| 2 | toolchain iptables | ||
| 3 | toolchain sudoku-savant | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-lsb b/scripts/qemuimage-tests/scenario/qemux86/core-image-lsb deleted file mode 100644 index b2977f1653..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-lsb +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity dmesg | ||
| 7 | sanity shutdown | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-minimal b/scripts/qemuimage-tests/scenario/qemux86/core-image-minimal deleted file mode 100644 index 0fcc7bba84..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-minimal +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | sanity boot | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato b/scripts/qemuimage-tests/scenario/qemux86/core-image-sato deleted file mode 100644 index bef33e82d2..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity connman | ||
| 7 | sanity dmesg | ||
| 8 | sanity shutdown | ||
| 9 | systemusage bash | ||
| 10 | systemusage df | ||
| 11 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato-sdk b/scripts/qemuimage-tests/scenario/qemux86/core-image-sato-sdk deleted file mode 100644 index 505b0a2f97..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/core-image-sato-sdk +++ /dev/null | |||
| @@ -1,12 +0,0 @@ | |||
| 1 | sanity ssh | ||
| 2 | sanity scp | ||
| 3 | sanity smart_help | ||
| 4 | sanity smart_query | ||
| 5 | sanity rpm_query | ||
| 6 | sanity compiler | ||
| 7 | sanity connman | ||
| 8 | sanity dmesg | ||
| 9 | sanity shutdown | ||
| 10 | systemusage bash | ||
| 11 | systemusage df | ||
| 12 | systemusage syslog | ||
diff --git a/scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae b/scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae deleted file mode 100644 index 199176efc8..0000000000 --- a/scripts/qemuimage-tests/scenario/qemux86/meta-toolchain-gmae +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | toolchain cvs | ||
| 2 | toolchain iptables | ||
| 3 | toolchain sudoku-savant | ||
diff --git a/scripts/qemuimage-tests/systemusage/bash b/scripts/qemuimage-tests/systemusage/bash deleted file mode 100755 index fb9bb5cba2..0000000000 --- a/scripts/qemuimage-tests/systemusage/bash +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # on the target, check bash prompt is available or not | ||
| 3 | # boot up the qemu target with `runqemu qemuxxx`, | ||
| 4 | # then check bash. | ||
| 5 | # | ||
| 6 | # Author: veera <veerabrahmamvr@huawei.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | # Start qemu and check its network | ||
| 17 | Test_Create_Qemu ${TIMEOUT} | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | # If qemu network is up, check ssh service in qemu | ||
| 22 | if [ $? -eq 0 ];then | ||
| 23 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 24 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 25 | RET=$? | ||
| 26 | else | ||
| 27 | RET=1 | ||
| 28 | fi | ||
| 29 | |||
| 30 | # Check bash is working fine or not | ||
| 31 | if [ $RET -eq 0 -a -f $TOOLS/bash.sh ]; then | ||
| 32 | # Copy bash.sh into target | ||
| 33 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/bash.sh | ||
| 34 | if [ $? -eq 0 ]; then | ||
| 35 | # Run bash.sh to check if bash command available or not on the qemuxxx target | ||
| 36 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/bash.sh" | ||
| 37 | RET=$? | ||
| 38 | else | ||
| 39 | RET=1 | ||
| 40 | fi | ||
| 41 | fi | ||
| 42 | |||
| 43 | if [ ${RET} -eq 0 ]; then | ||
| 44 | Test_Info "bash Test PASS" | ||
| 45 | Test_Kill_Qemu | ||
| 46 | Test_Print_Result "bash" 0 | ||
| 47 | exit 0 | ||
| 48 | else | ||
| 49 | Test_Info "bash Test FAIL, Pls. check above bash" | ||
| 50 | Test_Kill_Qemu | ||
| 51 | Test_Print_Result "bash" 1 | ||
| 52 | exit 1 | ||
| 53 | fi | ||
diff --git a/scripts/qemuimage-tests/systemusage/df b/scripts/qemuimage-tests/systemusage/df deleted file mode 100755 index 9657b73b34..0000000000 --- a/scripts/qemuimage-tests/systemusage/df +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # df -h check test case for function test | ||
| 3 | # boot up the qemu target with `runqemu qemuxxx`, | ||
| 4 | # then check if df space is fine or not target. | ||
| 5 | # | ||
| 6 | # Author: veera <veerabrahmamvr@huawei.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | #If qemu network is up, check ssh service in qemu | ||
| 23 | if [ $? -eq 0 ];then | ||
| 24 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 25 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 26 | RET=$? | ||
| 27 | else | ||
| 28 | RET=1 | ||
| 29 | fi | ||
| 30 | |||
| 31 | # Check if disk spcae space is enough or not(using df command) | ||
| 32 | if [ $RET -eq 0 -a -f $TOOLS/df.sh ]; then | ||
| 33 | # Copy df.sh into target | ||
| 34 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/df.sh | ||
| 35 | if [ $? -eq 0 ]; then | ||
| 36 | # Run df.sh to check if df space is fine or not on the qemuxxx target | ||
| 37 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/df.sh" | ||
| 38 | RET=$? | ||
| 39 | else | ||
| 40 | RET=1 | ||
| 41 | fi | ||
| 42 | fi | ||
| 43 | |||
| 44 | if [ ${RET} -eq 0 ]; then | ||
| 45 | Test_Info "df Test PASS" | ||
| 46 | Test_Kill_Qemu | ||
| 47 | Test_Print_Result "df" 0 | ||
| 48 | exit 0 | ||
| 49 | else | ||
| 50 | Test_Info "df Test FAIL, Pls. check above df" | ||
| 51 | Test_Kill_Qemu | ||
| 52 | Test_Print_Result "df" 1 | ||
| 53 | exit 1 | ||
| 54 | fi | ||
diff --git a/scripts/qemuimage-tests/systemusage/syslog b/scripts/qemuimage-tests/systemusage/syslog deleted file mode 100755 index 559f7c1573..0000000000 --- a/scripts/qemuimage-tests/systemusage/syslog +++ /dev/null | |||
| @@ -1,54 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # syslog Check test Case for function test | ||
| 3 | # boot up the Qemu target with `runqemu qemuxxx`. | ||
| 4 | # then check if syslog service is working fine or not target. | ||
| 5 | # | ||
| 6 | # Author: veera <veerabrahmamvr@huawei.com> | ||
| 7 | # | ||
| 8 | # This file is licensed under the GNU General Public License, | ||
| 9 | # Version 2. | ||
| 10 | # | ||
| 11 | |||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=400 | ||
| 15 | RET=1 | ||
| 16 | |||
| 17 | # Start qemu and check its network | ||
| 18 | Test_Create_Qemu ${TIMEOUT} | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | # If qemu network is up, check ssh service in qemu | ||
| 23 | if [ $? -eq 0 ];then | ||
| 24 | Test_Info "Begin to Test SSH Service in Qemu" | ||
| 25 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
| 26 | RET=$? | ||
| 27 | else | ||
| 28 | RET=1 | ||
| 29 | fi | ||
| 30 | |||
| 31 | # Check if syslog is working fine or not | ||
| 32 | if [ $RET -eq 0 -a -f $TOOLS/syslog.sh ]; then | ||
| 33 | # Copy syslog.sh into target | ||
| 34 | Test_Target_Pre ${TARGET_IPADDR} $TOOLS/syslog.sh | ||
| 35 | if [ $? -eq 0 ]; then | ||
| 36 | # Run syslog.sh to check if syslog service is working fine or not on the qemuxxx target | ||
| 37 | Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/syslog.sh" | ||
| 38 | RET=$? | ||
| 39 | else | ||
| 40 | RET=1 | ||
| 41 | fi | ||
| 42 | fi | ||
| 43 | |||
| 44 | if [ ${RET} -eq 0 ]; then | ||
| 45 | Test_Info "syslog Test PASS" | ||
| 46 | Test_Kill_Qemu | ||
| 47 | Test_Print_Result "syslog" 0 | ||
| 48 | exit 0 | ||
| 49 | else | ||
| 50 | Test_Info "syslog Test FAIL, Pls. check above syslog" | ||
| 51 | Test_Kill_Qemu | ||
| 52 | Test_Print_Result "syslog" 1 | ||
| 53 | exit 1 | ||
| 54 | fi | ||
diff --git a/scripts/qemuimage-tests/toolchain/cvs b/scripts/qemuimage-tests/toolchain/cvs deleted file mode 100755 index 871d99110f..0000000000 --- a/scripts/qemuimage-tests/toolchain/cvs +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # CVS compile Test for toolchain test | ||
| 4 | # The case extract toolchain tarball into temp folder | ||
| 5 | # Then compile CVS with the toolchain environment | ||
| 6 | # | ||
| 7 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 8 | # | ||
| 9 | # This file is licensed under the GNU General Public License, | ||
| 10 | # Version 2. | ||
| 11 | # | ||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=120 | ||
| 15 | |||
| 16 | # Extract and test toolchain tarball | ||
| 17 | Test_Toolchain cvs ${TIMEOUT} | ||
| 18 | |||
| 19 | if [ $? -eq 0 ]; then | ||
| 20 | Test_Info "CVS Test PASS" | ||
| 21 | Test_Print_Result "CVS" 0 | ||
| 22 | exit 0 | ||
| 23 | elif [ $? -eq 1 ]; then | ||
| 24 | Test_Info "CVS Test FAIL" | ||
| 25 | Test_Print_Result "CVS" 1 | ||
| 26 | exit 1 | ||
| 27 | else | ||
| 28 | Test_Info "Skip CVS Test due to some configuration problem" | ||
| 29 | Test_Print_Result "CVS" 2 | ||
| 30 | exit 2 | ||
| 31 | fi | ||
diff --git a/scripts/qemuimage-tests/toolchain/iptables b/scripts/qemuimage-tests/toolchain/iptables deleted file mode 100755 index af89bbe7b3..0000000000 --- a/scripts/qemuimage-tests/toolchain/iptables +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # iptables compile Test for toolchain test | ||
| 4 | # The case extract toolchain tarball into temp folder | ||
| 5 | # Then compile iptables with the toolchain environment | ||
| 6 | # | ||
| 7 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 8 | # | ||
| 9 | # This file is licensed under the GNU General Public License, | ||
| 10 | # Version 2. | ||
| 11 | # | ||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=120 | ||
| 15 | |||
| 16 | # Extract and test toolchain tarball | ||
| 17 | Test_Toolchain iptables ${TIMEOUT} | ||
| 18 | |||
| 19 | if [ $? -eq 0 ]; then | ||
| 20 | Test_Info "iptables Test PASS" | ||
| 21 | Test_Print_Result "iptables" 0 | ||
| 22 | exit 0 | ||
| 23 | elif [ $? -eq 1 ]; then | ||
| 24 | Test_Info "iptables Test FAIL" | ||
| 25 | Test_Print_Result "iptables" 1 | ||
| 26 | exit 1 | ||
| 27 | else | ||
| 28 | Test_Info "Skip iptables Test due to some configuration problem" | ||
| 29 | Test_Print_Result "iptables" 2 | ||
| 30 | exit 2 | ||
| 31 | fi | ||
diff --git a/scripts/qemuimage-tests/toolchain/sudoku-savant b/scripts/qemuimage-tests/toolchain/sudoku-savant deleted file mode 100755 index 3d149dea27..0000000000 --- a/scripts/qemuimage-tests/toolchain/sudoku-savant +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # sudoku-savant compile Test for toolchain test | ||
| 4 | # The case extract toolchain tarball into temp folder | ||
| 5 | # Then compile sudoku-savant with the toolchain environment | ||
| 6 | # | ||
| 7 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 8 | # | ||
| 9 | # This file is licensed under the GNU General Public License, | ||
| 10 | # Version 2. | ||
| 11 | # | ||
| 12 | . $COREBASE/scripts/qemuimage-testlib | ||
| 13 | |||
| 14 | TIMEOUT=240 | ||
| 15 | |||
| 16 | # Extract and test toolchain tarball | ||
| 17 | Test_Toolchain sudoku-savant ${TIMEOUT} | ||
| 18 | |||
| 19 | if [ $? -eq 0 ]; then | ||
| 20 | Test_Info "sudoku-savant Test PASS" | ||
| 21 | Test_Print_Result "sudoku-savant" 0 | ||
| 22 | exit 0 | ||
| 23 | elif [ $? -eq 1 ]; then | ||
| 24 | Test_Info "sudoku-savant Test FAIL" | ||
| 25 | Test_Print_Result "sudoku-savant" 1 | ||
| 26 | exit 1 | ||
| 27 | else | ||
| 28 | Test_Info "Skip sudoku-savant Test due to some configuration problem" | ||
| 29 | Test_Print_Result "sudoku-savant" 2 | ||
| 30 | exit 2 | ||
| 31 | fi | ||
diff --git a/scripts/qemuimage-tests/tools/bash.sh b/scripts/qemuimage-tests/tools/bash.sh deleted file mode 100644 index f6958f0e7e..0000000000 --- a/scripts/qemuimage-tests/tools/bash.sh +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # bash test script running in qemu | ||
| 3 | # | ||
| 4 | # Author: veera <veerabrahmamvr@huawei.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | which bash | ||
| 11 | if [ $? -eq 0 ]; then | ||
| 12 | echo "QEMU: bash is exist in the target by default" | ||
| 13 | exit 0 | ||
| 14 | else | ||
| 15 | echo "QEMU: No bash command in the qemu target" | ||
| 16 | exit 1 | ||
| 17 | fi | ||
diff --git a/scripts/qemuimage-tests/tools/compiler_test.sh b/scripts/qemuimage-tests/tools/compiler_test.sh deleted file mode 100644 index 9c30d6d78b..0000000000 --- a/scripts/qemuimage-tests/tools/compiler_test.sh +++ /dev/null | |||
| @@ -1,137 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # compiler test script running in target | ||
| 3 | # | ||
| 4 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | # Prepare test folder for compiler test | ||
| 11 | COMPILE_FOLDER="/opt/test/compile_test" | ||
| 12 | TEST_FILE="$COMPILE_FOLDER/compile_test.c" | ||
| 13 | EXECUTE_FILE="$COMPILE_FOLDER/compile_test" | ||
| 14 | TEST_MAKEFILE="$COMPILE_FOLDER/makefile" | ||
| 15 | TEST_LIST="gcc g++ make" | ||
| 16 | |||
| 17 | if [ ! -d $COMPILE_FOLDER ]; then | ||
| 18 | mkdir -p $COMPILE_FOLDER | ||
| 19 | fi | ||
| 20 | |||
| 21 | Target_Info() | ||
| 22 | { | ||
| 23 | echo -e "\tTARGET: $*" | ||
| 24 | } | ||
| 25 | |||
| 26 | Target_Err() | ||
| 27 | { | ||
| 28 | echo -e "\tTARGET: ##### Error Log #####" | ||
| 29 | $@ | ||
| 30 | echo -e "\tTARGET: ##### End #####" | ||
| 31 | } | ||
| 32 | |||
| 33 | # Function to generate a c test file for compiler testing | ||
| 34 | Gen_File() | ||
| 35 | { | ||
| 36 | temp=`mktemp` | ||
| 37 | |||
| 38 | # Generate c/c++ test file for compiler testing | ||
| 39 | echo "#include <stdio.h>" >> $temp | ||
| 40 | echo "#include <math.h>" >> $temp | ||
| 41 | echo "" >> $temp | ||
| 42 | echo "double" >> $temp | ||
| 43 | echo "convert(long long l)" >> $temp | ||
| 44 | echo "{" >> $temp | ||
| 45 | echo " return (double)l; // or double(l)" >> $temp | ||
| 46 | echo "}" >> $temp | ||
| 47 | echo "" >> $temp | ||
| 48 | echo "int" >> $temp | ||
| 49 | echo "main(int argc, char * argv[])" >> $temp | ||
| 50 | echo "{" >> $temp | ||
| 51 | echo " long long l = 10;" >> $temp | ||
| 52 | echo " double f;" >> $temp | ||
| 53 | echo "" >> $temp | ||
| 54 | echo " f = convert(l);" >> $temp | ||
| 55 | echo " printf(\"convert: %lld => %f\n\", l, f);" >> $temp | ||
| 56 | echo "" >> $temp | ||
| 57 | echo " f = 1234.67;" >> $temp | ||
| 58 | echo " printf(\"floorf(%f) = %f\n\", f, floorf(f));" >> $temp | ||
| 59 | echo " return 0;" >> $temp | ||
| 60 | echo "}" >> $temp | ||
| 61 | echo $temp | ||
| 62 | } | ||
| 63 | |||
| 64 | # Function to generate a makefile for compiler testing | ||
| 65 | Gen_Makefile() | ||
| 66 | { | ||
| 67 | temp=`mktemp` | ||
| 68 | basename=`basename $EXECUTE_FILE` | ||
| 69 | |||
| 70 | echo -e "$basename: $basename.o" >> $temp | ||
| 71 | echo -e "\tgcc -o $basename $basename.o -lm" >> $temp | ||
| 72 | echo -e "$basename.o: $basename.c" >> $temp | ||
| 73 | echo -e "\tgcc -c $basename.c" >> $temp | ||
| 74 | |||
| 75 | echo $temp | ||
| 76 | } | ||
| 77 | |||
| 78 | # Generate a c test file for compiler testing | ||
| 79 | test_file=`Gen_File` | ||
| 80 | |||
| 81 | MOVE=`which mv` | ||
| 82 | $MOVE $test_file $TEST_FILE | ||
| 83 | |||
| 84 | # Begin compiler test in target | ||
| 85 | for cmd in $TEST_LIST | ||
| 86 | do | ||
| 87 | which $cmd | ||
| 88 | if [ $? -ne 0 ]; then | ||
| 89 | Target_Info "No $cmd command found" | ||
| 90 | exit 1 | ||
| 91 | fi | ||
| 92 | |||
| 93 | if [ "$cmd" == "make" ]; then | ||
| 94 | rm -rf $EXECUTE_FILE | ||
| 95 | |||
| 96 | # For makefile test, we need to generate a makefile and run with a c file | ||
| 97 | makefile=`Gen_Makefile` | ||
| 98 | $MOVE $makefile $TEST_MAKEFILE | ||
| 99 | |||
| 100 | cd `dirname $TEST_MAKEFILE` | ||
| 101 | make | ||
| 102 | |||
| 103 | if [ $? -ne 0 ]; then | ||
| 104 | Target_Info "$cmd running with error, Pls. check error in following" | ||
| 105 | Target_Err make | ||
| 106 | exit 1 | ||
| 107 | fi | ||
| 108 | else | ||
| 109 | rm -rf $EXECUTE_FILE | ||
| 110 | |||
| 111 | # For gcc/g++, we compile a c test file and check the output | ||
| 112 | $cmd $TEST_FILE -o $EXECUTE_FILE -lm | ||
| 113 | |||
| 114 | if [ $? -ne 0 ]; then | ||
| 115 | Target_Info "$cmd running with error, Pls. check error in following" | ||
| 116 | Target_Err $cmd $TEST_FILE -o $EXECUTE_FILE -lm | ||
| 117 | exit 1 | ||
| 118 | fi | ||
| 119 | fi | ||
| 120 | |||
| 121 | # Check if the binary file generated by $cmd can work without error | ||
| 122 | if [ -f $EXECUTE_FILE ]; then | ||
| 123 | $EXECUTE_FILE | ||
| 124 | if [ $? -ne 0 ]; then | ||
| 125 | Target_Info "$EXECUTE_FILE running with error, Pls. check error in following" | ||
| 126 | Target_Err $EXECUTE_FILE | ||
| 127 | exit 1 | ||
| 128 | else | ||
| 129 | Target_Info "$cmd can work without problem in target" | ||
| 130 | fi | ||
| 131 | else | ||
| 132 | Target_Info "No executalbe file $EXECUTE_FILE found, Pls. check the error log" | ||
| 133 | exit 1 | ||
| 134 | fi | ||
| 135 | done | ||
| 136 | |||
| 137 | exit 0 | ||
diff --git a/scripts/qemuimage-tests/tools/connman_test.sh b/scripts/qemuimage-tests/tools/connman_test.sh deleted file mode 100644 index 4c1e2f558e..0000000000 --- a/scripts/qemuimage-tests/tools/connman_test.sh +++ /dev/null | |||
| @@ -1,75 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # connman test script running in target | ||
| 3 | # | ||
| 4 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | Target_Info() | ||
| 11 | { | ||
| 12 | echo -e "\tTARGET: $*" | ||
| 13 | } | ||
| 14 | |||
| 15 | Target_Err() | ||
| 16 | { | ||
| 17 | echo -e "\tTARGET: connman has issue when running, Pls. check the error log" | ||
| 18 | echo -e "\tTARGET: ##### Error Log #####" | ||
| 19 | $1 | ||
| 20 | echo -e "\tTARGET: ##### End #####" | ||
| 21 | } | ||
| 22 | |||
| 23 | # Check if ps comes from Procps or busybox first | ||
| 24 | ls -l `which ps` | grep -q "busybox" | ||
| 25 | RET=$? | ||
| 26 | |||
| 27 | if [ $RET -eq 0 ]; then | ||
| 28 | PS="ps" | ||
| 29 | else | ||
| 30 | PS="ps -ef" | ||
| 31 | fi | ||
| 32 | |||
| 33 | # Check if connmand is in target | ||
| 34 | if [ ! -f /usr/sbin/connmand ]; then | ||
| 35 | Target_Info "No connmand command found" | ||
| 36 | exit 1 | ||
| 37 | fi | ||
| 38 | |||
| 39 | # Check if connmand is running in background | ||
| 40 | if [ $RET -eq 0 ]; then | ||
| 41 | count=`ps | awk '{print $5}' | grep -c connmand` | ||
| 42 | else | ||
| 43 | count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` | ||
| 44 | fi | ||
| 45 | |||
| 46 | if [ $count -ne 1 ]; then | ||
| 47 | Target_Info "connmand has issue when running in background, Pls, check the output of ps" | ||
| 48 | ${PS} | ||
| 49 | exit 1 | ||
| 50 | fi | ||
| 51 | |||
| 52 | # Check if there is always only one connmand running in background | ||
| 53 | if [ connmand > /dev/null 2>&1 ]; then | ||
| 54 | Target_Info "connmand command run without problem" | ||
| 55 | |||
| 56 | if [ $RET -eq 0 ]; then | ||
| 57 | count=`ps | awk '{print $5}' | grep -c connmand` | ||
| 58 | else | ||
| 59 | count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` | ||
| 60 | fi | ||
| 61 | |||
| 62 | if [ $count -ne 1 ]; then | ||
| 63 | Target_Info "There are more than one connmand running in background, Pls, check the output of ps" | ||
| 64 | ${PS} | grep connmand | ||
| 65 | exit 1 | ||
| 66 | else | ||
| 67 | Target_Info "There is always one connmand running in background, test pass" | ||
| 68 | exit 0 | ||
| 69 | fi | ||
| 70 | else | ||
| 71 | Target_Err connmand | ||
| 72 | exit 1 | ||
| 73 | fi | ||
| 74 | |||
| 75 | exit 0 | ||
diff --git a/scripts/qemuimage-tests/tools/df.sh b/scripts/qemuimage-tests/tools/df.sh deleted file mode 100644 index 280c08e031..0000000000 --- a/scripts/qemuimage-tests/tools/df.sh +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # df test script to check enough disk space for qemu target | ||
| 3 | # | ||
| 4 | # Author: veera <veerabrahmamvr@huawei.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | #taking the size of the each partition | ||
| 9 | array_list=(`df -P | tr -s " " | cut -d " " -f4`) | ||
| 10 | #Total size of the array | ||
| 11 | array_size=`echo ${#array_list[@]}` | ||
| 12 | loop_val=1 | ||
| 13 | #while loop to check the size of partitions are less than 5MB | ||
| 14 | while [ $loop_val -lt $array_size ] | ||
| 15 | do | ||
| 16 | #taking each value from the array to check the size | ||
| 17 | value=`echo ${array_list[$loop_val]}` | ||
| 18 | if [[ $value -gt 5120 ]];then | ||
| 19 | loop_val=`expr $loop_val + 1` | ||
| 20 | else | ||
| 21 | echo "QEMU: df : disk space is not enough" | ||
| 22 | exit 1 | ||
| 23 | fi | ||
| 24 | done | ||
| 25 | exit 0 | ||
diff --git a/scripts/qemuimage-tests/tools/dmesg.sh b/scripts/qemuimage-tests/tools/dmesg.sh deleted file mode 100644 index f0c93181bd..0000000000 --- a/scripts/qemuimage-tests/tools/dmesg.sh +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Dmesg test script running in QEMU | ||
| 3 | # | ||
| 4 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | which dmesg | ||
| 11 | if [ $? -ne 0 ]; then | ||
| 12 | echo "QEMU: No dmesg command found" | ||
| 13 | exit 1 | ||
| 14 | fi | ||
| 15 | |||
| 16 | # For now, ignore mmci-pl18x errors on qemuarm which appeared | ||
| 17 | # from the 3.8 kernel and are harmless | ||
| 18 | dmesg | grep -v mmci-pl18x | grep -iq "error" | ||
| 19 | if [ $? -eq 0 ]; then | ||
| 20 | echo "QEMU: There is some error log in dmesg:" | ||
| 21 | echo "QEMU: ##### Error Log ######" | ||
| 22 | dmesg | grep -i "error" | ||
| 23 | echo "QEMU: ##### End ######" | ||
| 24 | exit 1 | ||
| 25 | else | ||
| 26 | echo "QEMU: No error log in dmesg" | ||
| 27 | exit 0 | ||
| 28 | fi | ||
diff --git a/scripts/qemuimage-tests/tools/rpm_test.sh b/scripts/qemuimage-tests/tools/rpm_test.sh deleted file mode 100644 index 6e6f9112ca..0000000000 --- a/scripts/qemuimage-tests/tools/rpm_test.sh +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # rpm test script running in target | ||
| 3 | # | ||
| 4 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | Target_Info() | ||
| 11 | { | ||
| 12 | echo -e "\tTARGET: $*" | ||
| 13 | } | ||
| 14 | |||
| 15 | Target_Err() | ||
| 16 | { | ||
| 17 | echo -e "\tTARGET: rpm command has issue when running, Pls. check the error log" | ||
| 18 | echo -e "\tTARGET: ##### Error Log #####" | ||
| 19 | $1 | ||
| 20 | echo -e "\tTARGET: ##### End #####" | ||
| 21 | } | ||
| 22 | |||
| 23 | which rpm | ||
| 24 | if [ $? -ne 0 ]; then | ||
| 25 | Target_Info "No rpm command found" | ||
| 26 | exit 1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | if [ rpm > /dev/null 2>&1 ]; then | ||
| 30 | Target_Info "rpm command run without problem" | ||
| 31 | else | ||
| 32 | Target_Err rpm | ||
| 33 | exit 1 | ||
| 34 | fi | ||
| 35 | |||
| 36 | # run rpm with specific command parsed to rpm_test.sh | ||
| 37 | rpm $* > /dev/null 2>&1 | ||
| 38 | |||
| 39 | if [ $? -eq 0 ]; then | ||
| 40 | Target_Info "rpm $* work without problem" | ||
| 41 | exit 0 | ||
| 42 | else | ||
| 43 | Target_Err rpm $* | ||
| 44 | exit 1 | ||
| 45 | fi | ||
diff --git a/scripts/qemuimage-tests/tools/smart_test.sh b/scripts/qemuimage-tests/tools/smart_test.sh deleted file mode 100644 index f278a25e2b..0000000000 --- a/scripts/qemuimage-tests/tools/smart_test.sh +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # smart test script running in target | ||
| 3 | # | ||
| 4 | # Author: Jiajun Xu <jiajun.xu@intel.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | Target_Info() | ||
| 11 | { | ||
| 12 | echo -e "\tTARGET: $*" | ||
| 13 | } | ||
| 14 | |||
| 15 | Target_Err() | ||
| 16 | { | ||
| 17 | echo -e "\tTARGET: smart command has issue when running, Pls. check the error log" | ||
| 18 | echo -e "\tTARGET: ##### Error Log #####" | ||
| 19 | $1 | ||
| 20 | echo -e "\tTARGET: ##### End #####" | ||
| 21 | } | ||
| 22 | |||
| 23 | which smart | ||
| 24 | if [ $? -ne 0 ]; then | ||
| 25 | Target_Info "No smart command found" | ||
| 26 | exit 1 | ||
| 27 | fi | ||
| 28 | |||
| 29 | if [ smart > /dev/null 2>&1 ]; then | ||
| 30 | Target_Info "smart command run without problem" | ||
| 31 | else | ||
| 32 | Target_Err smart | ||
| 33 | exit 1 | ||
| 34 | fi | ||
| 35 | |||
| 36 | # run smart with specific command parsed to smart_test.sh | ||
| 37 | smart $* > /dev/null 2>&1 | ||
| 38 | |||
| 39 | if [ $? -eq 0 ]; then | ||
| 40 | Target_Info "smart $* work without problem" | ||
| 41 | exit 0 | ||
| 42 | else | ||
| 43 | Target_Err "smart $*" | ||
| 44 | exit 1 | ||
| 45 | fi | ||
diff --git a/scripts/qemuimage-tests/tools/syslog.sh b/scripts/qemuimage-tests/tools/syslog.sh deleted file mode 100644 index 9154da3b85..0000000000 --- a/scripts/qemuimage-tests/tools/syslog.sh +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # syslog test script running in qemu | ||
| 3 | # | ||
| 4 | # Author: veera <veerabrahmamvr@huawei.com> | ||
| 5 | # | ||
| 6 | # This file is licensed under the GNU General Public License, | ||
| 7 | # Version 2. | ||
| 8 | # | ||
| 9 | |||
| 10 | ps aux | grep -w syslogd | grep -v grep | ||
| 11 | if [ $? -eq 0 ]; then | ||
| 12 | echo "QEMU: syslogd is running by default" | ||
| 13 | exit 0 | ||
| 14 | else | ||
| 15 | echo "QEMU: syslogd is not running" | ||
| 16 | exit 1 | ||
| 17 | fi | ||
