import os, re, mmap
import unittest
import inspect
+from oeqa.utils.decorators import LogResults
def loadTests(tc):
return result
+@LogResults
class oeTest(unittest.TestCase):
longMessage = True
"http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2")
self.project.download_archive()
+ @testcase(205)
@skipUnlessPassed("test_ssh")
def test_cvs(self):
self.assertEqual(self.project.run_configure(), 0,
"http://netfilter.org/projects/iptables/files/iptables-1.4.13.tar.bz2")
self.project.download_archive()
+ @testcase(206)
@skipUnlessPassed("test_ssh")
def test_iptables(self):
self.assertEqual(self.project.run_configure(), 0,
"http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2")
self.project.download_archive()
+ @testcase(207)
@skipUnlessPassed("test_ssh")
def test_sudoku(self):
self.assertEqual(self.project.run_configure(), 0,
(status, output) = self.target.run('/usr/sbin/connmand --help')
self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
-
+ @testcase(221)
@skipUnlessPassed('test_connmand_help')
def test_connmand_running(self):
(status, output) = self.target.run(oeRuntimeTest.pscmd + ' | grep [c]onnmand')
class DateTest(oeRuntimeTest):
+ @testcase(211)
@skipUnlessPassed("test_ssh")
def test_date(self):
(status, output) = self.target.run('date +"%Y-%m-%d %T"')
class DfTest(oeRuntimeTest):
+ @testcase(234)
@skipUnlessPassed("test_ssh")
def test_df(self):
(status,output) = self.target.run("df / | sed -n '2p' | awk '{print $4}'")
class DmesgTest(oeRuntimeTest):
+ @testcase(215)
@skipUnlessPassed('test_ssh')
def test_dmesg(self):
(status, output) = self.target.run('dmesg | grep -v mmci-pl18x | grep -v "error changing net interface name" | grep -iv "dma timeout" | grep -i error')
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, "test.c"), "/tmp/test.c")
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, "testmakefile"), "/tmp/testmakefile")
+ @testcase(203)
def test_gcc_compile(self):
(status, output) = self.target.run('gcc /tmp/test.c -o /tmp/test -lm')
self.assertEqual(status, 0, msg="gcc compile failed, output: %s" % output)
(status, output) = self.target.run('/tmp/test')
self.assertEqual(status, 0, msg="running compiled file failed, output %s" % output)
+ @testcase(200)
def test_gpp_compile(self):
(status, output) = self.target.run('g++ /tmp/test.c -o /tmp/test -lm')
self.assertEqual(status, 0, msg="g++ compile failed, output: %s" % output)
(status, output) = self.target.run('/tmp/test')
self.assertEqual(status, 0, msg="running compiled file failed, output %s" % output)
+ @testcase(204)
def test_make(self):
(status, output) = self.target.run('cd /tmp; make -f testmakefile')
self.assertEqual(status, 0, msg="running make failed, output %s" % output)
self.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, "hellomod.c"), "/tmp/hellomod.c")
self.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, "hellomod_makefile"), "/tmp/Makefile")
+ @testcase('316')
@skipUnlessPassed('test_ssh')
@skipUnlessPassed('test_gcc_compile')
def test_kernel_module(self):
(status, output) = self.target.run('which ldd')
self.assertEqual(status, 0, msg = "ldd does not exist in PATH: which ldd: %s" % output)
+ @testcase(239)
@skipUnlessPassed('test_ldd_exists')
def test_ldd_rtldlist_check(self):
(status, output) = self.target.run('for i in $(which ldd | xargs cat | grep "^RTLDLIST"|cut -d\'=\' -f2|tr -d \'"\'); do test -f $i && echo $i && break; done')
(status, output) = self.target.run("sed -i 's#wtmp {#wtmp {\\n olddir /home/root/logrotate_dir#' /etc/logrotate.conf")
self.assertEqual(status, 0, msg = "Could not write to logrotate.conf file. Status and output: %s and %s)" % (status, output))
+ @testcase(289)
@skipUnlessPassed("test_1_logrotate_setup")
def test_2_logrotate(self):
(status, output) = self.target.run('logrotate -f /etc/logrotate.conf')
class MultilibTest(oeRuntimeTest):
+ @testcase('279')
@skipUnlessPassed('test_ssh')
def test_file_connman(self):
self.assertTrue(oeRuntimeTest.hasPackage('connman-gnome'), msg="This test assumes connman-gnome is installed")
class PamBasicTest(oeRuntimeTest):
+ @testcase(287)
@skipUnlessPassed('test_ssh')
def test_pam(self):
(status, output) = self.target.run('login --help')
(status, output) = self.target.run('which perl')
self.assertEqual(status, 0, msg="Perl binary not in PATH or not on target.")
+ @testcase(208)
def test_perl_works(self):
(status, output) = self.target.run('perl /tmp/test.pl')
self.assertEqual(status, 0, msg="Exit status was not 0. Output: %s" % output)
(status, output) = self.target.run('which python')
self.assertEqual(status, 0, msg="Python binary not in PATH or not on target.")
+ @testcase(965)
def test_python_stdout(self):
(status, output) = self.target.run('python /tmp/test.py')
self.assertEqual(status, 0, msg="Exit status was not 0. Output: %s" % output)
(status, output) = self.target.run('rpm --help')
self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
+ @testcase(191)
@skipUnlessPassed('test_rpm_help')
def test_rpm_query(self):
(status, output) = self.target.run('rpm -q rpm')
testrpmfile = f
oeRuntimeTest.tc.target.copy_to(os.path.join(rpmdir,testrpmfile), "/tmp/rpm-doc.rpm")
+ @testcase(192)
@skipUnlessPassed('test_rpm_help')
def test_rpm_install(self):
(status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm')
self.assertEqual(status, 0, msg="Failed to install rpm-doc package: %s" % output)
+ @testcase(194)
@skipUnlessPassed('test_rpm_install')
def test_rpm_remove(self):
(status,output) = self.target.run('rpm -e rpm-doc')
def setUp(self):
self.scancmd = 'scanelf --quiet --recursive --mount --ldpath --path'
+ @testcase(966)
@skipUnlessPassed('test_ssh')
def test_scanelf_textrel(self):
# print TEXTREL information
(status, output) = self.target.run(self.scancmd)
self.assertEqual(output.strip(), "", "\n".join([self.scancmd, output]))
+ @testcase(967)
@skipUnlessPassed('test_ssh')
def test_scanelf_rpath(self):
# print RPATH information
import os
from oeqa.oetest import oeRuntimeTest, skipModule
-from oeqa.utils.decorators import skipUnlessPassed
+from oeqa.utils.decorators import skipUnlessPassed, testcase
def setUpModule():
if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")):
class ScpTest(oeRuntimeTest):
+ @testcase(220)
@skipUnlessPassed('test_ssh')
def test_scp_file(self):
test_log_dir = oeRuntimeTest.tc.d.getVar("TEST_LOG_DIR", True)
(status, output) = self.target.run('ls /usr/sbin/skeleton-test')
self.assertEqual(status, 0, msg = "skeleton-test not found. Output:\n%s" % output)
+ @testcase(284)
@skipUnlessPassed('test_skeleton_availability')
@unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"), "Not appropiate for systemd image")
def test_skeleton_script(self):
class SmartBasicTest(SmartTest):
+ @testcase(716)
@skipUnlessPassed('test_ssh')
def test_smart_help(self):
self.smart('--help')
def test_smart_version(self):
self.smart('--version')
+ @testcase(721)
def test_smart_info(self):
self.smart('info python-smartpm')
+ @testcase(421)
def test_smart_query(self):
self.smart('query python-smartpm')
+ @testcase(720)
def test_smart_search(self):
self.smart('search python-smartpm')
+ @testcase(722)
def test_smart_stats(self):
self.smart('stats')
def test_smart_channel(self):
self.smart('channel', 1)
+ @testcase(719)
def test_smart_channel_add(self):
image_pkgtype = self.tc.d.getVar('IMAGE_PKGTYPE', True)
deploy_url = 'http://%s:%s/%s' %(self.target.server_ip, self.repo_server.port, image_pkgtype)
def test_smart_channel_show(self):
self.smart('channel --show')
+ @testcase(717)
def test_smart_channel_rpmsys(self):
self.smart('channel --show rpmsys')
self.smart('channel --disable rpmsys')
self.smart('remove -y psplash-default')
self.smart('install -y psplash-default')
+ @testcase(728)
@skipUnlessPassed('test_smart_install')
def test_smart_install_dependency(self):
self.smart('remove -y psplash')
self.smart('install -y psplash-default')
+ @testcase(723)
@skipUnlessPassed('test_smart_channel_add')
def test_smart_install_from_disk(self):
self.smart('remove -y psplash-default')
self.smart('download psplash-default')
self.smart('install -y ./psplash-default*')
+ @testcase(725)
@skipUnlessPassed('test_smart_channel_add')
def test_smart_install_from_http(self):
output = self.smart('download --urls psplash-default')
self.smart('remove -y psplash-default')
self.smart('install -y %s' % url.group(0))
+ @testcase(729)
@skipUnlessPassed('test_smart_install')
def test_smart_reinstall(self):
self.smart('reinstall -y psplash-default')
class SshTest(oeRuntimeTest):
+ @testcase(224)
@skipUnlessPassed('test_ping')
def test_ssh(self):
(status, output) = self.target.run('uname -a')
(status,output) = self.target.run('/sbin/syslogd --help')
self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
+ @testcase(201)
@skipUnlessPassed("test_syslog_help")
def test_syslog_running(self):
(status,output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -i [s]yslogd')
else:
(status,output) = self.target.run('systemctl restart syslog.service')
+ @testcase(202)
@skipUnlessPassed("test_syslog_restart")
@skipUnlessPassed("test_syslog_logger")
@unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"), "Not appropiate for systemd image")
def test_systemd_basic(self):
self.systemctl('--version')
+ @testcase(551)
@skipUnlessPassed('test_system_basic')
def test_systemd_list(self):
self.systemctl('list-unit-files')
return (False, output)
time.sleep(10)
+ @testcase(550)
@skipUnlessPassed('test_systemd_basic')
def test_systemd_failed(self):
settled, output = self.settle()
def test_systemd_status(self):
self.systemctl('status --full', 'avahi-daemon.service')
+ @testcase(695)
@skipUnlessPassed('test_systemd_status')
def test_systemd_stop_start(self):
self.systemctl('stop', 'avahi-daemon.service')
self.systemctl('start','avahi-daemon.service')
self.systemctl('is-active', 'avahi-daemon.service', verbose=True)
+ @testcase(696)
@skipUnlessPassed('test_systemd_basic')
def test_systemd_disable_enable(self):
self.systemctl('disable', 'avahi-daemon.service')
class VNCTest(oeRuntimeTest):
+ @testcase(213)
@skipUnlessPassed('test_ssh')
def test_vnc(self):
(status, output) = self.target.run('x11vnc -display :0 -bg -o x11vnc.log')
class X32libTest(oeRuntimeTest):
+ @testcase(281)
@skipUnlessPassed("test_ssh")
def test_x32_file(self):
status1 = self.target.run("readelf -h /bin/ls | grep Class | grep ELF32")[0]
(status, output) = self.target.run(oeRuntimeTest.pscmd + ' | grep -v xinit | grep [X]org')
self.assertEqual(status, 0, msg="Xorg does not appear to be running %s" % self.target.run(oeRuntimeTest.pscmd)[1])
+ @testcase(972)
@skipUnlessPassed('test_ssh')
def test_xorg_error(self):
(status, output) = self.target.run('cat /var/log/Xorg.0.log | grep -v "(EE) error," | grep -v "PreInit" | grep -v "evdev:" | grep -v "glx" | grep "(EE)"')