tstVDCompact.vd revision 1839eb6c2f3526b276ac2dcf3deae74f6ef8af44
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * Storage: Testcase for compacting disks.
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * Copyright (C) 2011 Oracle Corporation
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * available from http://www.virtualbox.org. This file is free software;
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * you can redistribute it and/or modify it under the terms of the GNU
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * General Public License (GPL) as published by the Free Software
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Create disk containers, read verification is on. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync create("disk", "base", "tstCompact.disk", "dynamic", strBackend, 200M, false);
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Fill the disk with random data. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync io("disk", false, 1, "seq", 64K, 0, 200M, 200M, 100, "none");
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Read the data to verify it once. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync io("disk", false, 1, "seq", 64K, 0, 200M, 200M, 0, "none");
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Fill a part with 0's. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync io("disk", false, 1, "seq", 64K, 100M, 150M, 50M, 100, "zero");
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Now compact. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Read again to verify that the content hasn't changed. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync io("disk", false, 1, "seq", 64K, 0, 200M, 200M, 0, "none");
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Fill everything with 0. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync io("disk", false, 1, "seq", 64K, 0, 200M, 200M, 100, "zero");
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Now compact again. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Read again to verify that the content hasn't changed. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync io("disk", false, 1, "seq", 64K, 0, 200M, 200M, 0, "none");
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Init I/O RNG for generating random data for writes. */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Create zero pattern */
1839eb6c2f3526b276ac2dcf3deae74f6ef8af44vboxsync /* Destroy RNG and pattern */