From 57af8ee4021c302bd351adf03e6d85274ad7efd5 Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Mon, 31 Oct 2016 17:20:48 -0600 Subject: oeqa/sdk: Move test cases inside cases directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For match with the new structure of the OEQA framework. In the new framework Test component base directory in this case sdk module will contain case and context implementations. [YOCTO #10599] Signed-off-by: Aníbal Limón Signed-off-by: Mariano Lopez --- meta/lib/oeqa/sdk/cases/__init__.py | 3 +++ meta/lib/oeqa/sdk/cases/buildcvs.py | 25 +++++++++++++++++++++ meta/lib/oeqa/sdk/cases/buildgalculator.py | 27 ++++++++++++++++++++++ meta/lib/oeqa/sdk/cases/buildiptables.py | 26 +++++++++++++++++++++ meta/lib/oeqa/sdk/cases/gcc.py | 36 ++++++++++++++++++++++++++++++ meta/lib/oeqa/sdk/cases/perl.py | 28 +++++++++++++++++++++++ meta/lib/oeqa/sdk/cases/python.py | 32 ++++++++++++++++++++++++++ 7 files changed, 177 insertions(+) create mode 100644 meta/lib/oeqa/sdk/cases/__init__.py create mode 100644 meta/lib/oeqa/sdk/cases/buildcvs.py create mode 100644 meta/lib/oeqa/sdk/cases/buildgalculator.py create mode 100644 meta/lib/oeqa/sdk/cases/buildiptables.py create mode 100644 meta/lib/oeqa/sdk/cases/gcc.py create mode 100644 meta/lib/oeqa/sdk/cases/perl.py create mode 100644 meta/lib/oeqa/sdk/cases/python.py (limited to 'meta/lib/oeqa/sdk/cases') diff --git a/meta/lib/oeqa/sdk/cases/__init__.py b/meta/lib/oeqa/sdk/cases/__init__.py new file mode 100644 index 0000000000..4cf3fa76b6 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/__init__.py @@ -0,0 +1,3 @@ +# Enable other layers to have tests in the same named directory +from pkgutil import extend_path +__path__ = extend_path(__path__, __name__) diff --git a/meta/lib/oeqa/sdk/cases/buildcvs.py b/meta/lib/oeqa/sdk/cases/buildcvs.py new file mode 100644 index 0000000000..c7146fa4af --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/buildcvs.py @@ -0,0 +1,25 @@ +from oeqa.oetest import oeSDKTest, skipModule +from oeqa.utils.decorators import * +from oeqa.utils.targetbuild import SDKBuildProject + +class BuildCvsTest(oeSDKTest): + + @classmethod + def setUpClass(self): + self.project = SDKBuildProject(oeSDKTest.tc.sdktestdir + "/cvs/", oeSDKTest.tc.sdkenv, oeSDKTest.tc.d, + "http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2") + self.project.download_archive() + + def test_cvs(self): + self.assertEqual(self.project.run_configure(), 0, + msg="Running configure failed") + + self.assertEqual(self.project.run_make(), 0, + msg="Running make failed") + + self.assertEqual(self.project.run_install(), 0, + msg="Running make install failed") + + @classmethod + def tearDownClass(self): + self.project.clean() diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py b/meta/lib/oeqa/sdk/cases/buildgalculator.py new file mode 100644 index 0000000000..dc2fa9ce19 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/buildgalculator.py @@ -0,0 +1,27 @@ +from oeqa.oetest import oeSDKTest, skipModule +from oeqa.utils.decorators import * +from oeqa.utils.targetbuild import SDKBuildProject + +def setUpModule(): + if not (oeSDKTest.hasPackage("gtk+3") or oeSDKTest.hasPackage("libgtk-3.0")): + skipModule("Image doesn't have gtk+3 in manifest") + +class GalculatorTest(oeSDKTest): + def test_galculator(self): + try: + project = SDKBuildProject(oeSDKTest.tc.sdktestdir + "/galculator/", + oeSDKTest.tc.sdkenv, oeSDKTest.tc.d, + "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2") + + project.download_archive() + + # regenerate configure to get support for --with-libtool-sysroot + legacy_preconf=("autoreconf -i -f -I ${OECORE_TARGET_SYSROOT}/usr/share/aclocal -I m4;") + + self.assertEqual(project.run_configure(extra_cmds=legacy_preconf), + 0, msg="Running configure failed") + + self.assertEqual(project.run_make(), 0, + msg="Running make failed") + finally: + project.clean() diff --git a/meta/lib/oeqa/sdk/cases/buildiptables.py b/meta/lib/oeqa/sdk/cases/buildiptables.py new file mode 100644 index 0000000000..f0cb8a4287 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/buildiptables.py @@ -0,0 +1,26 @@ +from oeqa.oetest import oeSDKTest +from oeqa.utils.decorators import * +from oeqa.utils.targetbuild import SDKBuildProject + + +class BuildIptablesTest(oeSDKTest): + + @classmethod + def setUpClass(self): + self.project = SDKBuildProject(oeSDKTest.tc.sdktestdir + "/iptables/", oeSDKTest.tc.sdkenv, oeSDKTest.tc.d, + "http://downloads.yoctoproject.org/mirror/sources/iptables-1.4.13.tar.bz2") + self.project.download_archive() + + def test_iptables(self): + self.assertEqual(self.project.run_configure(), 0, + msg="Running configure failed") + + self.assertEqual(self.project.run_make(), 0, + msg="Running make failed") + + self.assertEqual(self.project.run_install(), 0, + msg="Running make install failed") + + @classmethod + def tearDownClass(self): + self.project.clean() diff --git a/meta/lib/oeqa/sdk/cases/gcc.py b/meta/lib/oeqa/sdk/cases/gcc.py new file mode 100644 index 0000000000..f3f4341a20 --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/gcc.py @@ -0,0 +1,36 @@ +import unittest +import os +import shutil +from oeqa.oetest import oeSDKTest, skipModule +from oeqa.utils.decorators import * + +def setUpModule(): + machine = oeSDKTest.tc.d.getVar("MACHINE") + if not oeSDKTest.hasHostPackage("packagegroup-cross-canadian-" + machine): + skipModule("SDK doesn't contain a cross-canadian toolchain") + + +class GccCompileTest(oeSDKTest): + + @classmethod + def setUpClass(self): + for f in ['test.c', 'test.cpp', 'testsdkmakefile']: + shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f) + + def test_gcc_compile(self): + self._run('$CC %s/test.c -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) + + def test_gpp_compile(self): + self._run('$CXX %s/test.c -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) + + def test_gpp2_compile(self): + self._run('$CXX %s/test.cpp -o %s/test -lm' % (self.tc.sdktestdir, self.tc.sdktestdir)) + + def test_make(self): + self._run('cd %s; make -f testsdkmakefile' % self.tc.sdktestdir) + + @classmethod + def tearDownClass(self): + files = [self.tc.sdktestdir + f for f in ['test.c', 'test.cpp', 'test.o', 'test', 'testsdkmakefile']] + for f in files: + bb.utils.remove(f) diff --git a/meta/lib/oeqa/sdk/cases/perl.py b/meta/lib/oeqa/sdk/cases/perl.py new file mode 100644 index 0000000000..45f422ef0b --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/perl.py @@ -0,0 +1,28 @@ +import unittest +import os +import shutil +from oeqa.oetest import oeSDKTest, skipModule +from oeqa.utils.decorators import * + +def setUpModule(): + if not oeSDKTest.hasHostPackage("nativesdk-perl"): + skipModule("No perl package in the SDK") + + +class PerlTest(oeSDKTest): + + @classmethod + def setUpClass(self): + for f in ['test.pl']: + shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f) + self.testfile = self.tc.sdktestdir + "test.pl" + + def test_perl_exists(self): + self._run('which perl') + + def test_perl_works(self): + self._run('perl %s/test.pl' % self.tc.sdktestdir) + + @classmethod + def tearDownClass(self): + bb.utils.remove("%s/test.pl" % self.tc.sdktestdir) diff --git a/meta/lib/oeqa/sdk/cases/python.py b/meta/lib/oeqa/sdk/cases/python.py new file mode 100644 index 0000000000..896fab4dfb --- /dev/null +++ b/meta/lib/oeqa/sdk/cases/python.py @@ -0,0 +1,32 @@ +import unittest +import os +import shutil +from oeqa.oetest import oeSDKTest, skipModule +from oeqa.utils.decorators import * + +def setUpModule(): + if not oeSDKTest.hasHostPackage("nativesdk-python"): + skipModule("No python package in the SDK") + + +class PythonTest(oeSDKTest): + + @classmethod + def setUpClass(self): + for f in ['test.py']: + shutil.copyfile(os.path.join(self.tc.filesdir, f), self.tc.sdktestdir + f) + + def test_python_exists(self): + self._run('which python') + + def test_python_stdout(self): + output = self._run('python %s/test.py' % self.tc.sdktestdir) + self.assertEqual(output.strip(), "the value of a is 0.01", msg="Incorrect output: %s" % output) + + def test_python_testfile(self): + self._run('ls /tmp/testfile.python') + + @classmethod + def tearDownClass(self): + bb.utils.remove("%s/test.py" % self.tc.sdktestdir) + bb.utils.remove("/tmp/testfile.python") -- cgit 1.2.3-korg