VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedFolders/testcase/tstShflSizes.cpp@ 28800

Last change on this file since 28800 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1/** @file
2 * tstShflSize - Testcase for shared folder structure sizes.
3 * Run this on Linux and Windows, then compare.
4 */
5
6/*
7 * Copyright (C) 2006-2007 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
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <VBox/shflsvc.h>
22#include <iprt/string.h>
23#include <stdio.h>
24
25#define STRUCT(t, size) \
26 do { \
27 if (fPrintChecks) \
28 printf(" STRUCT(" #t ", %d);\n", (int)sizeof(t)); \
29 else if ((size) != sizeof(t)) \
30 { \
31 printf("%30s: %d expected %d!\n", #t, (int)sizeof(t), (size)); \
32 cErrors++; \
33 } \
34 else if (!fQuiet)\
35 printf("%30s: %d\n", #t, (int)sizeof(t)); \
36 } while (0)
37
38
39int main(int argc, char **argv)
40{
41 unsigned cErrors = 0;
42
43 /*
44 * Prints the code below if any argument was giving.
45 */
46 bool fQuiet = argc == 2 && !strcmp(argv[1], "quiet");
47 bool fPrintChecks = !fQuiet && argc != 1;
48
49 printf("tstShflSizes: TESTING\n");
50
51 /*
52 * The checks.
53 */
54 STRUCT(SHFLROOT, 4);
55 STRUCT(SHFLHANDLE, 8);
56 STRUCT(SHFLSTRING, 6);
57 STRUCT(SHFLCREATERESULT, 4);
58 STRUCT(SHFLCREATEPARMS, 108);
59 STRUCT(SHFLMAPPING, 8);
60 STRUCT(SHFLDIRINFO, 128);
61 STRUCT(SHFLVOLINFO, 40);
62#ifdef VBOX_WITH_64_BITS_GUESTS
63/* The size of the guest structures depends on the current architecture bit count (ARCH_BITS)
64 * because the HGCMFunctionParameter structure differs in 32 and 64 bit guests.
65 * The host VMMDev device takes care about this.
66 *
67 * Therefore this testcase verifies whether structure sizes are correct for the currebt ARCH_BITS.
68 */
69# if ARCH_BITS == 64
70 STRUCT(VBoxSFQueryMappings, 64);
71 STRUCT(VBoxSFQueryMapName, 48);
72 STRUCT(VBoxSFMapFolder_Old, 64);
73 STRUCT(VBoxSFMapFolder, 80);
74 STRUCT(VBoxSFUnmapFolder, 32);
75 STRUCT(VBoxSFCreate, 64);
76 STRUCT(VBoxSFClose, 48);
77 STRUCT(VBoxSFRead, 96);
78 STRUCT(VBoxSFWrite, 96);
79 STRUCT(VBoxSFLock, 96);
80 STRUCT(VBoxSFFlush, 48);
81 STRUCT(VBoxSFList, 144);
82 STRUCT(VBoxSFInformation, 96);
83 STRUCT(VBoxSFRemove, 64);
84 STRUCT(VBoxSFRename, 80);
85# elif ARCH_BITS == 32
86 STRUCT(VBoxSFQueryMappings, 52);
87 STRUCT(VBoxSFQueryMapName, 40); /* this was changed from 52 in 21976 after VBox-1.4. */
88 STRUCT(VBoxSFMapFolder_Old, 52);
89 STRUCT(VBoxSFMapFolder, 64);
90 STRUCT(VBoxSFUnmapFolder, 28);
91 STRUCT(VBoxSFCreate, 52);
92 STRUCT(VBoxSFClose, 40);
93 STRUCT(VBoxSFRead, 76);
94 STRUCT(VBoxSFWrite, 76);
95 STRUCT(VBoxSFLock, 76);
96 STRUCT(VBoxSFFlush, 40);
97 STRUCT(VBoxSFList, 112);
98 STRUCT(VBoxSFInformation, 76);
99 STRUCT(VBoxSFRemove, 52);
100 STRUCT(VBoxSFRename, 64);
101# else
102# error "Unsupported ARCH_BITS"
103# endif /* ARCH_BITS */
104#else
105 STRUCT(VBoxSFQueryMappings, 52);
106 STRUCT(VBoxSFQueryMapName, 40); /* this was changed from 52 in 21976 after VBox-1.4. */
107 STRUCT(VBoxSFMapFolder_Old, 52);
108 STRUCT(VBoxSFMapFolder, 64);
109 STRUCT(VBoxSFUnmapFolder, 28);
110 STRUCT(VBoxSFCreate, 52);
111 STRUCT(VBoxSFClose, 40);
112 STRUCT(VBoxSFRead, 76);
113 STRUCT(VBoxSFWrite, 76);
114 STRUCT(VBoxSFLock, 76);
115 STRUCT(VBoxSFFlush, 40);
116 STRUCT(VBoxSFList, 112);
117 STRUCT(VBoxSFInformation, 76);
118 STRUCT(VBoxSFRemove, 52);
119 STRUCT(VBoxSFRename, 64);
120#endif /* VBOX_WITH_64_BITS_GUESTS */
121
122 /*
123 * The summary.
124 */
125 if (!cErrors)
126 printf("tstShflSizes: SUCCESS\n");
127 else
128 printf("tstShflSizes: FAILURE - %d errors\n", cErrors);
129 return !!cErrors;
130}
131
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