\r
DEVID = ""\r
\r
-TIZENV = "tizen_4.0"\r
+TIZENV = "tizen_5.0"\r
\r
DLOG_CLEAR = "dlogutil -c"\r
DLOG_UTIL = "sdb -s %s shell dlogutil -v time"\r
DEVICE_SUITE_TARGET_30 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')\r
DEVICE_EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')\r
\r
-if TIZENV.find('tizen_4.0') > -1:\r
+if TIZENV.find('tizen_5.0') > -1:\r
DEVICE_SUITE_TARGET = DEVICE_SUITE_TARGET_30\r
else:\r
DEVICE_SUITE_TARGET = DEVICE_SUITE_TARGET_24\r
\r
\r
def uninstall_testconfig():\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
inst_path = RESRC_DIR + os.sep + 'tct-testconfig' + os.sep + 'inst.py'\r
SdbManager.hostCommand("python %s -s %s -u" % (inst_path, DEVID))\r
else:\r
\r
def uninstall_behavior():\r
print "info: Uninstall behavior tool."\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
pass\r
else:\r
uninst_cmd = JOIN(DEVICE_SUITE_TARGET, 'tct/opt/tct-behavior-tests/inst.sh') + ' -u'\r
\r
def install_testconfig():\r
print "info: Install testconfig."\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
instPath = RESRC_DIR + os.sep + 'tct-testconfig' + os.sep + 'inst.py'\r
SdbManager.hostCommand("python %s -s %s" % (instPath, DEVID))\r
else:\r
print "#WARNING#: Invalid device profile value %s" % profile_name\r
return False\r
\r
- if TIZENV.find('tizen_4.0') > -1:\r
- RPMPKG = "tct-behavior-tests-3.0.zip"\r
+ if TIZENV.find('tizen_5.0') > -1:\r
+ RPMPKG = "tct-behavior-tests-5.0.zip"\r
opt_rpm_path = PKGS_DIR + "s" + os.sep + profile_name + os.sep + RPMPKG\r
local_rpm_path = PKGS_DIR + os.sep + profile_name + os.sep + RPMPKG\r
\r
widgetCap = LS(RESRC_DIR, 'getCap', 'wgt')\r
SdbManager.sdbPush(DEVID, JOIN(RESRC_DIR, widgetCap), JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap)\r
\r
- if TIZENV.find('4.0') > -1:\r
+ if TIZENV.find('5.0') > -1:\r
SdbManager.sdbShell(DEVID, "su - " + DEVICE_EXECUTION_MODE_30 + \\r
" -c 'pkgcmd -i -t wgt -q -p " + JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap + '\'')\r
SdbManager.sdbShell(DEVID, 'pkgcmd -i -t wgt -q -p ' + JOIN(DEVICE_SUITE_TARGET, 'tct/') + widgetCap)\r
getcap_pkg = LS(RESRC_DIR, 'getCap', 'tpk')\r
SdbManager.sdbPush(DEVID, JOIN(RESRC_DIR, getcap_pkg), JOIN(DEVICE_SUITE_TARGET, 'tct/') + getcap_pkg)\r
\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
SdbManager.sdbShell(DEVID, "su - " + DEVICE_EXECUTION_MODE_30 + \\r
" -c 'pkgcmd -ipt tpk -p " + JOIN(DEVICE_SUITE_TARGET, 'tct/') + getcap_pkg + '\'')\r
else:\r
wgt_id = getCap_appid()\r
if wgt_id:\r
uninst_cmd = ""\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
uninst_cmd = "su - " + DEVICE_EXECUTION_MODE_30 + \\r
" -c 'pkgcmd -qun " + wgt_id.split('.')[0] + '\''\r
elif TIZENV.find('tizen_2.4') > -1:\r
\r
def getCap_appid():\r
widgetid_cmd = ""\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
widgetid_cmd = "su - " + DEVICE_EXECUTION_MODE_30 + \\r
" -c \"app_launcher -l | grep getCapabilities\""\r
else:\r
wgt_id = getCap_appid()\r
if wgt_id:\r
launchResult = None\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
launchResult = SdbManager.sdbShell(DEVID, 'su - ' + \\r
DEVICE_EXECUTION_MODE_30 + ' -c \"app_launcher -s ' + wgt_id + '\"')\r
else:\r
\r
def launch_ngetCap():\r
launch_result = None\r
- if TIZENV.find('tizen_4.0') > -1:\r
+ if TIZENV.find('tizen_5.0') > -1:\r
launch_result = SdbManager.sdbShell(DEVID, 'su - ' + \\r
DEVICE_EXECUTION_MODE_30 + ' -c \"launch_app org.example.getcap\"')\r
else:\r
kill_process("tinyweb")\r
kill_process("testkit-stub")\r
remove_stub()\r
- if TIZENV.find('4.0') > -1:\r
+ if TIZENV.find('5.0') > -1:\r
uninstall_storage()\r
print "Clean the tct packages in device successfully."\r
\r
check_ngetCap()\r
else:\r
check_getCap()\r
- if TIZENV.find('4.0') > -1:\r
+ if TIZENV.find('5.0') > -1:\r
check_storage()\r
\r
print "Check finished."\r
\r
elif options.bhtest:\r
check_resource_dir()\r
- if TIZENV.find('4.0') > -1:\r
+ if TIZENV.find('5.0') > -1:\r
uninstall_storage()\r
install_storage()\r
launch_storage()\r
uninstall_testconfig()\r
uninstall_getCap()\r
uninstall_ngetCap()\r
- if TIZENV.find('4.0') > -1:\r
+ if TIZENV.find('5.0') > -1:\r
uninstall_storage()\r
\r
print "Clean the tct packages in device successfully."\r
install_getCap()\r
launch_getCap()\r
\r
- if TIZENV.find('4.0') > -1:\r
+ if TIZENV.find('5.0') > -1:\r
install_storage()\r
launch_storage()\r
\r
# return : TctShellSuite []
def _parsTestPlan(file_path, plan_name, deviceId, executeType, tizenVersion, \
resultFolder, stubPort, skip_package, skip_count, skip_tc, devmgr, \
- scen_name=None):
+ scen_name=None, make_ne_package=None):
suites = []
profile = ""
if not _verifyPlan(file_path, tizenVersion):
if skip_package and str(skip_package).find(packName) > -1:
LOGGER.info("[skip package : %s]" % packName)
else:
+ is_make_ne = False
+ if make_ne_package and str(make_ne_package).find(packName) > -1:
+ is_make_ne = True
+
suite = TctShellSuite(packName, None, \
xml_suite.find("auto_tcn").text, \
xml_suite.find("manual_tcn").text, \
xml_suite.find("pkg_name").text, \
xml_suite.get("launcher"), xml_suite.get("category"), \
- tizenVersion, skip_count, skip_tc, devmgr)
+ tizenVersion, skip_count, skip_tc, devmgr, \
+ is_make_ne=is_make_ne)
suites.append(suite)
plan = TctShellPlan(plan_name, devmgr, deviceId, profile, executeType, \
def _parsTestProfile(path_suites, deviceId, executeType, tizenV, profile, \
resultFolder, stubPort, skip_package, skip_count, skip_tc, devmgr, \
- distribute_count):
+ distribute_count, make_ne_package=None):
suites = []
LOGGER.debug("Preparing Test Suite ")
suite_profile = os.path.basename(os.path.dirname(path_suites[0]))
elif auto_num == 0 and manual_num == 0:
pass
else:
+ is_make_ne = False
+ if make_ne_package and str(make_ne_package).find(suite_name) > -1:
+ is_make_ne = True
+
suite = TctShellSuite(suite_name, None, auto_num, manual_num, \
suite_pkg_name, suite_launcher, suite_category, \
- suite_tizenVer, skip_count, skip_tc, devmgr)
+ suite_tizenVer, skip_count, skip_tc, devmgr, \
+ is_make_ne=is_make_ne)
if not distribute_count:
suites.append(suite)
def _parsTestSuite(path_suites, deviceId, executeType, tizenVersion, tc_name, \
- resultFolder, stubPort, devmgr, skip_count=None, skip_tc=None):
+ resultFolder, stubPort, devmgr, skip_count=None, skip_tc=None, \
+ make_ne_package=None):
#type(suites) -> list
suites = []
LOGGER.debug("Preparing Test Suite ")
suite_tizenVer = tizenVersion
suite_pkg_name = os.path.join(suite_profile, \
os.path.basename(suite_path))
+
+ is_make_ne = False
+ if make_ne_package and str(make_ne_package).find(suite_name) > -1:
+ is_make_ne = True
+
suite = TctShellSuite(suite_name, tc_name, auto_num, manual_num, \
suite_pkg_name, suite_launcher, suite_category, \
- suite_tizenVer, skip_count, skip_tc, devmgr)
+ suite_tizenVer, skip_count, skip_tc, devmgr, \
+ is_make_ne=is_make_ne)
+
suites.append(suite)
Constants.clean_unzip_file()
def _parsAutoPlan(planFile, plan_name, executeType, tizenVer, \
resultFolderPath, stubPort, skip_package, skip_count, skip_tc, \
- devmgr):
+ devmgr, make_ne_package=None):
if not _verifyPlan(planFile, tizenVer):
LOGGER.warning("Please check the plan xml file: %s" % planFile)
return None
if skip_package and str(skip_package).find(suite_name) > -1:
LOGGER.error("[skip package : %s]" % suite_name)
else:
- suite = TctShellSuite(xml_suite.get("name"), None, \
+ is_make_ne = False
+ if make_ne_package and str(make_ne_package).find(suite_name) > -1:
+ is_make_ne = True
+
+ suite = TctShellSuite(suite_name, None, \
xml_suite.find("auto_tcn").text, xml_suite.find("manual_tcn").text,\
xml_suite.find("pkg_name").text, xml_suite.get("launcher"), \
xml_suite.get("category"), tizenVer, skip_count, skip_tc, \
- devmgr)
+ devmgr, is_make_ne=is_make_ne)
+
suite.setExpectedTime(etime)
if suite.suite_pkg_name is None:
LOGGER.warning("suite: [%s] has missing information" \
def _parsResultForRerun(wrapper, skip_package, skip_count, skip_tc, devmgr, \
- distribute_count):
+ distribute_count, make_ne_package=None):
result = wrapper.get_result_for_rerun()
rerun_plan_creator = ResultSummary()
rerun_data = rerun_plan_creator.prepareRerun(result)
if skip_package and str(skip_package).find(suite_name) > -1:
LOGGER.error("[skip package : %s]" % suite_name)
else:
+ is_make_ne = False
+ if make_ne_package and str(make_ne_package).find(suite_name) > -1:
+ is_make_ne = True
+
suite = TctShellSuite(suite_name, None, auto_num, manual_num, \
suite_pkg_name, suite_launcher, suite_category, \
- tizenVer, skip_count, skip_tc, devmgr)
+ tizenVer, skip_count, skip_tc, devmgr, \
+ is_make_ne=is_make_ne)
+
if not distribute_count:
suites.append(suite)
elif dist_res:
suites.append(suite)
-
plan = TctShellPlan(plan_name, devmgr, deviceId, profile, executeType, suites,\
tizenVer, resultFolderPath, wrapper.get_stubPort())
plan.setScenResultFolderPath(scen_resultFolderPath)
skip_package = wrapper.get_skip_package()
skip_count = wrapper.get_skip_count()
skip_tc = wrapper.get_skip_tc()
+ make_ne_package = wrapper.get_make_ne()
distribute_count = wrapper.get_distribute_count()
if wrapper.get_running_mode() == Constants.RUNNING_MODE_RERUN:
return _parsResultForRerun(wrapper, skip_package, skip_count, \
- skip_tc, devmgr, distribute_count)
+ skip_tc, devmgr, distribute_count, \
+ make_ne_package=make_ne_package)
intention_type = wrapper.getIntentionType()
deviceId = None
planFile = wrapper.get_planfile()
plans = _parsTestPlan(planFile, name, deviceId, executeType, \
tizenVer, resultFolderPath, stubPort, skip_package, \
- skip_count, skip_tc, devmgr)
+ skip_count, skip_tc, devmgr, make_ne_package=make_ne_package)
elif intention_type == IntentionType.TestCase:
plans = _parsTestCase(suites, deviceId, executeType, tizenVer, \
tcId, resultFolderPath, stubPort, devmgr)
elif intention_type == IntentionType.TestSuite:
plans = _parsTestSuite(suites, deviceId, executeType, tizenVer, \
None, resultFolderPath, stubPort, devmgr, skip_count, \
- skip_tc)
+ skip_tc, make_ne_package=make_ne_package)
elif intention_type == IntentionType.AutoPlan:
name = wrapper.get_plan_name()
autoFile = wrapper.get_autoplanfile()
plans = _parsAutoPlan(autoFile, name, executeType, tizenVer, \
resultFolderPath, stubPort, skip_package, skip_count, \
- skip_tc, devmgr)
+ skip_tc, devmgr, make_ne_package=make_ne_package)
elif intention_type == IntentionType.TestProfile:
profile_suites = wrapper.get_profile_suites()
if not profile_suites:
profile = wrapper.get_profile()
plans = _parsTestProfile(profile_suites, deviceId, executeType, \
tizenVer, profile, resultFolderPath, stubPort, \
- skip_package, skip_count, skip_tc, devmgr, distribute_count)
+ skip_package, skip_count, skip_tc, devmgr, distribute_count, \
+ make_ne_package=make_ne_package)
return plans
def print_result_summaries(self):
resultFolderPaths = []
+ tizenV = None
if self.plans:
scen_resultFolderPath = None
for plan in self.plans:
+ if tizenV is None:
+ tizenV = plan.getTizenVersion()
+
if plan.scen_resultFolderPath is None or \
not os.path.isdir(plan.scen_resultFolderPath):
resultFolderPath = plan.getResultFolderPath()
(plan.getScenName(), resultFolderPath))
distribute = " --distribute" if Constants.isDistMode() else ""
- rerun_command = "tct-shell --rerun-fail %s" + distribute
+ rerun_command = "tct-shell --tizen-version {0} --rerun-fail %s {1}".\
+ format(tizenV, distribute)
for result in resultFolderPaths:
LOGGER.info("[%s] Rerun command: %s" \
% (result[0], rerun_command % result[1]))
LOGGER.warning("[%s] suite does not exist." % (suiteName))
yesorno = None
while not (yesorno in ['y', 'n']):
- yesorno = raw_input(\
+ yesorno = input(\
"Continue without this suite? [y/n]")
if yesorno == 'n':
LOGGER.warning("please check the default suite \
@staticmethod
def hostLiteCommand(command, failct=None):
LOGGER.info(command)
- proc = subprocess.Popen(command, shell=True, \
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc = subprocess.Popen(command, \
+ shell=True, \
+ bufsize=0, \
+ stdin=subprocess.PIPE, \
+ stdout=subprocess.PIPE, \
+ stderr=subprocess.PIPE)
curr_fail = 0
while True:
errs = None
proc = None
try:
- proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, \
- stderr=subprocess.PIPE)
+ proc = subprocess.Popen(command, \
+ shell=True, \
+ bufsize=0, \
+ stdin=subprocess.PIPE, \
+ stdout=subprocess.PIPE, \
+ stderr=subprocess.PIPE)
outs, errs = proc.communicate(timeout=timeout)
except subprocess.TimeoutExpired:
exc = sys.exc_info()
LOGGER.info("\nIf needed, please update %s file. " % (Constants.PRE_CONF_HOST_INI % str(self.deviceIds)))
result = True
while result:
- next_step = raw_input("Continue to run test? [Yes/No]: ")
+ next_step = input("Continue to run test? [Yes/No]: ")
if next_step and (next_step.lower() == "n" or next_step.lower() == "no"):
self._exit(0)
if next_step and (next_step.lower() == "yes" or next_step.lower() == "y"):
def sortSuites(self):
sorted_suites = []
suites = self.getSuites()
+ connection_suite = None
for suite in suites:
+ suite_name = suite.getSuiteName()
+ if suite_name == 'tct-connection-native-utc':
+ connection_suite = suite
+ continue
+
autoCount = int(suite.getAutoNum())
category = suite.category
if category and category.find('Runtime') > -1:
suite.setExpectedTime(etime)
sorted_suites.append(suite)
sorted_suites.sort(key=lambda x: x.expectedTime, reverse=True)
+ if connection_suite:
+ sorted_suites.append(connection_suite)
+
self.suites = sorted_suites
#PARAM tizenV = 'tizen_web_2.4'
def __init__(self, suiteName, tcName, auto_num, manual_num, \
suite_pkg_name, launcher, category, tizenV, skip_count, skip_tc, \
- devmgr):
+ devmgr, is_make_ne=False):
self.suiteName = suiteName
self.tcName = tcName
self.auto_num = auto_num
self.skip_count = skip_count
self.skip_tc = skip_tc
self.devmgr = devmgr
+ self.is_make_ne = is_make_ne
def _liteCommand(self, deviceId, resultFolder, extype, \
tcName, isRerun, stubPort, isSkip=None, reverse_tests=None):
lcmd = ""
- if self.tizenV and (self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or \
- self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1):
+ if self.tizenV and \
+ (self.tizenV.find("web") > -1 or self.tizenV.find("csharp") > -1):
lcmd += Constants.LITE_CMD2 + " "
else:
lcmd += Constants.LITE_CMD1 + " "
if Constants.PRIORITY_VALUE:
lcmd += Constants.PRIORITY
+ lcmd += Constants.LITE_DEVICE_PARAM + " "
+
+ if isSkip:
+ lcmd += 'None' + " "
+ elif self.is_make_ne:
+ lcmd += 'NE_{}'.format(str(deviceId)) + " "
+ else:
+ lcmd += str(deviceId) + " "
+
if isRerun:
lcmd += Constants.LOCAL_PRE
lcmd += os.path.join(resultFolder, \
lcmd += Constants.LOCAL_PRE
lcmd += reverse_tests + " "
else:
- if self.tizenV.find('csharp_3.0') > -1 or self.tizenV.find('csharp_4.0') > -1 or self.tizenV.find('csharp_5.0') > -1 or \
- self.tizenV.find('web_3.0') > -1 or self.tizenV.find('web_4.0') > -1 or self.tizenV.find('web_5.0') > -1 or deviceId is None:
+ if self.tizenV.find('csharp') > -1 or self.tizenV.find('web') > -1 or deviceId is None:
lcmd += Constants.LOCAL_PRE
lcmd += (Constants.LOCAL_SHELL_TEMP_PATH % deviceId)
lcmd += "opt/" + self.suiteName + "/"
lcmd += extype.toLiteParam() + " "
lcmd += Constants.LITE_NON_ACTIVE_PARAM + " "
- lcmd += Constants.LITE_DEVICE_PARAM + " "
-
- if isSkip:
- lcmd += 'None' + " "
- else:
- lcmd += str(deviceId) + " "
-
if tcName is not None:
lcmd += Constants.TESTCASE_ID + " "
lcmd += tcName + " "
lcmd += str(tc)
lcmd += " "
- if self.tizenV and (self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or \
- self.tizenV.find('csharp_3.0') > -1 or self.tizenV.find('csharp_4.0') > -1 or self.tizenV.find('csharp_5.0') > -1):
+ if self.tizenV and (self.tizenV.find("web") > -1 or self.tizenV.find('csharp') > -1):
lcmd += Constants.EXT_TYPE_PARAM + " "
lcmd += Constants.COMM_TYPE_PARAM + " "
lcmd += Constants.ENV_TYPE_PARAM + " "
if line and len(line) > 0 and line.find(self.suiteName) > -1:
proc_id = line.split()[1]
SdbManager.hostCommand('kill -9 %s' % proc_id)
- if self.tizenV and (self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or \
- self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1):
+ if self.tizenV and (self.tizenV.find("web") > -1 or self.tizenV.find("csharp") > -1):
exCmd = self._liteCommand(deviceId, resultFolder, exeType, tcName, \
isRerun, stubport, True)
SdbManager.hostRecLiteCommand(exCmd)
else:
- hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % None
- localSuitePath = Constants.SUITES_REPOSITORY \
- % self.tizenV + self.suite_pkg_name
- self._installSuiteinHost(None, localSuitePath, hostTmpFolder)
- reverse_tests = hostTmpFolder + "opt/" + self.suiteName + "/tests.xml"
+ reverse_tests = self._naitve_installSuiteinHost()
exCmd = self._liteCommand(deviceId, resultFolder, exeType, tcName, \
isRerun, stubport, True, reverse_tests)
SdbManager.hostRecLiteCommand(exCmd)
LOGGER.error("[skip package : %s]" % self.suiteName)
break
+ def _native_installSuiteinHost(self):
+ hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % None
+ localSuitePath = Constants.SUITES_REPOSITORY \
+ % self.tizenV + self.suite_pkg_name
+ self._installSuiteinHost(None, localSuitePath, hostTmpFolder)
+ tmp_suite = hostTmpFolder + "opt/" + self.suiteName + "/tests.xml"
+ return tmp_suite
+
def getSuitePackageName(self):
return self.suite_pkg_name
% self.tizenV + self.suite_pkg_name
instResult = True
- if self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1 or \
- self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or deviceId is None:
+ if self.tizenV.find("csharp") > -1 or \
+ self.tizenV.find("web") > -1 or deviceId is None:
hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % deviceId
instResult = self._installSuiteinHost(\
deviceId, localSuitePath, hostTmpFolder)
return False
def unInstallSuite(self, deviceId, remoteFolder):
- if self.tizenV.find("csharp_3.0") > -1 or self.tizenV.find("csharp_4.0") > -1 or self.tizenV.find("csharp_5.0") > -1 or \
- self.tizenV.find("web_3.0") > -1 or self.tizenV.find("web_4.0") > -1 or self.tizenV.find("web_5.0") > -1 or deviceId is None:
+ if self.tizenV.find("csharp") > -1 or self.tizenV.find("web") > -1 or deviceId is None:
hostTmpFolder = Constants.LOCAL_SHELL_TEMP_PATH % deviceId
self._unInstallSuiteInHost(deviceId, hostTmpFolder)
else:
callback=varnarg, help="Set the end time of test (unit : minute"),
make_option("--skip-package", dest="skip_package", action="callback", \
callback=varnarg, help="Specify the package names for exclude from the test"),
+ make_option("--make-ne", dest="make_ne", action="callback", \
+ callback=varnarg, help="Spectify the package names for make NE of results"),
make_option("--skip-count", dest="skip_count", action="callback", \
callback=varnarg, help="Specify the fail/block/na count. The test is terminated when the same skip-count value and fail/block/na count on the result"),
make_option("--skip-tc", dest="skip_tc", action="callback", \
if self.options.trackingdump and len(self.options.trackingdump) > 0:
if not self.check_tracking_dump():
opt = "--tracking-dump"
+ if self.options.make_ne and len(self.options.make_ne) > 0:
+ if not self.check_make_ne():
+ opt = "--make-ne"
if len(opt) > 0:
os.system("tct-shell -h")
opt = "--make-summary"
elif self.options.trackingdump is not None and len(self.options.trackingdump) < 1:
opt = "--tracking-dump"
+ elif self.options.make_ne is not None and len(self.options.make_ne) < 1:
+ opt = "--make-ne"
if len(opt) > 0:
os.system("tct-shell -h")
def check_makesummary(self):
return os.path.exists(self.options.makesummary[0])
+ def check_make_ne(self):
+ packages = self.options.make_ne[0]
+ packLen = len(packages)
+ return packLen > 0
+
def getIntentionType(self):
if self.options.scenario_file is not None:
return IntentionType.TestScenario
def get_tracking_dump(self):
if (self.options.trackingdump is not None) and (self.options.trackingdump[0] is not None):
return self.options.trackingdump[0]
+
+ def get_make_ne(self):
+ if self.options.make_ne is not None:
+ return self.options.make_ne
def is_testplan_mode(self):
return self.options.testplan_file is not None
"""shell communication for quick return in sync mode"""
proc = subprocess.Popen(cmd,
shell=True,
+ bufsize=0,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE)
time_cnt = 0
exit_code = None
while time_cnt < timeout:
"""
cmd_open = subprocess.Popen(args=cmd,
shell=True,
+ bufsize=0,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE,
+ stdin=subprocess.PIPE)
while True:
exit_code = cmd_open.poll()
import shutil
import ConfigParser
import platform
+import xml.etree.ElementTree as etree
from commodule.log import LOGGER
from commodule.autoexec import shell_command, shell_command_ext
tct_parser.read(TCT_CONFIG_FILE)
DEVICE_SUITE_TARGET_24 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_24')
+DEVICE_SUITE_TARGET_30 = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
LOCAL_HOST_NS = "127.0.0.1"
RPM_INSTALL = "sdb -s %s shell rpm -ivh %s"
def __init__(self, device_id=None):
self.deviceid = device_id
+ self.is_NE = False
+ if self.deviceid and self.deviceid.find('NE_') > -1:
+ self.deviceid = self.deviceid.replace('NE_', '')
+ self.is_NE = True
+
self._wrt = False
+ def is_NE_mode(self):
+ return self.is_NE
+
+ def get_devid(self):
+ return self.deviceid
+
def shell_cmd(self, cmd="", timeout=15):
cmdline = "sdb -s %s shell \"%s\" " % (self.deviceid, cmd)
return shell_command(cmdline, timeout)
boutput=False,
stdout_file=None,
stderr_file=None):
+
cmdline = SDB_COMMAND_RTN % (
self.deviceid, cmd)
return shell_command_ext(cmdline, timeout, boutput, \
build_id_str = line.split('=')[1].strip('\"\r\n')
os_version_str = os_version_str[0:-1]
+
device_info["device_id"] = self.deviceid
device_info["resolution"] = resolution_str
device_info["screen_size"] = screen_size_str
device_info["build_id"] = build_id_str
return device_info
+ def get_buildinfo(self, _tizenV):
+ """ get builf info"""
+ device_file = ""
+ if _tizenV and _tizenV.find("3.0") > -1:
+ device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml'
+ elif _tizenV and _tizenV.find("4.0") > -1:
+ device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml'
+ elif _tizenV and _tizenV.find("5.0") > -1:
+ device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml'
+ else:
+ device_file = DEVICE_SUITE_TARGET_24 + '/Documents/tct/buildinfo.xml'
+
+ builfinfo_file = '/opt/testkit/lite2.4/' + self.deviceid + '/buildinfo.xml'
+ build_info = {}
+ build_info['buildid'] = ''
+ build_info['manufacturer'] = ''
+ build_info['model'] = ''
+
+ if self.download_file(device_file, builfinfo_file) \
+ and os.path.exists(builfinfo_file):
+ root = etree.parse(builfinfo_file).getroot()
+ for element in root.findall("buildinfo"):
+ if element is not None:
+ if element.get("name").lower() == 'buildversion':
+ child = etree.Element.getchildren(element)
+ if child and child[0].text:
+ buildid = child[0].text
+ build_info['buildid'] = buildid
+ if element.get("name").lower() == 'manufacturer':
+ child = etree.Element.getchildren(element)
+ if child and child[0].text:
+ manufacturer = child[0].text
+ build_info['manufacturer'] = manufacturer
+ if element.get("name").lower() == 'model':
+ child = etree.Element.getchildren(element)
+ if child and child[0].text:
+ model = child[0].text
+ build_info['model'] = model
+ os.remove(builfinfo_file)
+ return build_info
+
+
def get_server_url(self, remote_port="8000"):
"""forward request a host tcp port to targe tcp port"""
if remote_port is None:
def download_file(self, remote_path, local_path):
"""download file from device"""
+
local_path_dir = os.path.dirname(local_path)
if not os.path.exists(local_path_dir):
os.makedirs(local_path_dir)
cmd = RPM_LIST % self.deviceid
exit_code, ret = shell_command(cmd)
return ret
-
+
def start_debug(self, dlogfile):
global debug_flag, metux
+ if self.is_NE_mode():
+ return
debug_flag = True
metux = threading.Lock()
cmdline = DLOG_CLEAR % self.deviceid
def stop_debug(self):
global debug_flag, metux
+ if self.is_NE_mode():
+ return
+
metux.acquire()
debug_flag = False
metux.release()
def __get_environment(self):
""" get environment """
device_info = self.connector.get_device_info()
- build_infos = get_buildinfo(self.connector, self.deviceid, self.tizenV)
+ build_info = self.connector.get_buildinfo(self.tizenV)
# add environment node
environment = etree.Element('environment')
-
- if device_info["device_id"] is None:
- index_key = ''.join(random.choice(string.ascii_uppercase) \
- for i in range(12))
- environment.attrib['device_id'] = index_key
- else:
- environment.attrib['device_id'] = device_info["device_id"]
-
+ environment.attrib['device_id'] = device_info['device_id']
environment.attrib['device_model'] = device_info["device_model"]
environment.attrib['device_name'] = device_info["device_name"]
- environment.attrib['build_id'] = build_infos['buildid']
+ environment.attrib['build_id'] = build_info['buildid']
environment.attrib['host'] = platform.platform()
environment.attrib['resolution'] = device_info["resolution"]
environment.attrib['screen_size'] = device_info["screen_size"]
- environment.attrib['device_model'] = build_infos['model']
- environment.attrib['manufacturer'] = build_infos['manufacturer']
+ environment.attrib['device_model'] = build_info['model']
+ environment.attrib['manufacturer'] = build_info['manufacturer']
other = etree.Element('other')
other.text = ""
environment.append(other)
LOGGER.error(
"[ Error: fail to write cases result, error: %s ]\n" % error)
-
-def get_buildinfo(conn, deviceid, _tizenV):
- """ get builf info"""
- device_file = ""
- if _tizenV and _tizenV.find("native_3.0") > -1:
- device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml'
- elif _tizenV and _tizenV.find("native_4.0") > -1:
- device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml'
- else:
- device_file = DEVICE_SUITE_TARGET_24 + '/Documents/tct/buildinfo.xml'
-
- builfinfo_file = '/opt/testkit/lite2.4/' + deviceid + '/buildinfo.xml'
- build_info = {}
- build_info['buildid'] = ''
- build_info['manufacturer'] = ''
- build_info['model'] = ''
-
- if conn.download_file(device_file, builfinfo_file) \
- and EXISTS(builfinfo_file):
- root = etree.parse(builfinfo_file).getroot()
- for element in root.findall("buildinfo"):
- if element is not None:
- if element.get("name").lower() == 'buildversion':
- child = etree.Element.getchildren(element)
- if child and child[0].text:
- buildid = child[0].text
- build_info['buildid'] = buildid
- if element.get("name").lower() == 'manufacturer':
- child = etree.Element.getchildren(element)
- if child and child[0].text:
- manufacturer = child[0].text
- build_info['manufacturer'] = manufacturer
- if element.get("name").lower() == 'model':
- child = etree.Element.getchildren(element)
- if child and child[0].text:
- model = child[0].text
- build_info['model'] = model
- os.remove(builfinfo_file)
- return build_info
self.result_obj = TestSetResut(
self.opts['testsuite_name'], self.opts['testset_name'])
+
cases, exetype, ctype = test_set[
"cases"], test_set["exetype"], test_set["type"]
+
+ devid = self.conn.get_devid()
+ if self.conn.is_NE_mode() or (devid and devid.find('None') > -1):
+ result_list = []
+ for case in cases:
+ test_case = {}
+ test_case['case_id'] = case['case_id']
+ test_case['result'] = 'N/A'
+ if devid.find('None') > -1:
+ test_case['stdout'] = "target not found"
+ else:
+ test_case['stdout'] = 'precondition failed'
+
+ result_list.append(test_case)
+
+ self.result_obj.extend_result(result_list)
+ self.result_obj.set_status(1)
+ return True
+
if self.opts['test_type'] == "webapi":
return self.__run_web_test(sessionid, \
self.opts['testset_name'], exetype, ctype, cases)
def __init__(self, device_id=None):
self.deviceid = device_id
+ self.is_NE = False
+ if self.deviceid and str(self.deviceid).find('NE_') > -1:
+ self.deviceid = self.deviceid.replace('NE_', '')
+ self.is_NE = True
self._wrt = False
self._xwalk = False
self.support_remote = True
#default user is changed "app" to "owner"
#jh0219.han@samsung.com
+ def is_NE_mode(self):
+ return self.is_NE
+
+ def get_devid(self):
+ return self.deviceid
+
def get_user_id(self):
if TIZEN_USER == 'owner':
self.port = '5000'
def shell_cmd(self, cmd="", timeout=15):
cmdline = SDB_COMMAND % (self.deviceid, cmd)
- #print "cmdline : " , cmdline
return shell_command(cmdline, timeout)
def check_process(self, process_name):
def start_debug(self, dlogfile):
global debug_flag, metux
+ if self.is_NE_mode():
+ return
debug_flag = True
metux = threading.Lock()
cmdline = DLOG_CLEAR % self.deviceid
def stop_debug(self):
global debug_flag, metux
+ if self.is_NE_mode():
+ return
metux.acquire()
debug_flag = False
metux.release()
exit_code, ret = shell_command(cmd)
return True
- def get_buildinfo(self, deviceid, _tizenV):
+ def get_buildinfo(self, _tizenV):
""" get builf info"""
device_file = DEVICE_SUITE_TARGET_30 + '/Documents/tct/buildinfo.xml'
- buildinfo_file = '/opt/testkit/lite3.0/' + deviceid + '/buildinfo.xml'
+ buildinfo_file = '/opt/testkit/lite3.0/' + self.deviceid + '/buildinfo.xml'
build_info = {}
build_info['buildid'] = ''
build_info['manufacturer'] = ''
else:
self.conn.start_debug(self.opts['debug_log_base'])
time.sleep(1)
+
self.result_obj = TestSetResut(
self.opts['testsuite_name'], self.opts['testset_name'])
+
+ devid = self.conn.get_devid()
+ if self.conn.is_NE_mode() or (devid and devid.find('None') > -1):
+ result_list = []
+ for case in cases:
+ test_case = {}
+ test_case['case_id'] = case['case_id']
+ test_case['result'] = 'N/A'
+ if devid.find('None') > -1:
+ test_case['stdout'] = "target not found"
+ else:
+ test_case['stdout'] = 'precondition failed'
+
+ result_list.append(test_case)
+
+ self.result_obj.extend_result(result_list)
+ self.result_obj.set_status(1)
+ return True
+
if self.opts['test_type'] == "webapi":
if ctype == 'ref':
exetype = 'manual'
def __get_environment(self):
""" get environment """
device_info = self.connector.get_device_info()
- build_infos = self.connector.get_buildinfo(self.deviceid, self.tizenV)
+ build_infos = self.connector.get_buildinfo(self.tizenV)
# add environment node
environment = etree.Element('environment')
environment.attrib['device_id'] = device_info["device_id"]