Bug 999518

Summary: Enable qemu-sanity-check in %check section of qemu.spec
Product: [Fedora] Fedora Reporter: Richard W.M. Jones <rjones>
Component: qemuAssignee: Fedora Virtualization Maintainers <virt-maint>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: amit.shah, berrange, cfergeau, dwmw2, itamar, pbonzini, rjones, scottt.tw, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-1.6.0-5.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-28 17:08:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 999108, 1002189    
Bug Blocks:    
Attachments:
Description Flags
Patch to qemu.spec none

Description Richard W.M. Jones 2013-08-21 13:15:56 UTC
Created attachment 788871 [details]
Patch to qemu.spec

Description of problem:

About a year ago I wrote a small qemu/kernel "sanity checker".  It
simply checks that a given kernel boots on a given qemu.  It works
by having a small initramfs which prints a "hello world"-style message,
and we check the serial port output of the qemu process to ensure
the message is eventually printed.  It's a sanity check, not a full
test of functionality.

http://people.redhat.com/~rjones/qemu-sanity-check/

I'm now trying to get this packaged in Fedora.  See:

https://bugzilla.redhat.com/show_bug.cgi?id=999108

Once it's packaged in Fedora, I think qemu should use it, to start
with as an advisory test, but eventually as a mandatory test (the
difference is the advisory test just prints a message but does not
stop the build).

Version-Release number of selected component (if applicable):

qemu 1.6.0-4.fc21

Additional info:

See attachment, which is the suggested change to qemu.spec.

Comment 1 Richard W.M. Jones 2013-08-21 13:22:13 UTC
Scratch build with the patch:
http://koji.fedoraproject.org/koji/taskinfo?taskID=5836862

Comment 2 Richard W.M. Jones 2013-08-21 13:22:46 UTC
(In reply to Richard W.M. Jones from comment #1)
> Scratch build with the patch:
> http://koji.fedoraproject.org/koji/taskinfo?taskID=5836862

Of course, ignore that, qemu-sanity-checker isn't in Fedora yet :-(

Comment 3 Richard W.M. Jones 2013-08-22 20:50:24 UTC
Scratch build:

http://koji.fedoraproject.org/koji/taskinfo?taskID=5842962

If you search through the build log for the string "qemu-sanity-check"
you should see the test running (successfully):

http://kojipkgs.fedoraproject.org//work/tasks/2964/5842964/build.log

Comment 4 Richard W.M. Jones 2013-08-28 14:26:07 UTC
I have pushed this to Rawhide only (qemu-1.6.0-5.fc21).
It's an advisory test only.

http://koji.fedoraproject.org/koji/taskinfo?taskID=5864749

Comment 5 Richard W.M. Jones 2013-08-28 15:04:38 UTC
Lucky it's advisory because the test is failing for some
reason with:

+ qemu-sanity-check --qemu=x86_64-softmmu/qemu-system-x86_64
ls: cannot access /boot/vmlinuz-*.x86_64: No such file or directory
/usr/bin/qemu-sanity-check: cannot find a Linux kernel in /boot
Choose a kernel to test using --kernel=/path/to/vmlinuz
+ :
+ exit 0

I'll leave this bug open while I work out what's wrong.

Comment 6 Richard W.M. Jones 2013-08-28 15:17:37 UTC
It turns out that 'BuildRequires: kernel' picks 'kernel-debug'
(both 'kernel' and 'kernel-debug' provide the 'kernel' dependency,
although why yum picks the -debug one is anyone's guess).

Anyway, kernel-debug has a file:
/boot/vmlinuz-3.11.0-0.rc7.git0.1.fc21.x86_64+debug
which does not match what qemu-sanity-check is expecting
(/boot/vmlinuz-*.x86_64).  This is a bug in qemu-sanity-check
since the +debug kernel would be a reasonable choice (bug 1002189).

Comment 7 Richard W.M. Jones 2013-08-28 17:08:08 UTC
I've fixed bug 1002189 and done a scratch-build of qemu
against the new qemu-sanity-check-1.1.4-2.fc21, and it passed.

http://koji.fedoraproject.org/koji/taskinfo?taskID=5865652

Notes:

(1) The output:

+ qemu-sanity-check --qemu=x86_64-softmmu/qemu-system-x86_64
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
+ exit 0

is *correct*!  KVM just prints this spew when it falls back
to using TCG.

(2) Only x86-64 runs the test.

We could enable it on i686 too, but I didn't do that because
it would require a big conditional to find the right
qemu-system-* binary to run, something like:

%ifarch x86_64
qemu=x86_64-softmmu/qemu-system-x86_64
%else
%ifarch %{ix86}
qemu=i386-softmmu/qemu-system-i386
%endif
%endif
qemu-sanity-check --qemu=$qemu || :

(3) It's known to fail on ARM.

(4) I checked and qemu will automatically locate its BIOS
files in a directory relative to the location of the binary.
So we don't need to pass the -L option to qemu, and as we
can see from the scratch build it evidently does work.