Skip to contentSkip to conversation

test/py: gpt: Use long options for sgdisk

PATCH New Sam Protsenko 3 participants 4 messages Jul 2, 2019 – Jul 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/py: gpt: Use long options for sgdisk

sgdisk 0.8.10.2 from AOSP doesn't support short options, failing with errors like this:

sgdisk: invalid option -- 'U'

Test fails due to that error. Let's use long options to make the test work with any sgdisk version.

---
 test/py/tests/test_gpt.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
test/py/tests/test_gpt.py +7 -4
index c8edb33642..229d7eb2c2 100644
@@ -40,16 +40,19 @@ class GptTestDiskImage(object):
                 fd = os.open(persistent, os.O_RDWR | os.O_CREAT)
                 os.ftruncate(fd, 4194304)
                 os.close(fd)
-                cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
+                cmd = ('sgdisk',
+                    '--disk-guid=375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
                     persistent)
                 u_boot_utils.run_and_log(u_boot_console, cmd)
                 # part1 offset 1MB size 1MB
-                cmd = ('sgdisk', '--new=1:2048:4095', '-c 1:part1', persistent)
+                cmd = ('sgdisk', '--new=1:2048:4095', '--change-name=1:part1',
+                    persistent)
                 # part2 offset 2MB size 1.5MB
                 u_boot_utils.run_and_log(u_boot_console, cmd)
-                cmd = ('sgdisk', '--new=2:4096:7167', '-c 2:part2', persistent)
+                cmd = ('sgdisk', '--new=2:4096:7167', '--change-name=2:part2',
+                    persistent)
                 u_boot_utils.run_and_log(u_boot_console, cmd)
-                cmd = ('sgdisk', '-l', persistent)
+                cmd = ('sgdisk', '--load-backup=' + persistent)
                 u_boot_utils.run_and_log(u_boot_console, cmd)
 
         cmd = ('cp', persistent, self.path)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 test/py: gpt: Use long options for sgdisk

Quoted 7 lines · Sam Protsenko

sgdisk 0.8.10.2 from AOSP doesn't support short options, failing with errors like this:

sgdisk: invalid option -- 'U'

Test fails due to that error. Let's use long options to make the test work with any sgdisk version.

... but I do wonder how you're running this on AOSP; surely this can't be the only issue that prevents U-Boot building and test/py from running?

#2 lore raw

PATCH 1/1 test/py: gpt: Use long options for sgdisk

Hi Stephen,

Quoted 7 lines · Stephen Warren
Quoted 5 lines · Sam Protsenko

sgdisk 0.8.10.2 from AOSP doesn't support short options, failing with errors like this:

sgdisk: invalid option -- 'U'

Quoted 7 lines
Quoted 2 lines

Test fails due to that error. Let's use long options to make the test work with any sgdisk version.

... but I do wonder how you're running this on AOSP; surely this can't be the only issue that prevents U-Boot building and test/py from running?

I just happened to have AOSP out/ and prebuilt/ directories in the beginning of my $PATH env var, in order to use most recent adb and fastboot. And sgdisk is also present there, that's how I ended up running U-Boot tests using sgdisk from AOSP :) Everything else is executing without errors. So I figured, why don't fix this case, if we can keep tests working with any sgdisk version. But yeah, this is the minor fix.

#3 lore raw

PATCH 1/1 test/py: gpt: Use long options for sgdisk

In reply to Sam Protsenko
Quoted 10 lines · Sam Protsenko

sgdisk 0.8.10.2 from AOSP doesn't support short options, failing with errors like this:

sgdisk: invalid option -- 'U'

Test fails due to that error. Let's use long options to make the test work with any sgdisk version.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/39caeb8b/attachment.sig>