diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/setup.cfg | 2 | ||||
-rw-r--r-- | scripts/tests/02_wic_test_directdisk.py | 61 |
2 files changed, 62 insertions, 1 deletions
diff --git a/scripts/setup.cfg b/scripts/setup.cfg index 48a0bb2f4f..f378efa642 100644 --- a/scripts/setup.cfg +++ b/scripts/setup.cfg | |||
@@ -3,4 +3,4 @@ verbosity=2 | |||
3 | exe=1 | 3 | exe=1 |
4 | with-coverage=1 | 4 | with-coverage=1 |
5 | cover-erase=1 | 5 | cover-erase=1 |
6 | cover-package=wic,image | 6 | cover-package=wic,image,wic.imager |
diff --git a/scripts/tests/02_wic_test_directdisk.py b/scripts/tests/02_wic_test_directdisk.py new file mode 100644 index 0000000000..9108621fbe --- /dev/null +++ b/scripts/tests/02_wic_test_directdisk.py | |||
@@ -0,0 +1,61 @@ | |||
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 | # Copyright (c) 2015, Intel Corporation. | ||
6 | # All rights reserved. | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License version 2 as | ||
10 | # published by the Free Software Foundation. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License along | ||
18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
20 | # | ||
21 | # AUTHORS | ||
22 | # Ed Bartosh <ed.bartosh@linux.intel.com> | ||
23 | |||
24 | """Test directdisk builds.""" | ||
25 | |||
26 | import imp | ||
27 | import unittest | ||
28 | import os | ||
29 | import shutil | ||
30 | import glob | ||
31 | |||
32 | class TestWicDirectdisk(unittest.TestCase): | ||
33 | """Test build of directdisk image""" | ||
34 | def __init__(self, methodName='runTest'): | ||
35 | unittest.TestCase.__init__(self, methodName) | ||
36 | self.main = imp.load_source("wic", "wic").main | ||
37 | self.resultdir = "/var/tmp/wic/build/" | ||
38 | |||
39 | def setUp(self): | ||
40 | """This code executes before each test method.""" | ||
41 | shutil.rmtree(self.resultdir) | ||
42 | os.chdir(os.getenv("BUILDDIR")) | ||
43 | |||
44 | def _build(self, cmdline): | ||
45 | """Call self.main with provided commandline.""" | ||
46 | self.assertIsNone(self.main(cmdline)) | ||
47 | self.assertEqual(1, len(glob.glob(self.resultdir + \ | ||
48 | "directdisk-*.direct"))) | ||
49 | |||
50 | def testbuild_image_name(self): | ||
51 | self._build(["create", "directdisk", | ||
52 | "--image-name", "core-image-minimal"]) | ||
53 | |||
54 | def testbuild_artifacts(self): | ||
55 | self._build(["create", "directdisk", | ||
56 | "-b", "tmp/sysroots/qemux86/usr/share", | ||
57 | "-k", "tmp/deploy/images/qemux86", | ||
58 | "-n", "tmp/sysroots/x86_64-linux", | ||
59 | "-r", "tmp/work/qemux86-poky-linux/" | ||
60 | "core-image-minimal/1.0-r0/rootfs"]) | ||
61 | |||