From: Aníbal Limón <limon.ani...@gmail.com> README.md: Toaster tests requires bash so add it. TODO is add a sanity module for test this kind of issues like shell compatibility.
Signed-off-by: Aníbal Limón <limon.ani...@gmail.com> --- README.md | 4 ++++ tests/toaster/helpers.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/toaster/helpers.py diff --git a/README.md b/README.md index b5e6c8f..4efe1a8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ Scripts used by Yocto QA Team for automatize QA process. = Host requirements = +All the test components REQUIRE bash as your default shell, you +need to review if /bin/sh points to bash because some problems are +detected when use dash. + == Toaster == - virtualenv for python diff --git a/tests/toaster/helpers.py b/tests/toaster/helpers.py new file mode 100644 index 0000000..49f34da --- /dev/null +++ b/tests/toaster/helpers.py @@ -0,0 +1,43 @@ +import subprocess +import os +import shutil +import signal + +TOASTER_TEST_BRANCH = 'toaster_tests' +VENV_NAME = 'venv' +SHELL_CMD = os.environ['SHELL'] if 'SHELL' in os.environ else "/bin/bash" + +def _execute_command(directory, cmd): + subprocess.check_call([SHELL_CMD, "-i", "-c", "cd %s; %s" % \ + (directory, cmd)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + +def _execute_command_venv(directory, venv, cmd): + _execute_command(directory, "source %s/%s/bin/activate; %s" % \ + (directory, venv, cmd)) + +def toaster_clone(directory, repo, ref='master', rm=False): + if os.path.exists(directory): + if rm: + shutil.rmtree(directory) + else: + raise IOError + + subprocess.check_output([SHELL_CMD, "-i", "-c", "git clone %s %s" % \ + (repo, directory)], stderr=subprocess.STDOUT) + _execute_command(directory, "git checkout %s -b %s" % \ + (ref, TOASTER_TEST_BRANCH)) + +def toaster_setup(directory): + _execute_command(directory, "virtualenv %s" % VENV_NAME) + _execute_command_venv(directory, VENV_NAME, "pip install -r" \ + " bitbake/toaster-requirements.txt") + +def toaster_start(directory): + _execute_command_venv(directory, VENV_NAME, + "source %s/oe-init-build-env; source %s/bitbake/bin/toaster start" % \ + (directory, directory)) + +def toaster_stop(directory): + _execute_command_venv(directory, VENV_NAME, + "source %s/oe-init-build-env; source %s/bitbake/bin/toaster stop" % \ + (directory, directory)) -- 2.1.4 -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto