public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sean" <spbrogan@outlook.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>, discuss@edk2.groups.io
Subject: OVMF/QEMU shell based unit tests and writing to a virtual disk
Date: Thu, 22 Oct 2020 11:55:16 -0700	[thread overview]
Message-ID: <BN8PR07MB6962B04D8A71EE688D080763C81D0@BN8PR07MB6962.namprd07.prod.outlook.com> (raw)

Laszlo and others familiar with QEMU,

I am trying to write automation that boots QEMU/OVMF and then runs EFI 
applications and those efi applications then use the UEFI shell apis to 
write back to the disk their state.  I am seeing very inconsistent 
results with sometimes it working fine while other times the disk 
contents are invalid.  If i run multiple tests it seems like the first 
two work while the 3rd seems to start failing but overall it seems random.

Failing means:
	Disk contents corrupted but present.
	Disk contents wrong size (short).
	Files that show written in UEFI shell never show up on host.

I am trying to determine if this is a known limitation with QEMU or a 
bug i need to track down in the unit test code.

My setup:

This is on a Windows 10 x64 host.  I am running current 5.1 version of 
QEMU.

My script creates a folder in the Windows NTFS file system.  Copies the 
EFI executables and startup.nsh files to it.  Then starts QEMU with the 
following additional parameter.

  -drive file=fat:rw:{VirtualDrive},format=raw,media=disk

VirtualDrive is the Windows file path of the said mentioned folder.


If interested you should be able to reproduce the results by pulling my 
branch and/or you can review the above.

You can see the operations here:

PR: https://github.com/microsoft/mu_tiano_platforms/pull/1

My Branch: 
https://github.com/spbrogan/mu_tiano_platforms/tree/personal/sebrogan/shellunittests

Or if interested you can reproduce it by following steps defined here:

https://github.com/spbrogan/mu_tiano_platforms/blob/personal/sebrogan/shellunittests/Platforms/QemuQ35Pkg/Docs/building.md

and more details here
https://github.com/spbrogan/mu_tiano_platforms/blob/personal/sebrogan/shellunittests/Platforms/QemuQ35Pkg/Plugins/QemuRunner/ReadMe.md

After building qemu with the right parameters for your environment you 
can run <your stuart_build cmd> --flashonly MARK_STARTUP_NSH=TRUE 
RUN_UNIT_TESTS=TRUE

For example in my environment it looks like
stuart_build -c Platforms\QemuQ35Pkg\PlatformBuild.py 
TOOL_CHAIN_TAG=VS2019 --flashonly RUN_UNIT_TESTS=TRUE MAKE_STARTUP_NSH=TRUE


Anyway if i recall correctly last year when we talked briefly about 
automation there was some concern that this would happen. Any 
information and/or ideas would be greatly appreciated.

Thanks
Sean








             reply	other threads:[~2020-10-22 18:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 18:55 Sean [this message]
2020-10-27 13:26 ` [edk2-devel] OVMF/QEMU shell based unit tests and writing to a virtual disk Laszlo Ersek
2020-10-27 13:41   ` Laszlo Ersek

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-list 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=BN8PR07MB6962B04D8A71EE688D080763C81D0@BN8PR07MB6962.namprd07.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /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