Some cleanups to fingerprint tests
[qemu-test.git] / tests / finger-print.sh
1 #!/bin/sh
2
3 in_host() {
4 machine=`choose pc-0.14 pc-0.15 pc-1.0`
5
6 tmpdisk=$tmpdir/disk-$$.img
7 qemu-img create -f raw $tmpdisk 10G
8
9 # N.B. If you change this invocation line, please update all of the files
10 # stored in fingerprints/
11 echo "Using machine: $machine"
12 qemu -nographic -enable-kvm -hda $tmpdisk -M $machine
13 rc=$?
14
15 if test $rc = 0; then
16 # this should create one file named fingerprint.txt
17 tar xf $tmpdisk
18 if test -e fingerprint.txt; then
19 diff -u fingerprints/$machine.x86_64 fingerprint.txt
20 rc=$?
21 if test $rc != 0; then
22 echo "Guest fingerprint changed for $machine!"
23 fi
24 else
25 rc=1
26 fi
27 fi
28
29 rm -f $tmpdisk fingerprint.txt
30 return $rc
31 }
32
33 in_guest() {
34 fingerprint > fingerprint.txt
35 tar cf /dev/sda fingerprint.txt
36 }
37
38 if test $QEMU_TEST; then
39 in_host
40 else
41 in_guest
42 fi