tstShflSizes.cpp revision 19edb133387698f301b529248daa3719fe0d7389
2N/A/** @file
2N/A *
2N/A * Testcase for shared folder structure sizes.
2N/A * Run this on Linux and Windows, then compare.
2N/A */
2N/A
2N/A/*
2N/A * Copyright (C) 2006-2007 innotek GmbH
2N/A *
2N/A * This file is part of VirtualBox Open Source Edition (OSE), as
2N/A * available from http://www.virtualbox.org. This file is free software;
2N/A * you can redistribute it and/or modify it under the terms of the GNU
2N/A * General Public License (GPL) as published by the Free Software
2N/A * Foundation, in version 2 as it comes in the "COPYING" file of the
2N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2N/A */
2N/A
2N/A/*******************************************************************************
2N/A* Header Files *
2N/A*******************************************************************************/
2N/A#include <VBox/shflsvc.h>
2N/A#include <iprt/stream.h>
2N/A#include <iprt/string.h>
2N/A
2N/A#define STRUCT(t, size) \
2N/A do { \
2N/A if (fPrintChecks) \
2N/A RTPrintf(" STRUCT(" #t ", %d);\n", (int)sizeof(t)); \
2N/A else if ((size) != sizeof(t)) \
2N/A { \
2N/A RTPrintf("%30s: %d expected %d!\n", #t, (int)sizeof(t), (size)); \
2N/A cErrors++; \
} \
else if (!fQuiet)\
RTPrintf("%30s: %d\n", #t, (int)sizeof(t)); \
} while (0)
int main(int argc, char **argv)
{
unsigned cErrors = 0;
/*
* Prints the code below if any argument was giving.
*/
bool fQuiet = argc == 2 && !strcmp(argv[1], "quiet");
bool fPrintChecks = !fQuiet && argc != 1;
RTPrintf("tstShflSizes: TESTING\n");
/*
* The checks.
*/
STRUCT(SHFLROOT, 4);
STRUCT(SHFLHANDLE, 8);
STRUCT(SHFLSTRING, 6);
STRUCT(SHFLCREATERESULT, 4);
STRUCT(SHFLCREATEPARMS, 108);
STRUCT(SHFLMAPPING, 8);
STRUCT(SHFLDIRINFO, 128);
STRUCT(SHFLVOLINFO, 40);
STRUCT(VBoxSFQueryMappings, 52);
STRUCT(VBoxSFQueryMapName, 40); /* this was changed from 52 in 21976 after VBox-1.4) */
STRUCT(VBoxSFMapFolder_Old, 52);
STRUCT(VBoxSFMapFolder, 64);
STRUCT(VBoxSFUnmapFolder, 28);
STRUCT(VBoxSFCreate, 52);
STRUCT(VBoxSFClose, 40);
STRUCT(VBoxSFRead, 76);
STRUCT(VBoxSFWrite, 76);
STRUCT(VBoxSFLock, 76);
STRUCT(VBoxSFFlush, 40);
STRUCT(VBoxSFList, 112);
STRUCT(VBoxSFInformation, 76);
STRUCT(VBoxSFRemove, 52);
STRUCT(VBoxSFRename, 64);
STRUCT(VBoxSFAddMapping, 40);
STRUCT(VBoxSFRemoveMapping, 28);
/*
* The summary.
*/
if (!cErrors)
RTPrintf("tstShflSizes: SUCCESS\n");
else
RTPrintf("tstShflSizes: FAILURE - %d errors\n", cErrors);
return !!cErrors;
}