VirtualBox

source: vbox/trunk/src/VBox/Storage/testcase/tstVDShareable.vd

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1/* $Id: tstVDShareable.vd 106061 2024-09-16 14:03:52Z vboxsync $ */
2/**
3 * Storage: Testcase for shareable disks.
4 */
5
6/*
7 * Copyright (C) 2011-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28void main()
29{
30 /* Init I/O RNG for generating random data for writes. */
31 iorngcreate(10M, "manual", 1234567890);
32
33 /* Create disk containers. */
34 createdisk("shared1", false);
35 createdisk("shared2", false);
36
37 /* Create the disk and close it. */
38 create("shared1", "base", "tstShared.vdi", "fixed", "VDI", 20M, false, false);
39 close("shared1", "all", false);
40
41 /* Open the disk with sharing enabled. */
42 open("shared1", "tstShared.vdi", "VDI", true /* fAsync */, true /* fShareable */, false, false, false, false);
43 open("shared2", "tstShared.vdi", "VDI", true /* fAsync */, true /* fShareable */, false, false, false, false);
44
45 /* Write to one disk and verify that the other disk can see the content. */
46 io("shared1", true, 32, "seq", 64K, 0, 20M, 20M, 100, "none");
47 comparedisks("shared1", "shared2");
48
49 /* Write to the second disk and verify that the first can see the content. */
50 io("shared2", true, 64, "seq", 8K, 0, 20M, 20M, 50, "none");
51 comparedisks("shared1", "shared2");
52
53 /* Close but don't delete yet. */
54 close("shared1", "all", false);
55 close("shared2", "all", false);
56
57 /* Open and delete. */
58 open("shared1", "tstShared.vdi", "VDI", false /* fAsync */, false /* fShareable */, false, false, false, false);
59 close("shared1", "single", true);
60
61 /* Cleanup */
62 destroydisk("shared1");
63 destroydisk("shared2");
64 iorngdestroy();
65}
66
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