Upstream Autotest merge.

Merged from d9d64b855363d214996b187380532d4cc9991d29.

BUG=none
TEST=emerge autotest-tests, local server, run_remote_tests.

Change-Id: Id8cf1ef930bc0cd80347d77f2de65561be2a12a4
Reviewed-on: http://gerrit.chromium.org/gerrit/4664
Reviewed-by: Mike Truty <truty@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Dale Curtis <dalecurtis@chromium.org>
diff --git a/client/bin/partition.py b/client/bin/partition.py
index 7381f75..f3e34a8 100644
--- a/client/bin/partition.py
+++ b/client/bin/partition.py
@@ -883,7 +883,7 @@
         logging.debug('Creating disk image %s, size = %d Bytes', img_path, size)
         try:
             cmd = 'dd if=/dev/zero of=%s bs=1024 count=%d' % (img_path, size)
-            utils.system(cmd)
+            utils.run(cmd)
         except error.CmdError, e:
             e_msg = 'Error creating disk image %s: %s' % (img_path, e)
             raise error.AutotestError(e_msg)
@@ -903,10 +903,10 @@
             cmd = 'losetup -f'
             loop_path = utils.system_output(cmd)
             cmd = 'losetup -f %s' % img_path
-            utils.system(cmd)
+            utils.run(cmd)
         except error.CmdError, e:
-            e_msg = 'Error attaching image %s to a loop device: %s' % \
-                     (img_path, e)
+            e_msg = ('Error attaching image %s to a loop device: %s' %
+                     (img_path, e))
             raise error.AutotestError(e_msg)
         return loop_path
 
@@ -924,7 +924,7 @@
             sfdisk_cmd_file = open(sfdisk_file_path, 'w')
             sfdisk_cmd_file.write(single_part_cmd)
             sfdisk_cmd_file.close()
-            utils.system('sfdisk %s < %s' % (loop_path, sfdisk_file_path))
+            utils.run('sfdisk %s < %s' % (loop_path, sfdisk_file_path))
         except error.CmdError, e:
             e_msg = 'Error partitioning device %s: %s' % (loop_path, e)
             raise error.AutotestError(e_msg)
@@ -943,7 +943,7 @@
                       loop_path)
         try:
             cmd = 'kpartx -a %s' % loop_path
-            utils.system(cmd)
+            utils.run(cmd)
             l_cmd = 'kpartx -l %s | cut -f1 -d " "' % loop_path
             device = utils.system_output(l_cmd)
         except error.CmdError, e:
@@ -961,7 +961,7 @@
                       self.loop)
         try:
             cmd = 'kpartx -d %s' % self.loop
-            utils.system(cmd)
+            utils.run(cmd)
         except error.CmdError, e:
             e_msg = 'Error removing entries for loop %s: %s' % (self.loop, e)
             raise error.AutotestError(e_msg)
@@ -975,7 +975,7 @@
                       self.loop)
         try:
             cmd = 'losetup -d %s' % self.loop
-            utils.system(cmd)
+            utils.run(cmd)
         except error.CmdError, e:
             e_msg = ('Error detaching image %s from loop device %s: %s' %
                     (self.img, self.loop, e))
@@ -993,6 +993,7 @@
             e_msg = 'Error removing image file %s' % self.img
             raise error.AutotestError(e_msg)
 
+
 # import a site partition module to allow it to override functions
 try:
     from autotest_lib.client.bin.site_partition import *