Merge lp:~salgado/linaro-image-tools/bug-686845 into lp:linaro-image-tools/11.11

Proposed by Guilherme Salgado
Status: Merged
Merged at revision: 186
Proposed branch: lp:~salgado/linaro-image-tools/bug-686845
Merge into: lp:linaro-image-tools/11.11
Diff against target: 43 lines (+5/-4)
2 files modified
media_create/populate_boot.py (+2/-2)
media_create/tests/test_media_create.py (+3/-2)
To merge this branch: bzr merge lp:~salgado/linaro-image-tools/bug-686845
Reviewer Review Type Date Requested Status
Martin Ohlsson (community) Approve
Review via email: mp+43072@code.launchpad.net

Description of the change

Fix test_run_mkimage so that it doesn't run a subprocess using sudo

To post a comment you must log in.
Revision history for this message
Martin Ohlsson (martin-ohlson) wrote :

Looks good to me.

/Martin

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'media_create/populate_boot.py'
2--- media_create/populate_boot.py 2010-12-03 18:55:10 +0000
3+++ media_create/populate_boot.py 2010-12-08 13:12:26 +0000
4@@ -5,7 +5,7 @@
5
6
7 def _run_mkimage(img_type, load_addr, entry_point, name, img_data, img,
8- stdout=None):
9+ stdout=None, as_root=True):
10 cmd = ['mkimage',
11 '-A', 'arm',
12 '-O', 'linux',
13@@ -16,7 +16,7 @@
14 '-n', name,
15 '-d', img_data,
16 img]
17- return cmd_runner.run(cmd, as_root=True, stdout=stdout)
18+ return cmd_runner.run(cmd, as_root=as_root, stdout=stdout)
19
20
21 def _get_file_matching(regex):
22
23=== modified file 'media_create/tests/test_media_create.py'
24--- media_create/tests/test_media_create.py 2010-12-08 03:09:51 +0000
25+++ media_create/tests/test_media_create.py 2010-12-08 13:12:26 +0000
26@@ -219,7 +219,7 @@
27 self.assertRaises(
28 ValueError, _get_file_matching, '/foo/bar/baz/*non-existent')
29
30- def DISABLED_test_run_mkimage(self):
31+ def test_run_mkimage(self):
32 # Create a fake boot script.
33 filename = self._create_temp_file_as_fixture()
34 f = open(filename, 'w')
35@@ -232,7 +232,8 @@
36 # want that.
37 retval = _run_mkimage(
38 'script', '0', '0', 'boot script', filename, img,
39- stdout=open(self._create_temp_file_as_fixture(), 'w'))
40+ stdout=open(self._create_temp_file_as_fixture(), 'w'),
41+ as_root=False)
42
43 self.assertEqual(0, retval)
44

Subscribers

People subscribed via source and target branches