tstRTLocalIpc.cpp revision 5bc5abff9e5f802270cfbae2f9f2f34db58baada
/* $Id$ */
/** @file
* IPRT Testcase - RTLocalIpc.
*/
/*
* Copyright (C) 2013 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 *
*******************************************************************************/
#include <iprt/localipc.h>
typedef struct LOCALIPCTHREADCTX
{
/** The IPC server handle. */
/** The test handle. */
static int testServerListenAndCancel2(const char *pszExecPath)
{
return rc;
}
{
return 0;
}
{
RTTestISub("testServerListenAndCancel");
if (RT_SUCCESS(rc))
{
/* Spawn a simple worker thread and let it listen for incoming connections.
* In the meanwhile we try to cancel the server and see what happens. */
if (RT_SUCCESS(rc))
{
do
{
} while (0);
}
else
}
else
return VINF_SUCCESS;
}
{
int rc;
RTTestPrintf(pCtx->hTest, RTTESTLVL_INFO, "testSessionConnectionThread: Listening for incoming connections ...\n");
for (;;)
{
#ifdef DEBUG_andy
RTTestPrintf(pCtx->hTest, RTTESTLVL_INFO, "testSessionConnectionThread: Listening returned with rc=%Rrc\n", rc);
#endif
if (RT_SUCCESS(rc))
{
RTTestPrintf(pCtx->hTest, RTTESTLVL_INFO, "testSessionConnectionThread: Got new client connection\n");
}
else
break;
}
return rc;
}
{
do
{
RTTEST_CHECK_RC_BREAK(hTest, RTLocalIpcSessionConnect(&clientSession, "tstRTLocalIpcSessionConnection",
0 /* Flags */), VINF_SUCCESS);
} while (0);
}
{
RTTestISub("testSessionConnection");
if (RT_SUCCESS(rc))
{
#if 0
/* Spawn a simple worker thread and let it listen for incoming connections.
* In the meanwhile we try to cancel the server and see what happens. */
if (RT_SUCCESS(rc))
{
do
{
int threadRc;
}
while (0);
}
else
#else
do
{
if (RT_SUCCESS(rc))
{
}
else
} while (0);
#endif
}
else
return VINF_SUCCESS;
}
{
/* Note: We assume argv[2] always contains the actual test type to perform. */
if (rcExit)
return rcExit;
return RTTestSummaryAndDestroy(hTest);
}
{
if ( argc > 2
if (rcExit)
return rcExit;
char szExecPath[RTPATH_MAX];
RTTestISub("Basics");
RTAssertSetMayPanic(false);
#ifdef DEBUG_andy
RTAssertSetQuiet(true);
#endif
/* Server-side. */
RTTESTI_CHECK_RC_RET(RTLocalIpcServerCreate(&ipcServer, "BasicTest", 0 /* Invalid flags */), VERR_INVALID_PARAMETER, 1);
RTTESTI_CHECK_RC_RET(RTLocalIpcServerCreate(&ipcServer, "BasicTest", 1234 /* Invalid flags */), VERR_INVALID_PARAMETER, 1);
/* Basic server creation / destruction. */
RTTESTI_CHECK_RC_RET(RTLocalIpcServerCreate(&ipcServer, "BasicTest", RTLOCALIPC_FLAGS_MULTI_SESSION), VINF_SUCCESS, 1);
/* Client-side (per session). */
RTTESTI_CHECK_RC_RET(RTLocalIpcSessionConnect(&ipcSession, "BasicTest", 1234 /* Invalid flags */), VERR_INVALID_PARAMETER, 1);
/* Basic client creation / destruction. */
RTTESTI_CHECK_RC_RET(RTLocalIpcSessionConnect(&ipcSession, "BasicTest", 0), VERR_FILE_NOT_FOUND, 1);
if (RTTestErrorCount(hTest) == 0)
{
#ifndef DEBUG_andy
#endif
}
/*
* Summary.
*/
return RTTestSummaryAndDestroy(hTest);
}