blob: 5288295588a79dc82bcfa0c643f66e49a81161da [file] [log] [blame]
Alison Chaikenbccb8b62017-09-09 23:47:12 -07001# Copyright (c) 2017 Alison Chaiken
2#
3# SPDX-License-Identifier: GPL-2.0
4#
5# Create a block device for testing of 'gpt' and 'part' commands.
6
7import os
8
9def makeDisk():
10 if (os.path.exists("testdisk.raw")):
11 os.remove("testdisk.raw")
12 fd = os.open("testdisk.raw", os.O_RDWR|os.O_CREAT )
13 os.ftruncate(fd, 4194304)
14 os.close(fd)
15 os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "-U",
16 "375a56f7-d6c9-4e81-b5f0-09d41ca89efe", "testdisk.raw")
17 os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "--new=1:2048:2560", "testdisk.raw")
18 os.spawnl(os.P_WAIT, "/sbin/sgdisk", "sgdisk", "--new=2:4096:4608", "testdisk.raw")
19 os.spawnl(os.P_WAIT, "/sbin/gdisk", "sgdisk", "-l", "testdisk.raw")