tstRTMemWipe.cpp revision 919546b97ea2948f2372a4bff52712e11fca685d
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * IPRT Testcase - RTMemWipe* functions.
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * Copyright (C) 2012 Oracle Corporation
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * available from http://www.virtualbox.org. This file is free software;
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * you can redistribute it and/or modify it under the terms of the GNU
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * General Public License (GPL) as published by the Free Software
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * The contents of this file may alternatively be used under the terms
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * of the Common Development and Distribution License Version 1.0
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * VirtualBox OSE distribution, in which case the provisions of the
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * CDDL are applicable instead of those of the GPL.
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * You may elect to license modified versions of this file under the
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync * terms and conditions of either the GPL or the CDDL or both.
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync/*******************************************************************************
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync* Header Files *
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync*******************************************************************************/
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync/*******************************************************************************
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync* Global Variables *
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync*******************************************************************************/
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync size_t cbAlloc = RTRandS32Ex(1, _1M) * sizeof(uint8_t);
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Testing wipe #%.02RU32 (%u bytes) ...\n",
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync RTTestIFailed("No memory for first buffer (%z bytes)\n",
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync RTTestIFailed("No memory for second buffer (%z bytes)\n",
919546b97ea2948f2372a4bff52712e11fca685dvboxsync RTMemWipeThoroughly(pvWipe, RT_MIN(cbAlloc, cbWipeRand), p /* Passes */);
38c9d146ffa87a680413ba8191eed0e98e4323acvboxsync RTTestIFailed("Memory blocks must differ (%z bytes, 0x%p vs. 0x%p)!\n",