diff options
Diffstat (limited to 'poky/meta/lib/oeqa/sdk/cases')
-rw-r--r-- | poky/meta/lib/oeqa/sdk/cases/buildcpio.py | 33 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/cases/buildgalculator.py | 35 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/cases/buildlzip.py | 36 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/cases/gcc.py | 43 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/cases/perl.py | 28 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/sdk/cases/python.py | 32 |
6 files changed, 207 insertions, 0 deletions
diff --git a/poky/meta/lib/oeqa/sdk/cases/buildcpio.py b/poky/meta/lib/oeqa/sdk/cases/buildcpio.py new file mode 100644 index 000000000..333dc7c22 --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/cases/buildcpio.py @@ -0,0 +1,33 @@ +import unittest +from oeqa.sdk.case import OESDKTestCase +from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject + +class BuildCpioTest(OESDKTestCase): + td_vars = ['DATETIME'] + + @classmethod + def setUpClass(self): + dl_dir = self.td.get('DL_DIR', None) + + self.project = SDKBuildProject(self.tc.sdk_dir + "/cpio/", self.tc.sdk_env, + "https://ftp.gnu.org/gnu/cpio/cpio-2.12.tar.gz", + self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir) + self.project.download_archive() + + machine = self.td.get("MACHINE") + if not self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % machine): + raise unittest.SkipTest("SDK doesn't contain a cross-canadian toolchain") + + def test_cpio(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/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py b/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py new file mode 100644 index 000000000..780afccc7 --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/cases/buildgalculator.py @@ -0,0 +1,35 @@ +import unittest + +from oeqa.sdk.case import OESDKTestCase +from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject + +class GalculatorTest(OESDKTestCase): + td_vars = ['DATETIME'] + + @classmethod + def setUpClass(self): + if not (self.tc.hasTargetPackage("gtk\+3") or\ + self.tc.hasTargetPackage("libgtk-3.0")): + raise unittest.SkipTest("GalculatorTest class: SDK don't support gtk+3") + + def test_galculator(self): + dl_dir = self.td.get('DL_DIR', None) + project = None + try: + project = SDKBuildProject(self.tc.sdk_dir + "/galculator/", + self.tc.sdk_env, + "http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2", + self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir) + + 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/poky/meta/lib/oeqa/sdk/cases/buildlzip.py b/poky/meta/lib/oeqa/sdk/cases/buildlzip.py new file mode 100644 index 000000000..3a89ce862 --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/cases/buildlzip.py @@ -0,0 +1,36 @@ +import unittest +from oeqa.sdk.case import OESDKTestCase +from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject + + +class BuildLzipTest(OESDKTestCase): + td_vars = ['DATETIME'] + + @classmethod + def setUpClass(self): + dl_dir = self.td.get('DL_DIR', None) + + self.project = SDKBuildProject(self.tc.sdk_dir + "/lzip/", self.tc.sdk_env, + "http://downloads.yoctoproject.org/mirror/sources/lzip-1.19.tar.gz", + self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir) + self.project.download_archive() + + machine = self.td.get("MACHINE") + + if not (self.tc.hasTargetPackage("packagegroup-cross-canadian-%s" % machine) or + self.tc.hasTargetPackage("gcc")): + raise unittest.SkipTest("SDK doesn't contain a cross-canadian toolchain") + + def test_lzip(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/poky/meta/lib/oeqa/sdk/cases/gcc.py b/poky/meta/lib/oeqa/sdk/cases/gcc.py new file mode 100644 index 000000000..d11f4b63f --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/cases/gcc.py @@ -0,0 +1,43 @@ +import os +import shutil +import unittest + +from oeqa.core.utils.path import remove_safe +from oeqa.sdk.case import OESDKTestCase + +class GccCompileTest(OESDKTestCase): + td_vars = ['MACHINE'] + + @classmethod + def setUpClass(self): + files = {'test.c' : self.tc.files_dir, 'test.cpp' : self.tc.files_dir, + 'testsdkmakefile' : self.tc.sdk_files_dir} + for f in files: + shutil.copyfile(os.path.join(files[f], f), + os.path.join(self.tc.sdk_dir, f)) + + def setUp(self): + machine = self.td.get("MACHINE") + if not (self.tc.hasTargetPackage("packagegroup-cross-canadian-%s" % machine) or + self.tc.hasTargetPackage("gcc")): + raise unittest.SkipTest("GccCompileTest class: SDK doesn't contain a cross-canadian toolchain") + + def test_gcc_compile(self): + self._run('$CC %s/test.c -o %s/test -lm' % (self.tc.sdk_dir, self.tc.sdk_dir)) + + def test_gpp_compile(self): + self._run('$CXX %s/test.c -o %s/test -lm' % (self.tc.sdk_dir, self.tc.sdk_dir)) + + def test_gpp2_compile(self): + self._run('$CXX %s/test.cpp -o %s/test -lm' % (self.tc.sdk_dir, self.tc.sdk_dir)) + + def test_make(self): + self._run('cd %s; make -f testsdkmakefile' % self.tc.sdk_dir) + + @classmethod + def tearDownClass(self): + files = [os.path.join(self.tc.sdk_dir, f) \ + for f in ['test.c', 'test.cpp', 'test.o', 'test', + 'testsdkmakefile']] + for f in files: + remove_safe(f) diff --git a/poky/meta/lib/oeqa/sdk/cases/perl.py b/poky/meta/lib/oeqa/sdk/cases/perl.py new file mode 100644 index 000000000..808567811 --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/cases/perl.py @@ -0,0 +1,28 @@ +import os +import shutil +import unittest + +from oeqa.core.utils.path import remove_safe +from oeqa.sdk.case import OESDKTestCase + +class PerlTest(OESDKTestCase): + @classmethod + def setUpClass(self): + if not (self.tc.hasHostPackage("nativesdk-perl") or + self.tc.hasHostPackage("perl-native")): + raise unittest.SkipTest("No perl package in the SDK") + + for f in ['test.pl']: + shutil.copyfile(os.path.join(self.tc.files_dir, f), + os.path.join(self.tc.sdk_dir, f)) + self.testfile = os.path.join(self.tc.sdk_dir, "test.pl") + + def test_perl_exists(self): + self._run('which perl') + + def test_perl_works(self): + self._run('perl %s' % self.testfile) + + @classmethod + def tearDownClass(self): + remove_safe(self.testfile) diff --git a/poky/meta/lib/oeqa/sdk/cases/python.py b/poky/meta/lib/oeqa/sdk/cases/python.py new file mode 100644 index 000000000..72dfcc72b --- /dev/null +++ b/poky/meta/lib/oeqa/sdk/cases/python.py @@ -0,0 +1,32 @@ +import os +import shutil +import unittest + +from oeqa.core.utils.path import remove_safe +from oeqa.sdk.case import OESDKTestCase + +class PythonTest(OESDKTestCase): + @classmethod + def setUpClass(self): + if not (self.tc.hasHostPackage("nativesdk-python") or + self.tc.hasHostPackage("python-native")): + raise unittest.SkipTest("No python package in the SDK") + + for f in ['test.py']: + shutil.copyfile(os.path.join(self.tc.files_dir, f), + os.path.join(self.tc.sdk_dir, f)) + + def test_python_exists(self): + self._run('which python') + + def test_python_stdout(self): + output = self._run('python %s/test.py' % self.tc.sdk_dir) + 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): + remove_safe("%s/test.py" % self.tc.sdk_dir) + remove_safe("/tmp/testfile.python") |