tstRTMp-1.cpp revision 32256c38ae0392ab7bcae4f2cdde2807bf6f6d5f
/* $Id$ */
/** @file
* IPRT Testcase - RTMp.
*/
/*
* Copyright (C) 2008-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
int main()
{
if (rcExit != RTEXITCODE_SUCCESS)
return rcExit;
/*
* Present and possible CPUs.
*/
if (cCpus > 0)
else
{
RTTestIFailed("RTMpGetCount returned zero");
cCpus = 1;
}
if (cCoreCpus > 0)
else
{
RTTestIFailed("RTMpGetCoreCount returned zero");
cCoreCpus = 1;
}
{
{
{
if (RTMpIsCpuPresent(idCpu))
else
{
if (!RTMpIsCpuOnline(idCpu))
else
{
RTTestIFailed("Cpu with index %d is report as !RTIsCpuPresent while RTIsCpuOnline returns true!\n", iCpu);
}
}
if (!RTMpIsCpuPossible(idCpu))
}
else if (RTMpIsCpuPossible(idCpu))
else if (RTMpGetCurFrequency(idCpu) != 0)
else if (RTMpGetMaxFrequency(idCpu) != 0)
}
}
else
{
RTCpuSetEmpty(&Set);
}
/*
* Online CPUs.
*/
if (cCpusOnline > 0)
{
if (cCpusOnline <= cCpus)
else
{
cCpusOnline = cCpus;
}
}
else
{
cCpusOnline = 1;
}
{
if (RTCpuSetCount(&SetOnline) <= 0)
RTTestIFailed("RTMpGetOnlineSet returned an empty set!\n");
RTTestIFailed("RTMpGetOnlineSet returned a too high value; %d, expected <= %d\n",
{
RTTestIPrintf(RTTESTLVL_ALWAYS, "%2d - id %d: %u/%u MHz %s\n", iCpu, (int)idCpu, RTMpGetCurFrequency(idCpu),
}
/* There isn't any sane way of testing RTMpIsCpuOnline really... :-/ */
}
else
/*
* Present CPUs.
*/
if (cCpusPresent > 0)
{
if ( cCpusPresent <= cCpus
&& cCpusPresent >= cCpusOnline)
else
RTTestIFailed("RTMpGetPresentCount -> %d, expected <= %d and >= %d\n",
}
else
{
cCpusPresent = 1;
}
if (pSet == &SetPresent)
{
if (RTCpuSetCount(&SetPresent) <= 0)
RTTestIFailed("RTMpGetPresentSet returned an empty set!\n");
RTTestIFailed("RTMpGetPresentSet returned a bad value; %d, expected = %d\n",
{
RTTestIPrintf(RTTESTLVL_ALWAYS, "%2d - id %d: %u/%u MHz %s\n", iCpu, (int)idCpu, RTMpGetCurFrequency(idCpu),
}
/* There isn't any sane way of testing RTMpIsCpuPresent really... :-/ */
}
else
/* Find an online cpu for the next test. */
if (RTMpIsCpuOnline(idCpuOnline))
break;
/*
* Quick test of RTMpGetDescription.
*/
char szBuf[64];
if (RT_SUCCESS(rc))
{
if (rc != VERR_BUFFER_OVERFLOW)
if (RT_FAILURE(rc))
}
else
return RTTestSummaryAndDestroy(hTest);
}