public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: alison at peloton-tech.com <alison@peloton-tech.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] GPT: create block device for sandbox testing
Date: Sat,  9 Sep 2017 23:47:12 -0700	[thread overview]
Message-ID: <20170910064713.31511-2-alison@peloton-tech.com> (raw)
In-Reply-To: <20170910064713.31511-1-alison@peloton-tech.com>

From: Alison Chaiken <alison@peloton-tech.com>

Provide a Python function that creates a small block device for the
purpose of testing the cmd/gpt.c or cmd/part.c functions in the u-boot
sandbox.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
---
 board/sandbox/README.sandbox |  5 +++++
 test/py/make_test_disk.py    | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100755 test/py/make_test_disk.py

diff --git a/board/sandbox/README.sandbox b/board/sandbox/README.sandbox
index 9dc2eb09d1..947241e3eb 100644
--- a/board/sandbox/README.sandbox
+++ b/board/sandbox/README.sandbox
@@ -338,6 +338,11 @@ $> lodev=`sudo losetup -P -f --show ./disk.raw`
 $> sudo mkfs.vfat -n EFI -v ${lodev}p1
 $> sudo mkfs.ext4 -L ROOT -v ${lodev}p2
 
+or utilize the device described in test/py/make_test_disk.py:
+
+   #!/usr/bin/python
+   import make_test_disk
+   make_test_disk.makeDisk()
 
 Writing Sandbox Drivers
 -----------------------
diff --git a/test/py/make_test_disk.py b/test/py/make_test_disk.py
new file mode 100755
index 0000000000..5288295588
--- /dev/null
+++ b/test/py/make_test_disk.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2017 Alison Chaiken
+#
+# SPDX-License-Identifier: GPL-2.0
+#
+# Create a block device for testing of 'gpt' and 'part' commands.
+
+import os
+
+def makeDisk():
+    if (os.path.exists("testdisk.raw")):
+        os.remove("testdisk.raw")
+    fd = os.open("testdisk.raw", os.O_RDWR|os.O_CREAT )
+    os.ftruncate(fd, 4194304)
+    os.close(fd)
+    os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "-U",
+          "375a56f7-d6c9-4e81-b5f0-09d41ca89efe", "testdisk.raw")
+    os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "--new=1:2048:2560", "testdisk.raw")
+    os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "--new=2:4096:4608", "testdisk.raw")
+    os.spawnl(os.P_WAIT, "/sbin/gdisk", "sgdisk", "-l", "testdisk.raw")
-- 
2.14.1

  reply	other threads:[~2017-09-10  6:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03  0:18 [U-Boot] [PATCH 1/3] GPT: create block device for sandbox testing alison at peloton-tech.com
2017-09-03  0:18 ` [U-Boot] [PATCH 2/3] add pytest for 'gpt guid' command in sandbox alison at peloton-tech.com
2017-09-03  0:18 ` [U-Boot] [PATCH 3/3] add pytests for 'gpt rename' and 'gpt swap' alison at peloton-tech.com
2017-09-05  8:55   ` Simon Glass
2017-09-10  6:54     ` [U-Boot] [PATCH v2 1/3] " alison at peloton-tech.com
2017-09-10  6:54       ` [U-Boot] [PATCH 1/1] " alison at peloton-tech.com
2017-09-12 12:29         ` Simon Glass
2017-09-15 12:29         ` [U-Boot] [U-Boot, " Tom Rini
2017-09-15 15:40           ` Stephen Warren
2017-09-15 16:16             ` Tom Rini
2017-09-15 16:29               ` Stephen Warren
2017-09-05  8:55 ` [U-Boot] [PATCH 1/3] GPT: create block device for sandbox testing Simon Glass
2017-09-10  6:47   ` [U-Boot] [PATCH 0/2] GPT: create block device for guid testing alison at peloton-tech.com
2017-09-10  6:47     ` alison at peloton-tech.com [this message]
2017-09-12 12:29       ` [U-Boot] [PATCH 1/2] GPT: create block device for sandbox testing Simon Glass
2017-09-15 12:23       ` [U-Boot] [U-Boot, " Tom Rini
2017-09-10  6:47     ` [U-Boot] [PATCH 2/2] add pytests for 'gpt guid' command in sandbox alison at peloton-tech.com
2017-09-12 12:29       ` Simon Glass
2017-09-15 12:28       ` [U-Boot] [U-Boot, " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170910064713.31511-2-alison@peloton-tech.com \
    --to=alison@peloton-tech.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox