VirtualBox

source: vbox/trunk/src/VBox/Storage/testcase/tstVDCopy.vd@ 69496

Last change on this file since 69496 was 69496, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/* $Id: tstVDCopy.vd 69496 2017-10-28 14:55:58Z vboxsync $ */
2/**
3 * Storage: Testcase for VDCopy with snapshots and optimizations.
4 */
5
6/*
7 * Copyright (C) 2011-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18void main()
19{
20 /* Init I/O RNG for generating random data for writes. */
21 iorngcreate(10M, "manual", 1234567890);
22
23 /* Create source disk and fill data. */
24 print("Creating Source Disk");
25 createdisk("source", false);
26 create("source", "base", "source_base.vdi", "dynamic", "VDI", 1G, false, false);
27 io("source", false, 1, "rnd", 64K, 0, 512M, 256M, 100, "none");
28
29 print("Creating first diff");
30 create("source", "diff", "source_diff1.vdi", "dynamic", "VDI", 1G, false, false);
31 io("source", false, 1, "rnd", 64K, 512M, 1G, 256M, 50, "none");
32
33 print("Creating second diff");
34 create("source", "diff", "source_diff2.vdi", "dynamic", "VDI", 1G, false, false);
35 io("source", false, 1, "rnd", 1M, 0, 1G, 45M, 100, "none");
36
37 print("Creating third diff");
38 create("source", "diff", "source_diff3.vdi", "dynamic", "VDI", 1G, false, false);
39 io("source", false, 1, "rnd", 1M, 0, 1G, 45M, 100, "none");
40
41 print("Creating fourth diff");
42 create("source", "diff", "source_diff4.vdi", "dynamic", "VDI", 1G, false, false);
43 io("source", false, 1, "rnd", 1M, 0, 1G, 45M, 100, "none");
44
45 print("Creating destination disk");
46 createdisk("dest", false);
47
48 print("Copying base image");
49 copy("source", "dest", 0, "VDI", "dest_base.vdi", false, 0, 0xffffffff, 0xffffffff); /* Image content unknown */
50
51 print("Copying first diff optimized");
52 copy("source", "dest", 1, "VDI", "dest_diff1.vdi", false, 0, 0, 0);
53
54 print("Copying other diffs optimized");
55 copy("source", "dest", 2, "VDI", "dest_diff2.vdi", false, 0, 1, 1);
56 copy("source", "dest", 3, "VDI", "dest_diff3.vdi", false, 0, 2, 2);
57 copy("source", "dest", 4, "VDI", "dest_diff4.vdi", false, 0, 3, 3);
58
59 print("Comparing disks");
60 comparedisks("source", "dest");
61
62 printfilesize("source", 0);
63 printfilesize("source", 1);
64 printfilesize("source", 2);
65 printfilesize("source", 3);
66 printfilesize("source", 4);
67
68 printfilesize("dest", 0);
69 printfilesize("dest", 1);
70 printfilesize("dest", 2);
71 printfilesize("dest", 3);
72 printfilesize("dest", 4);
73
74 print("Cleaning up");
75 close("dest", "single", true);
76 close("dest", "single", true);
77 close("dest", "single", true);
78 close("dest", "single", true);
79 close("dest", "single", true);
80
81 close("source", "single", true);
82 close("source", "single", true);
83 close("source", "single", true);
84 close("source", "single", true);
85 close("source", "single", true);
86 destroydisk("source");
87 destroydisk("dest");
88
89 iorngdestroy();
90}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette