VirtualBox

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

Last change on this file since 6329 was 6329, checked in by vboxsync, 17 years ago

make theh tstShflSizes test mandatory during build time

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/** @file
2 *
3 * Testcase for shared folder structure sizes.
4 * Run this on Linux and Windows, then compare.
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <VBox/shflsvc.h>
23#include <iprt/stream.h>
24#include <iprt/string.h>
25
26#define STRUCT(t, size) \
27 do { \
28 if (fPrintChecks) \
29 RTPrintf(" STRUCT(" #t ", %d);\n", (int)sizeof(t)); \
30 else if ((size) != sizeof(t)) \
31 { \
32 RTPrintf("%30s: %d expected %d!\n", #t, (int)sizeof(t), (size)); \
33 cErrors++; \
34 } \
35 else if (!fQuiet)\
36 RTPrintf("%30s: %d\n", #t, (int)sizeof(t)); \
37 } while (0)
38
39
40int main(int argc, char **argv)
41{
42 unsigned cErrors = 0;
43
44 /*
45 * Prints the code below if any argument was giving.
46 */
47 bool fQuiet = argc == 2 && !strcmp(argv[1], "quiet");
48 bool fPrintChecks = !fQuiet && argc != 1;
49
50 RTPrintf("tstShflSizes: TESTING\n");
51
52 /*
53 * The checks.
54 */
55 STRUCT(SHFLROOT, 4);
56 STRUCT(SHFLHANDLE, 8);
57 STRUCT(SHFLSTRING, 6);
58 STRUCT(SHFLCREATERESULT, 4);
59 STRUCT(SHFLCREATEPARMS, 108);
60 STRUCT(SHFLMAPPING, 8);
61 STRUCT(SHFLDIRINFO, 128);
62 STRUCT(SHFLVOLINFO, 40);
63 STRUCT(VBoxSFQueryMappings, 52);
64 STRUCT(VBoxSFQueryMapName, 40); /* this was changed from 52 in 21976 after VBox-1.4) */
65 STRUCT(VBoxSFMapFolder_Old, 52);
66 STRUCT(VBoxSFMapFolder, 64);
67 STRUCT(VBoxSFUnmapFolder, 28);
68 STRUCT(VBoxSFCreate, 52);
69 STRUCT(VBoxSFClose, 40);
70 STRUCT(VBoxSFRead, 76);
71 STRUCT(VBoxSFWrite, 76);
72 STRUCT(VBoxSFLock, 76);
73 STRUCT(VBoxSFFlush, 40);
74 STRUCT(VBoxSFList, 112);
75 STRUCT(VBoxSFInformation, 76);
76 STRUCT(VBoxSFRemove, 52);
77 STRUCT(VBoxSFRename, 64);
78 STRUCT(VBoxSFAddMapping, 40);
79 STRUCT(VBoxSFRemoveMapping, 28);
80
81 /*
82 * The summary.
83 */
84 if (!cErrors)
85 RTPrintf("tstShflSizes: SUCCESS\n");
86 else
87 RTPrintf("tstShflSizes: FAILURE - %d errors\n", cErrors);
88 return !!cErrors;
89}
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