jeudi 27 octobre 2016

Testing effects of software editing block devices

I'm writing a program that edits partitions of block devices (/dev/sda and such) on linux. I've got the programs to work fairly well, and I have unit tested my code using mocks (as worked through in a previous question of mine), and now I would like to test my code on actually devices.

The code copies a partition table from one drive to another, possibly shrinking the partition table if needed. Afterwards, it copies the files from one drive to another. So I want to test my drive using drives of various relative sizes. Finally it makes the new drive bootable, essentially cloning the device.Unfortunately, I don't have physical drives in the correct sizes to test this program within a reasonable time limit.

I have been testing using .img (created using dd) files and various tools to mount them, but apparently VirtualBox can't run these in a VM, so I can't really test if they boot. I also tried mounting .vdi files using qemu-nbd, but sgdisk and similar tools can edit partitions on those.

What can I use to make virtual disks of (practically) any size, which I can edit on my Linux system then boot from virtual box?

Note that I'm not trying to unit test. These aren't intended to be automatic tests, so it doesn't have to be something that the computer can easily do by itself.

Aucun commentaire:

Enregistrer un commentaire