tstPDMAsyncCompletion.cpp revision a0f8619bc2bbe3614578c21b5b50a88d2841e7aa
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/* $Id$ */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/** @file
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * PDM Asynchronous Completion Testcase.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync *
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * This testcase is for testing the async completion interface.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * It implements a file copy program which uses the interface to copy the data.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync *
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Use: ./tstPDMAsyncCompletion <source> <destination>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync/*
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * Copyright (C) 2008-2009 Sun Microsystems, Inc.
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync *
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * available from http://www.virtualbox.org. This file is free software;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * you can redistribute it and/or modify it under the terms of the GNU
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * General Public License (GPL) as published by the Free Software
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync *
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * additional information or have any questions.
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync */
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/*******************************************************************************
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync* Header Files *
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync*******************************************************************************/
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define LOG_GROUP LOG_GROUP_PDM_ASYNC_COMPLETION
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include "../VMInternal.h" /* UVM */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/vm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/uvm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/pdmasynccompletion.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/vmm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/cpum.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/err.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/log.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/pdmapi.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/alloc.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/asm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/assert.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/file.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/initterm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/semaphore.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/stream.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/string.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/thread.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define TESTCASE "tstPDMAsyncCompletion"
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Number of simultaneous active tasks.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define NR_TASKS 80
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define BUFFER_SIZE 4096 /* 4K */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/* Buffers to store data in .*/
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncuint8_t *g_AsyncCompletionTasksBuffer[NR_TASKS];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncPPDMASYNCCOMPLETIONTASK g_AsyncCompletionTasks[NR_TASKS];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncvolatile uint32_t g_cTasksLeft;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncRTSEMEVENT g_FinishedEventSem;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncvoid pfnAsyncTaskCompleted(PVM pVM, void *pvUser, void *pvUser2)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync{
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync LogFlow((TESTCASE ": %s: pVM=%p pvUser=%p pvUser2=%p\n", __FUNCTION__, pVM, pvUser, pvUser2));
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync uint32_t cTasksStillLeft = ASMAtomicDecU32(&g_cTasksLeft);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (!cTasksStillLeft)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* All tasks processed. Wakeup main. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTSemEventSignal(g_FinishedEventSem);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync}
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncint main(int argc, char *argv[])
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync{
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync int rcRet = 0; /* error count */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync int rc = VINF_SUCCESS;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PPDMASYNCCOMPLETIONENDPOINT pEndpointSrc, pEndpointDst;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTR3InitAndSUPLib();
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (argc != 3)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Usage is ./tstPDMAsyncCompletion <source> <dest>\n");
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync return 1;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PVM pVM;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = VMR3Create(1, NULL, NULL, NULL, NULL, &pVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PPDMASYNCCOMPLETIONTEMPLATE pTemplate;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Little hack to avoid the VM_ASSERT_EMT assertion.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTTlsSet(pVM->pUVM->vm.s.idxTLS, &pVM->pUVM->aCpus[0]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync pVM->pUVM->aCpus[0].pUVM = pVM->pUVM;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync pVM->pUVM->aCpus[0].vm.s.NativeThreadEMT = RTThreadNativeSelf();
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Create the template.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionTemplateCreateInternal(pVM, &pTemplate, pfnAsyncTaskCompleted, NULL, "Test");
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_FAILURE(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Error while creating the template!! rc=%d\n", rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync return 1;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Create event semaphor.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = RTSemEventCreate(&g_FinishedEventSem);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Create the temporary buffers.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync int i;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync for (i=0; i < NR_TASKS; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync g_AsyncCompletionTasksBuffer[i] = (uint8_t *)RTMemAllocZ(BUFFER_SIZE);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (!g_AsyncCompletionTasksBuffer[i])
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": out of memory!\n");
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rcRet++;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync return rcRet;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Create the destination as the async completion API can't do this. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTFILE FileTmp;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = RTFileOpen(&FileTmp, argv[2], RTFILE_O_READWRITE | RTFILE_O_OPEN_CREATE);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_FAILURE(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Error while creating the destination!! rc=%d\n", rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync return 1;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rcRet++;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync return rcRet;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTFileClose(FileTmp);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Create our file endpoint */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionEpCreateForFile(&pEndpointSrc, argv[1], 0, pTemplate);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionEpCreateForFile(&pEndpointDst, argv[2], 0, pTemplate);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3PowerOn(pVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Wait for all threads to finish initialization. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTThreadSleep(100);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync int fReadPass = true;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync uint64_t cbSrc, cbLeft;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t offSrc = 0;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t offDst = 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync uint32_t cTasksUsed = 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionEpGetSize(pEndpointSrc, &cbSrc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Copy the data. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync for (;;)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (fReadPass)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync cTasksUsed = (BUFFER_SIZE * NR_TASKS) <= (cbSrc - offSrc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync ? NR_TASKS
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync : ((cbSrc - offSrc) / BUFFER_SIZE)
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync + ((cbSrc - offSrc) % BUFFER_SIZE) > 0
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync ? 1
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync : 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync g_cTasksLeft = cTasksUsed;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync for (uint32_t i = 0; i < cTasksUsed; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t cbRead = ((size_t)offSrc + BUFFER_SIZE) <= cbSrc ? BUFFER_SIZE : cbSrc - offSrc;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMDATASEG DataSeg;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.pvSeg = g_AsyncCompletionTasksBuffer[i];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.cbSeg = cbRead;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync rc = PDMR3AsyncCompletionEpRead(pEndpointSrc, offSrc, &DataSeg, 1, cbRead, NULL,
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync &g_AsyncCompletionTasks[i]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync offSrc += cbRead;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync if (offSrc == cbSrc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync break;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync g_cTasksLeft = cTasksUsed;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync for (uint32_t i = 0; i < cTasksUsed; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t cbWrite = (offDst + BUFFER_SIZE) <= cbSrc ? BUFFER_SIZE : cbSrc - offDst;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMDATASEG DataSeg;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.pvSeg = g_AsyncCompletionTasksBuffer[i];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.cbSeg = cbWrite;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync rc = PDMR3AsyncCompletionEpWrite(pEndpointDst, offDst, &DataSeg, 1, cbWrite, NULL,
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync &g_AsyncCompletionTasks[i]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync offDst += cbWrite;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync if (offDst == cbSrc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync break;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = RTSemEventWait(g_FinishedEventSem, RT_INDEFINITE_WAIT);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync if (!fReadPass && (offDst == cbSrc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync break;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else if (fReadPass)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync fReadPass = false;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync cTasksUsed = 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync fReadPass = true;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Error querying size of the endpoint!! rc=%d\n", rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rcRet++;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3PowerOff(pVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3AsyncCompletionEpClose(pEndpointDst);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3AsyncCompletionEpClose(pEndpointSrc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = VMR3Destroy(pVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertMsg(rc == VINF_SUCCESS, ("%s: Destroying VM failed rc=%Rrc!!\n", __FUNCTION__, rc));
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Clean up.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync for (uint32_t i = 0; i < NR_TASKS; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTMemFree(g_AsyncCompletionTasksBuffer[i]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": failed to create VM!! rc=%Rrc\n", rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rcRet++;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync return rcRet;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync}
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync