Eric Blake wrote:
Had this been in place earlier, I would have avoided the bugs in
commit 0baf6945 and 55c2ab3e. Writing the test required me to extend
the power of virsh - creating enough snapshots to cause fanout
requires enough input in a single session that adding comments and
markers makes it easier to check that output is correct. It's still a
bit odd that with test:///default, reverting to a snapshot changes the
domain from running to paused (possibly a bug in how the test driver
copied from the qemu driver) - but the important part is that the test
is reproducible, and any future tweaks we make to snapshot code have
less chance of breaking successful command sequences.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tests/Makefile.am | 3 +-
tests/virsh-snapshot | 212 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 214 insertions(+), 1 deletion(-)
create mode 100755 tests/virsh-snapshot
Hi,
I noticed this test is failing for me:
$ ./tests/virsh-snapshot
expr: not a decimal number: ' 29'
Bus error (core dumped)
cmp: EOF on out.cooked
exp err differ: char 8, line 1
$
(lldb) target create "tools/.libs/virsh" --core
"/tmp/virsh_13727_0.core"
Core file '/tmp/virsh_13727_0.core' (x86_64) was loaded.
(lldb) bt
* thread #1, name = 'virsh', stop reason = signal SIGBUS
* frame #0: 0x00000008013984bf
libvirt.so.0`virDomainMomentForEachChild(moment=0x0000000802aaea10,
iter=(libvirt.so.0`virDomainMomentActOnDescendant at virdomainmomentobjlist.c:80),
data=0x00007fffffffdb30) at virdomainmomentobjlist.c:62
frame #1: 0x000000080139854f
libvirt.so.0`virDomainMomentForEachDescendant(moment=0x0000000802aaea10,
iter=(libvirt.so.0`testDomainSnapshotDiscardAll at test_driver.c:6445),
data=0x00007fffffffdcf0) at virdomainmomentobjlist.c:105
frame #2: 0x00000008013985c5
libvirt.so.0`virDomainMomentActOnDescendant(payload=0x0000000802aaea10,
name=0x00000008010fe488, data=0x00007fffffffdc10) at virdomainmomentobjlist.c:85
frame #3: 0x00000008013984e2
libvirt.so.0`virDomainMomentForEachChild(moment=0x0000000802aae200,
iter=(libvirt.so.0`virDomainMomentActOnDescendant at virdomainmomentobjlist.c:80),
data=0x00007fffffffdc10) at virdomainmomentobjlist.c:63
frame #4: 0x000000080139854f
libvirt.so.0`virDomainMomentForEachDescendant(moment=0x0000000802aae200,
iter=(libvirt.so.0`testDomainSnapshotDiscardAll at test_driver.c:6445),
data=0x00007fffffffdcf0) at virdomainmomentobjlist.c:105
frame #5: 0x000000080144bb2a
libvirt.so.0`testDomainSnapshotDelete(snapshot=0x0000000802b46960, flags=4) at
test_driver.c:6506
frame #6: 0x000000080156129e
libvirt.so.0`virDomainSnapshotDelete(snapshot=0x0000000802b46960, flags=4) at
libvirt-domain-snapshot.c:1047
frame #7: 0x00000000010a5c4d virsh`cmdSnapshotDelete(ctl=0x00007fffffffdf48,
cmd=0x0000000802b39520) at virsh-snapshot.c:1921
frame #8: 0x00000000010af700 virsh`vshCommandRun(ctl=0x00007fffffffdf48,
cmd=0x0000000802b39520) at vsh.c:1335
frame #9: 0x00000000010698b2 virsh`main(argc=4, argv=0x00007fffffffe088) at
virsh.c:920
frame #10: 0x000000000106910b virsh`_start(ap=<unavailable>,
cleanup=<unavailable>) at crt1.c:76
(lldb) fr s 0
frame #0: 0x00000008013984bf
libvirt.so.0`virDomainMomentForEachChild(moment=0x0000000802aaea10,
iter=(libvirt.so.0`virDomainMomentActOnDescendant at virdomainmomentobjlist.c:80),
data=0x00007fffffffdb30) at virdomainmomentobjlist.c:62
59 virDomainMomentObjPtr child = moment->first_child;
60
61 while (child) {
-> 62 virDomainMomentObjPtr next = child->sibling;
63 (iter)(child, child->def->name, data);
64 child = next;
65 }
(lldb) p child
(virDomainMomentObjPtr) $0 = 0x5a5a5a5a5a5a5a5a
(lldb) fr s 6
frame #6: 0x000000080156129e
libvirt.so.0`virDomainSnapshotDelete(snapshot=0x0000000802b46960, flags=4) at
libvirt-domain-snapshot.c:1047
1044 error);
1045
1046 if (conn->driver->domainSnapshotDelete) {
-> 1047 int ret = conn->driver->domainSnapshotDelete(snapshot, flags);
1048 if (ret < 0)
1049 goto error;
1050 return ret;
(lldb) p snapshot->name
(char *) $1 = 0x00000008010fe3e0 "s6"
(lldb)
I guess 0x5a5a5a5a5a5a5a5a is coming from jemalloc's junk option:
opt.junk (const char *) r- [--enable-fill]
Junk filling. If set to “alloc”, each byte of uninitialized
allocated memory will be initialized to 0xa5. If set to “free”, all
deallocated memory will be initialized to 0x5a. If set to “true”,
both allocated and deallocated memory will be initialized, and if
set to “false”, junk filling be disabled entirely. This is intended
for debugging and will impact performance negatively. This option
is “false” by default unless --enable-debug is specified during
configuration, in which case it is “true” by default.
(from jemalloc(3)).
Roman Bogorodskiy