From: Donghoon Shin Date: Fri, 7 Oct 2016 02:24:27 +0000 (+0900) Subject: Support more device types X-Git-Tag: 0.3.3~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f0bba06bc4fe80da81241110e3f20759866ac994;p=tools%2Flitmus.git Support more device types Add artik device types and more standalone device types --- diff --git a/CHANGES.txt b/CHANGES.txt index a219c42..5655b55 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,13 +13,13 @@ Version 0.1.1 27 Jun 2016 - Turn off device if keyboard interrupt is raised while flashing or turning on device - Add timeout for all call/check_output to avoid hang issue -Version 0.2.0 9 Sep 2016 +Version 0.2.0 09 Sep 2016 --------------------------- - Remove acmlock routine to improve test performance - Support flash function for standalone device type - Update test helper functions -Version 0.2.1 9 Sep 2016 +Version 0.2.1 09 Sep 2016 --------------------------- - Update import command to use shell-like path expansions - Update standalone device type to avoid sdb error @@ -35,3 +35,7 @@ Version 0.3.0 21 Sep 2016 Version 0.3.1 22 Sep 2016 --------------------------- - Update cmd_rm handler + +Version 0.3.2 07 Oct 2016 +--------------------------- +- Support artik and more standalone device types diff --git a/README.md b/README.md index 88c8eb8..179460a 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Buliding & installing $ debuild -2. Install the deb package using dpkg +2. Install the deb package by using dpkg $ cd .. diff --git a/debian/changelog b/debian/changelog index 842a097..bd4e454 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +litmus (0.3.2-1) unstable; urgency=low + + * Support artik and more standalone device types + + -- Donghoon Shin Thu, 7 Oct 2016 11:14:00 +0900 + litmus (0.3.1-1) unstable; urgency=low * Update cmd_rm handler diff --git a/docs/source/litmus.core.rst b/docs/source/litmus.core.rst index 4c82e86..1f9e8c8 100644 --- a/docs/source/litmus.core.rst +++ b/docs/source/litmus.core.rst @@ -12,6 +12,7 @@ litmus.core.manager module :undoc-members: :show-inheritance: + litmus.core.util module ----------------------- diff --git a/litmus/__init__.py b/litmus/__init__.py index abbddaf..131d9e3 100644 --- a/litmus/__init__.py +++ b/litmus/__init__.py @@ -14,11 +14,11 @@ # limitations under the License. import os -__version__ = '0.3.1' +__version__ = '0.3.2' _homedir_ = os.path.expanduser('~') _confdir_ = os.path.join(_homedir_, '.litmus') _duts_ = os.path.join(_confdir_, 'topology') _projects_ = os.path.join(_confdir_, 'projects') _tmpdir_ = '/tmp' _path_for_locks_ = '/var/lock/litmus/' -_dev_types_ = ('u3', 'xu3', 'standalone', 'empty') +_dev_types_ = ('u3', 'xu3', 'artik5', 'artik10', 'standalone', 'empty') diff --git a/litmus/core/util.py b/litmus/core/util.py index 7851bdb..809c7af 100644 --- a/litmus/core/util.py +++ b/litmus/core/util.py @@ -182,6 +182,6 @@ def load_yaml(filename): :returns dict: parsed yaml data """ - with open(filename, 'r') as stream: + with open(os.path.expanduser(filename), 'r') as stream: data = yaml.load(stream) return data diff --git a/litmus/device/device.py b/litmus/device/device.py index 19c700c..981f7d5 100644 --- a/litmus/device/device.py +++ b/litmus/device/device.py @@ -214,7 +214,7 @@ class device(object): busid = self._find_usb_busid() self._release_global_lock() self._lthor(filenames=filenames, busid=busid) - self._cutter.off() + self.off() except (Exception, KeyboardInterrupt) as e: self._release_global_lock() logging.debug(e) @@ -520,14 +520,8 @@ class device(object): time.sleep(0.3) self._write_uart(b''.join([b'echo 1 > ', usb0_path, b'/enable'])) time.sleep(0.3) - - def check_funcs_sconf(): - """docstring for check_funcs_sconf""" - self._write_uart(b''.join([b'cat ', usb0_path, b'/funcs_sconf'])) - time.sleep(0.3) self._write_uart(b''.join([b'cat ', usb0_path, b'/enable'])) time.sleep(0.3) - self._read_uart(bufsize=1000) def get_serialnumber(): """docstring for get_serialnumber""" @@ -538,7 +532,6 @@ class device(object): retrycnt = 0 while retrycnt < 10: set_serialnumber(deviceid=self.get_id().encode()) - check_funcs_sconf() serialnumber = get_serialnumber() if find_pattern(pattern, serialnumber): return diff --git a/litmus/device/deviceartik10.py b/litmus/device/deviceartik10.py new file mode 100644 index 0000000..d8990c2 --- /dev/null +++ b/litmus/device/deviceartik10.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import time +import logging +from threading import Thread +from litmus.device.device import device +from litmus.core.util import find_pattern +from litmus.core.exceptions import BootError + + +class deviceartik10(device): + """docstring for device""" + + _booting_time = 60 + _pattern_shellprompt = r'root.*> .*' + _pattern_bootprompt = r'ARTIK.*# .*' + + def __init__(self, *args, **kwargs): + self.args = args + self.kwargs = kwargs + self._name = kwargs['devicename'] + + self._open_uart() + self._manager = kwargs['manager'] + + def _release(self): + """docstring for _release""" + self._close_uart() + + def _wait_uart_shell_login_prompt(self): + """docstring for _wait_uart_shell_login_prompt""" + super(deviceartik10, self)._wait_uart_shell_login_prompt() + + def _set_sdb_deviceid(self): + """docstring for _set_sdb_deviceid""" + usb0_path = b'/sys/class/usb_mode/usb0' + pattern = '.*{0}'.format(self.get_id()) + + def set_serialnumber(deviceid): + """docstring for set_serialnumber""" + self._write_uart(b''.join([b'echo 0 > ', usb0_path, b'/enable'])) + time.sleep(0.3) + self._write_uart(b''.join([b'echo ', + b'-n ', + deviceid, + b' > ', usb0_path, + b'/iSerial'])) + time.sleep(0.3) + self._write_uart(b'direct_set_debug.sh --sdb-set') + time.sleep(0.5) + + def get_serialnumber(): + """docstring for get_serialnumber""" + self._write_uart(b''.join([b'cat ', usb0_path, b'/enable'])) + time.sleep(0.3) + self._write_uart(b''.join([b'cat ', usb0_path, b'/iSerial'])) + time.sleep(0.3) + return self._read_uart(1000) + + retrycnt = 0 + while retrycnt < 10: + set_serialnumber(deviceid=self.get_id().encode()) + serialnumber = get_serialnumber() + if find_pattern(pattern, serialnumber): + return + retrycnt += 1 + else: + raise Exception('Can\'t configure sdb deviceid') + + def _reboot(self): + """docstring for _reboot""" + status = self._current_uart_status() + + if status == 'LOGGED_IN': + self._write_uart(b'reboot') + time.sleep(3) + elif status == 'BOOT_PROMPT': + self._write_uart(b'reset') + time.sleep(3) + elif status == 'NOT_LOGGED_IN': + self._wait_uart_shell_login_prompt() + self._login_uart_shell() + self._write_uart(b'reboot') + time.sleep(3) + + def _current_uart_status(self): + """docstring for _current_uart_status""" + self._flush_uart_buffer() + for loop in range(3): + self._write_uart(b'') + readdata = self._read_uart(500) + if find_pattern(self._pattern_bootprompt, readdata): + return 'BOOT_PROMPT' + if find_pattern(self._pattern_shellprompt, readdata): + return 'LOGGED_IN' + else: + return 'NOT_LOGGED_IN' + + def _enter_download_mode(self, cmd, power_cut_delay=1, thread_param=10): + """docstring for _enter_download_mode""" + t = Thread(target=self._thread_for_enter_download_mode, + args=(cmd, thread_param, )) + status = self._current_uart_status() + if status == 'NOT_LOGGED_IN': + self._wait_uart_shell_login_prompt() + self._login_uart_shell() + t.start() + self._reboot() + t.join() + + def on(self, powercut_delay=3): + """ + Turn on the device acquired. + + :param float powercut_delay: power-cut delay for cutter + """ + logging.debug('=================Turn on device {}==================' + .format(self.get_name())) + retry_cnt = 0 + time.sleep(powercut_delay) + while retry_cnt <= self._max_attempt_boot_retry: + try: + self._reboot() + self._wait_uart_shell_login_prompt() + self._login_uart_shell() + self._set_sdb_deviceid() + self._attach_sdb() + self._sdb_root_on() + return + except KeyboardInterrupt: + raise Exception('Keyboard interrupt.') + except Exception as e: + logging.debug(e) + retry_cnt += 1 + else: + raise BootError('Cant\'t turn on dut.') + + def off(self, powercut_delay=2): + """ + Trun off the device acquired. + + :param float powercut_delay: power-cut delay for cutter + """ + logging.debug('off function is not supported for Artik device') diff --git a/litmus/device/deviceartik5.py b/litmus/device/deviceartik5.py new file mode 100644 index 0000000..bc4323e --- /dev/null +++ b/litmus/device/deviceartik5.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.deviceartik10 import deviceartik10 + + +class deviceartik5(deviceartik10): + """docstring for device""" + _pattern_bootprompt = r'ARITK.*# .*' diff --git a/litmus/device/devicestandalone.py b/litmus/device/devicestandalone.py index 08611d8..a720896 100644 --- a/litmus/device/devicestandalone.py +++ b/litmus/device/devicestandalone.py @@ -95,7 +95,7 @@ class devicestandalone(device): :param float powercut_delay: power-cut delay for cutter """ - logging.debug('You can\'t turn off standalone type device') + logging.debug('off function is not supported for standalone device') def flash(self, filenames, flasher='lthor', waiting=5, partition_bin_mappings={'BOOT': 'zImage', diff --git a/litmus/device/devicestandalone_m0.py b/litmus/device/devicestandalone_m0.py new file mode 100644 index 0000000..41cc556 --- /dev/null +++ b/litmus/device/devicestandalone_m0.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_m0(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/device/devicestandalone_tm1.py b/litmus/device/devicestandalone_tm1.py new file mode 100644 index 0000000..0cada07 --- /dev/null +++ b/litmus/device/devicestandalone_tm1.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_tm1(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/device/devicestandalone_tm2.py b/litmus/device/devicestandalone_tm2.py new file mode 100644 index 0000000..79cb68b --- /dev/null +++ b/litmus/device/devicestandalone_tm2.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_tm2(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/device/devicestandalone_tw1.py b/litmus/device/devicestandalone_tw1.py new file mode 100644 index 0000000..fe459e8 --- /dev/null +++ b/litmus/device/devicestandalone_tw1.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_tw1(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/device/devicestandalone_u3.py b/litmus/device/devicestandalone_u3.py new file mode 100644 index 0000000..9517b1e --- /dev/null +++ b/litmus/device/devicestandalone_u3.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_u3(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/device/devicestandalone_xu3.py b/litmus/device/devicestandalone_xu3.py new file mode 100644 index 0000000..08bc420 --- /dev/null +++ b/litmus/device/devicestandalone_xu3.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_xu3(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/device/devicestandalone_z1.py b/litmus/device/devicestandalone_z1.py new file mode 100644 index 0000000..8a85f76 --- /dev/null +++ b/litmus/device/devicestandalone_z1.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# Copyright 2015-2016 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from litmus.device.devicestandalone import devicestandalone + + +class devicestandalone_z1(devicestandalone): + """docstring for device""" + pass + diff --git a/litmus/helper/helper.py b/litmus/helper/helper.py index 2665a12..26a8cf2 100644 --- a/litmus/helper/helper.py +++ b/litmus/helper/helper.py @@ -18,6 +18,7 @@ import sys import time import logging import requests +import litmus import urllib.parse from bs4 import BeautifulSoup from litmus.core.util import find_pattern, find_all_pattern @@ -173,10 +174,11 @@ def install_plugin(dut, script, waiting=5, timeout=180): import os +import tempfile import shutil from subprocess import DEVNULL -def install_plugin_from_git(dut, url, branch, script, tmpdir='repo', +def install_plugin_from_git(dut, url, branch, script, waiting=5, timeout=180, commitid=None): """ Clone a git project which include tizen plugins and install the plugins on device. @@ -186,7 +188,6 @@ def install_plugin_from_git(dut, url, branch, script, tmpdir='repo', :param str url: url for git project :param str branch: branch name of the git project :param str script: script path to install plugins on device - :param str tmpdir: temporary directory to clone the git project :param float waiting: wait time before installing plugins :param float timeout: timeout :param str commitid: commitid which you want to clone @@ -210,6 +211,8 @@ def install_plugin_from_git(dut, url, branch, script, tmpdir='repo', logging.debug('plugin install script : {}'.format(script)) dut.on() + tmpdir = next(tempfile._get_candidate_names()) + call('git clone {0} {1} --branch {2}'.format(url, tmpdir, branch), shell=True) @@ -220,15 +223,13 @@ def install_plugin_from_git(dut, url, branch, script, tmpdir='repo', call('find ./{0} -exec perl -pi -e "s/sdb\s+(-d\s+)*(root|shell|push|pull)/sdb -s {1} \\2/g" {{}} \;'.format(tmpdir, dut.get_id()), stderr=DEVNULL, shell=True) call('find ./{0} -exec perl -pi -e "s/sdb\s+.*reboot.*//g" {{}} \;'.format(tmpdir), stderr=DEVNULL, shell=True) - script = os.path.join(tmpdir, script) - script_path = '/'.join(script.split('/')[:-1]) script_name = script.split('/')[-1] - call('cp -R {0}/* .'.format(script_path), shell=True) time.sleep(waiting) - call('sh {0}'.format(script_name).split(), timeout=timeout) + call('cd {0}/{1} && sh {2}'.format(tmpdir, script_path, script_name), + shell=True, timeout=timeout) shutil.rmtree(tmpdir) dut.off() diff --git a/litmus/templates/artik10/__init__.py b/litmus/templates/artik10/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/litmus/templates/artik10/conf.yaml b/litmus/templates/artik10/conf.yaml new file mode 100644 index 0000000..5b81875 --- /dev/null +++ b/litmus/templates/artik10/conf.yaml @@ -0,0 +1,5 @@ +binary_urls: + - http://download.tizen.org/snapshots/tizen/common/latest/images/arm-wayland/common-wayland-3parts-armv7l-artik/ + - http://download.tizen.org/snapshots/tizen/common/latest/images/arm-wayland/common-boot-armv7l-artik10/ +username: +password: diff --git a/litmus/templates/artik10/misc/autoinput b/litmus/templates/artik10/misc/autoinput new file mode 100755 index 0000000..88d78e3 Binary files /dev/null and b/litmus/templates/artik10/misc/autoinput differ diff --git a/litmus/templates/artik10/misc/getevent b/litmus/templates/artik10/misc/getevent new file mode 100755 index 0000000..66e2c2a Binary files /dev/null and b/litmus/templates/artik10/misc/getevent differ diff --git a/litmus/templates/artik10/tc.yaml b/litmus/templates/artik10/tc.yaml new file mode 100644 index 0000000..abaa181 --- /dev/null +++ b/litmus/templates/artik10/tc.yaml @@ -0,0 +1,32 @@ +testcases: + - name: verify_process_is_running + from: litmus.helper.tests + result_dir: result + plan: + - name: dbus_is_running + param: dbus + pattern: .*/usr/bin/dbus-daemon.* + - name: enlightenment_is_running + param: enlightenment + pattern: .*/usr/bin/enlightenment.* + - name: sensord_is_running + param: sensord + pattern: .*/usr/bin/sensord.* + - name: deviced_is_running + param: deviced + pattern: .*/usr/bin/deviced.* + - name: pulseaudio_is_running + param: pulseaudio + pattern: .*/usr/bin/pulseaudio.* + - name: sdbd_is_running + param: sdbd + pattern: .*/usr/sbin/sdbd.* + - name: alarm-server_is_running + param: alarm-server + pattern: .*/usr/bin/alarm-server.* + - name: sound_server_is_running + param: sound_server + pattern: .*/usr/bin/sound_server.* + - name: media-server_is_running + param: media-server + pattern: .*/usr/bin/media-server.* diff --git a/litmus/templates/artik10/userscript.py b/litmus/templates/artik10/userscript.py new file mode 100755 index 0000000..be6c41a --- /dev/null +++ b/litmus/templates/artik10/userscript.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +import os +from litmus.core.util import load_yaml +from litmus.core.manager import manager +from litmus.helper.helper import tizen_snapshot_downloader as downloader +from litmus.helper.helper import install_plugin_from_git +from litmus.helper.tests import add_test_helper + + +def main(*args, **kwargs): + + # init manager instance + mgr = manager(*args, **kwargs) + + # init working directory + mgr.init_workingdir() + + # get projectinfo + project_info = load_yaml('conf.yaml') + + username = project_info['username'] + password = project_info['password'] + binary_urls = project_info['binary_urls'] + plugin_info = project_info['plugin_info'] + + # get version from parameter + try: + version = kwargs['param'][0] + except (IndexError, TypeError): + version = None + + # download binaries from snapshot download server + filenames = [] + for url in binary_urls: + filenames.extend(downloader(url=url, + username=username, + password=password, + version=version)) + + # get an available device for testing. + dut = mgr.acquire_dut('artik10', max_retry_times=180) + + # flashing binaries to device. + dut.flash(filenames) + + # install plugins + install_plugin_from_git(dut, + plugin_info['url'].format(username=username), + plugin_info['branch'], + plugin_info['script']) + + # turn on dut. + dut.on() + + # run helper functions for testing. + if not os.path.exists('result'): + os.mkdir('result') + + testcases = load_yaml('tc.yaml') + add_test_helper(dut, testcases) + dut.run_tests() + + # turn off dut. + dut.off() + + # release a device + mgr.release_dut(dut) diff --git a/litmus/templates/artik5/__init__.py b/litmus/templates/artik5/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/litmus/templates/artik5/conf.yaml b/litmus/templates/artik5/conf.yaml new file mode 100644 index 0000000..7e90ffe --- /dev/null +++ b/litmus/templates/artik5/conf.yaml @@ -0,0 +1,5 @@ +binary_urls: + - http://download.tizen.org/snapshots/tizen/common/latest/images/arm-wayland/common-wayland-3parts-armv7l-artik/ + - http://download.tizen.org/snapshots/tizen/common/latest/images/arm-wayland/common-boot-armv7l-artik5/ +username: +password: diff --git a/litmus/templates/artik5/misc/autoinput b/litmus/templates/artik5/misc/autoinput new file mode 100755 index 0000000..88d78e3 Binary files /dev/null and b/litmus/templates/artik5/misc/autoinput differ diff --git a/litmus/templates/artik5/misc/getevent b/litmus/templates/artik5/misc/getevent new file mode 100755 index 0000000..66e2c2a Binary files /dev/null and b/litmus/templates/artik5/misc/getevent differ diff --git a/litmus/templates/artik5/tc.yaml b/litmus/templates/artik5/tc.yaml new file mode 100644 index 0000000..abaa181 --- /dev/null +++ b/litmus/templates/artik5/tc.yaml @@ -0,0 +1,32 @@ +testcases: + - name: verify_process_is_running + from: litmus.helper.tests + result_dir: result + plan: + - name: dbus_is_running + param: dbus + pattern: .*/usr/bin/dbus-daemon.* + - name: enlightenment_is_running + param: enlightenment + pattern: .*/usr/bin/enlightenment.* + - name: sensord_is_running + param: sensord + pattern: .*/usr/bin/sensord.* + - name: deviced_is_running + param: deviced + pattern: .*/usr/bin/deviced.* + - name: pulseaudio_is_running + param: pulseaudio + pattern: .*/usr/bin/pulseaudio.* + - name: sdbd_is_running + param: sdbd + pattern: .*/usr/sbin/sdbd.* + - name: alarm-server_is_running + param: alarm-server + pattern: .*/usr/bin/alarm-server.* + - name: sound_server_is_running + param: sound_server + pattern: .*/usr/bin/sound_server.* + - name: media-server_is_running + param: media-server + pattern: .*/usr/bin/media-server.* diff --git a/litmus/templates/artik5/userscript.py b/litmus/templates/artik5/userscript.py new file mode 100755 index 0000000..ccfb88e --- /dev/null +++ b/litmus/templates/artik5/userscript.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +import os +from litmus.core.util import load_yaml +from litmus.core.manager import manager +from litmus.helper.helper import tizen_snapshot_downloader as downloader +from litmus.helper.helper import install_plugin_from_git +from litmus.helper.tests import add_test_helper + + +def main(*args, **kwargs): + + # init manager instance + mgr = manager(*args, **kwargs) + + # init working directory + mgr.init_workingdir() + + # get projectinfo + project_info = load_yaml('conf.yaml') + + username = project_info['username'] + password = project_info['password'] + binary_urls = project_info['binary_urls'] + plugin_info = project_info['plugin_info'] + + # get version from parameter + try: + version = kwargs['param'][0] + except (IndexError, TypeError): + version = None + + # download binaries from snapshot download server + filenames = [] + for url in binary_urls: + filenames.extend(downloader(url=url, + username=username, + password=password, + version=version)) + + # get an available device for testing. + dut = mgr.acquire_dut('artik5', max_retry_times=180) + + # flashing binaries to device. + dut.flash(filenames) + + # install plugins + install_plugin_from_git(dut, + plugin_info['url'].format(username=username), + plugin_info['branch'], + plugin_info['script']) + + # turn on dut. + dut.on() + + # run helper functions for testing. + if not os.path.exists('result'): + os.mkdir('result') + + testcases = load_yaml('tc.yaml') + add_test_helper(dut, testcases) + dut.run_tests() + + # turn off dut. + dut.off() + + # release a device + mgr.release_dut(dut)