aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/base/controller/__init__.py0
-rw-r--r--meta/lib/oeqa/base/controller/base_target.py49
-rw-r--r--meta/lib/oeqa/targetcontrol.py27
3 files changed, 51 insertions, 25 deletions
diff --git a/meta/lib/oeqa/base/controller/__init__.py b/meta/lib/oeqa/base/controller/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/meta/lib/oeqa/base/controller/__init__.py
diff --git a/meta/lib/oeqa/base/controller/base_target.py b/meta/lib/oeqa/base/controller/base_target.py
new file mode 100644
index 00000000000..afa497eafa5
--- /dev/null
+++ b/meta/lib/oeqa/base/controller/base_target.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# Copyright (C) 2013 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# Base target module used by target supported testrunner
+# This provides TC the capability to access target DUT
+
+"""Base Target Module"""
+from abc import ABCMeta, abstractmethod
+
+class BaseTarget(object):
+ """abstract base target class"""
+ __metaclass__ = ABCMeta
+ def __init__(self):
+ self.connection = None
+
+ def deploy(self):
+ """deploy workload"""
+ pass
+
+ @abstractmethod
+ def start(self, params=None):
+ """setup the bridge connection to target"""
+ pass
+
+ @abstractmethod
+ def stop(self):
+ """shutdown the bridge connection to target"""
+ pass
+
+ def restart(self, params=None):
+ """restart the bridge to target"""
+ self.stop()
+ self.start(params)
+
+ def run(self, cmd, timeout=None):
+ """execute command via bridge"""
+ if self.connection:
+ return self.connection.run(cmd, timeout)
+ return True
+
+ def copy_to(self, localpath, remotepath):
+ """copy local file to target"""
+ return self.connection.copy_to(localpath, remotepath)
+
+ def copy_from(self, remotepath, localpath):
+ """copy file from target to local"""
+ return self.connection.copy_from(remotepath, localpath)
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index c76887bae1d..b107e2e3438 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -16,6 +16,7 @@ from oeqa.utils.qemurunner import QemuRunner
from oeqa.utils.qemutinyrunner import QemuTinyRunner
from oeqa.controllers.testtargetloader import TestTargetLoader
from abc import ABCMeta, abstractmethod
+from oeqa.base.controller.base_target import BaseTarget as BT
def get_target_controller(d):
testtarget = d.getVar("TEST_TARGET", True)
@@ -42,9 +43,7 @@ def get_target_controller(d):
return controller(d)
-class BaseTarget(object):
-
- __metaclass__ = ABCMeta
+class BaseTarget(BT):
supported_image_fstypes = []
@@ -66,14 +65,6 @@ class BaseTarget(object):
os.symlink(self.sshlog, sshloglink)
bb.note("SSH log file: %s" % self.sshlog)
- @abstractmethod
- def start(self, params=None):
- pass
-
- @abstractmethod
- def stop(self):
- pass
-
@classmethod
def get_extra_files(self):
return None
@@ -95,20 +86,6 @@ class BaseTarget(object):
else:
bb.fatal("IMAGE_FSTYPES should contain a Target Controller supported image fstype: %s " % ', '.join(map(str, self.supported_image_fstypes)))
- def restart(self, params=None):
- self.stop()
- self.start(params)
-
- def run(self, cmd, timeout=None):
- return self.connection.run(cmd, timeout)
-
- def copy_to(self, localpath, remotepath):
- return self.connection.copy_to(localpath, remotepath)
-
- def copy_from(self, remotepath, localpath):
- return self.connection.copy_from(remotepath, localpath)
-
-
class QemuTarget(BaseTarget):