diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-10-31 16:40:38 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-04 12:50:56 +0000 |
commit | 3503c5426e0339c2c718dbb7f1bac50480bcbe9e (patch) | |
tree | f524260144dda35916c73b6a2d4486f1e165f1c8 /bitbake/lib/toaster | |
parent | 98ac0b0a5b04cea8971a07f5ff9a2d711c95d6df (diff) | |
download | poky-3503c5426e0339c2c718dbb7f1bac50480bcbe9e.tar.gz |
bitbake: toaster: add eventreplay test case for core-image-minimal
Run toaster-eventreplay with core-image-minimal.events and
test if all required packages present in Target_Installed_Package
table.
(Bitbake rev: 73410e6dc965b2885c68e87ed6fa8d8b57e9c49d)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/tests/eventreplay/__init__.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/eventreplay/__init__.py b/bitbake/lib/toaster/tests/eventreplay/__init__.py new file mode 100644 index 0000000000..792f07d5ea --- /dev/null +++ b/bitbake/lib/toaster/tests/eventreplay/__init__.py | |||
@@ -0,0 +1,87 @@ | |||
1 | #! /usr/bin/env python | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | # BitBake Toaster Implementation | ||
6 | # | ||
7 | # Copyright (C) 2016 Intel Corporation | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License version 2 as | ||
11 | # published by the Free Software Foundation. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License along | ||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | |||
22 | # Tests were part of openembedded-core oe selftest Authored by: Lucian Musat | ||
23 | # Ionut Chisanovici, Paul Eggleton and Cristian Iorga | ||
24 | |||
25 | """ | ||
26 | Test toaster backend by playing build event log files | ||
27 | using toaster-eventreplay script | ||
28 | """ | ||
29 | |||
30 | import os | ||
31 | |||
32 | from subprocess import getstatusoutput | ||
33 | from pathlib import Path | ||
34 | |||
35 | from django.test import TestCase | ||
36 | |||
37 | from orm.models import Target_Installed_Package | ||
38 | |||
39 | class EventReplay(TestCase): | ||
40 | """Base class for eventreplay test cases""" | ||
41 | |||
42 | def setUp(self): | ||
43 | """ | ||
44 | Setup build environment: | ||
45 | - set self.script to toaster-eventreplay path | ||
46 | - set self.eventplay_dir to the value of EVENTPLAY_DIR env variable | ||
47 | """ | ||
48 | bitbake_dir = Path(__file__.split('lib/toaster')[0]) | ||
49 | self.script = bitbake_dir / 'bin' / 'toaster-eventreplay' | ||
50 | self.assertTrue(self.script.exists(), "%s doesn't exist") | ||
51 | self.eventplay_dir = os.getenv("EVENTREPLAY_DIR") | ||
52 | self.assertTrue(self.eventplay_dir, | ||
53 | "Environment variable EVENTREPLAY_DIR is not set") | ||
54 | |||
55 | def _replay(self, eventfile): | ||
56 | """Run toaster-eventplay <eventfile>""" | ||
57 | eventpath = Path(self.eventplay_dir) / eventfile | ||
58 | status, output = getstatusoutput('%s %s' % (self.script, eventpath)) | ||
59 | if status: | ||
60 | print(output) | ||
61 | |||
62 | self.assertEqual(status, 0) | ||
63 | |||
64 | class CoreImageMinimalEventReplay(EventReplay): | ||
65 | """Replay core-image-minimal events""" | ||
66 | |||
67 | def test_installed_packages(self): | ||
68 | """Test if all required packages have been installed""" | ||
69 | |||
70 | self._replay('core-image-minimal.events') | ||
71 | |||
72 | # test installed packages | ||
73 | packages = sorted(Target_Installed_Package.objects.\ | ||
74 | values_list('package__name', flat=True)) | ||
75 | self.assertEqual(packages, ['base-files', 'base-passwd', 'busybox', | ||
76 | 'busybox-hwclock', 'busybox-syslog', | ||
77 | 'busybox-udhcpc', 'eudev', 'glibc', | ||
78 | 'init-ifupdown', 'initscripts', | ||
79 | 'initscripts-functions', 'kernel-base', | ||
80 | 'kernel-module-uvesafb', 'libkmod', | ||
81 | 'modutils-initscripts', 'netbase', | ||
82 | 'packagegroup-core-boot', 'run-postinsts', | ||
83 | 'sysvinit', 'sysvinit-inittab', | ||
84 | 'sysvinit-pidof', 'udev-cache', | ||
85 | 'update-alternatives-opkg', | ||
86 | 'update-rc.d', 'util-linux-libblkid', | ||
87 | 'util-linux-libuuid', 'v86d', 'zlib']) | ||