mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 02:47:31 +09:00
update NSPR to 4.24 and keep NSPR Bug 1586070 and win64 patch intact.
This commit is contained in:
parent
dd094ae552
commit
0b9855b841
487 changed files with 42933 additions and 48679 deletions
|
|
@ -6,10 +6,10 @@
|
|||
/*
|
||||
** File: nameshm1.c -- Test Named Shared Memory
|
||||
**
|
||||
** Description:
|
||||
** Description:
|
||||
** nameshm1 tests Named Shared Memory. nameshm1 performs two tests of
|
||||
** named shared memory.
|
||||
**
|
||||
** named shared memory.
|
||||
**
|
||||
** The first test is a basic test. The basic test operates as a single
|
||||
** process. The process exercises all the API elements of the facility.
|
||||
** This test also attempts to write to all locations in the shared
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
** order.
|
||||
**
|
||||
** Synopsis: nameshm1 [options] [name]
|
||||
**
|
||||
**
|
||||
** Options:
|
||||
** -d Enables debug trace via PR_LOG()
|
||||
** -v Enables verbose mode debug trace via PR_LOG()
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
** mapped as read-only. When this option is specified, the
|
||||
** test should crash with a seg-fault; this is a destructive
|
||||
** test and is considered successful when it seg-faults.
|
||||
**
|
||||
**
|
||||
** -C Causes nameshm1 to start as the client-side of a
|
||||
** client-server pair of processes. Only the instance
|
||||
** of nameshm1 operating as the server-side process should
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
** The client-side uses the shared memory segment created by
|
||||
** the server-side to communicate with the server-side
|
||||
** process.
|
||||
**
|
||||
**
|
||||
** -p <n> Specify the number of iterations the client-server tests
|
||||
** should perform. Default: 1000.
|
||||
**
|
||||
|
|
@ -66,23 +66,16 @@
|
|||
** /lth. Aug-1999.
|
||||
*/
|
||||
|
||||
#include <plgetopt.h>
|
||||
#include <plgetopt.h>
|
||||
#include <nspr.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <private/primpl.h>
|
||||
|
||||
#ifdef SYMBIAN
|
||||
#define SEM_NAME1 "c:\\data\\nameshmSEM1"
|
||||
#define SEM_NAME2 "c:\\data\\nameshmSEM2"
|
||||
#define OPT_NAME "c:\\data\\xxxNSPRshm"
|
||||
#define EXE_NAME "nspr_tests_nameshm1.exe"
|
||||
#else
|
||||
#define SEM_NAME1 "/tmp/nameshmSEM1"
|
||||
#define SEM_NAME2 "/tmp/nameshmSEM2"
|
||||
#define OPT_NAME "/tmp/xxxNSPRshm"
|
||||
#define EXE_NAME "nameshm1"
|
||||
#endif
|
||||
#define SEM_MODE 0666
|
||||
#define SHM_MODE 0666
|
||||
|
||||
|
|
@ -111,7 +104,7 @@ char optName[NameSize] = OPT_NAME;
|
|||
char buf[1024] = "";
|
||||
|
||||
|
||||
static void BasicTest( void )
|
||||
static void BasicTest( void )
|
||||
{
|
||||
PRSharedMemory *shm;
|
||||
char *addr; /* address of shared memory segment */
|
||||
|
|
@ -119,76 +112,76 @@ static void BasicTest( void )
|
|||
PRInt32 rc;
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Begin BasicTest" ));
|
||||
( "nameshm1: Begin BasicTest" ));
|
||||
|
||||
if ( PR_FAILURE == PR_DeleteSharedMemory( optName )) {
|
||||
PR_LOG( lm, msgLevel,
|
||||
("nameshm1: Initial PR_DeleteSharedMemory() failed. No problem"));
|
||||
("nameshm1: Initial PR_DeleteSharedMemory() failed. No problem"));
|
||||
} else
|
||||
PR_LOG( lm, msgLevel,
|
||||
("nameshm1: Initial PR_DeleteSharedMemory() success"));
|
||||
("nameshm1: Initial PR_DeleteSharedMemory() success"));
|
||||
|
||||
|
||||
shm = PR_OpenSharedMemory( optName, optSize, (PR_SHM_CREATE | PR_SHM_EXCL), SHM_MODE );
|
||||
if ( NULL == shm )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RW Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Create: success: %p", shm ));
|
||||
( "nameshm1: RW Create: success: %p", shm ));
|
||||
|
||||
addr = PR_AttachSharedMemory( shm , 0 );
|
||||
if ( NULL == addr )
|
||||
addr = PR_AttachSharedMemory( shm, 0 );
|
||||
if ( NULL == addr )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RW Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Attach: success: %p", addr ));
|
||||
( "nameshm1: RW Attach: success: %p", addr ));
|
||||
|
||||
/* fill memory with i */
|
||||
for ( i = 0; i < optSize ; i++ )
|
||||
{
|
||||
*(addr + i) = i;
|
||||
*(addr + i) = i;
|
||||
}
|
||||
|
||||
rc = PR_DetachSharedMemory( shm, addr );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Detach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RW Detach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Detach: success: " ));
|
||||
( "nameshm1: RW Detach: success: " ));
|
||||
|
||||
rc = PR_CloseSharedMemory( shm );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Close: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RW Close: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Close: success: " ));
|
||||
( "nameshm1: RW Close: success: " ));
|
||||
|
||||
rc = PR_DeleteSharedMemory( optName );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Delete: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RW Delete: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RW Delete: success: " ));
|
||||
( "nameshm1: RW Delete: success: " ));
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
("nameshm1: BasicTest(): Passed"));
|
||||
|
|
@ -203,30 +196,30 @@ static void ReadOnlyTest( void )
|
|||
PRInt32 rc;
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Begin ReadOnlyTest" ));
|
||||
( "nameshm1: Begin ReadOnlyTest" ));
|
||||
|
||||
shm = PR_OpenSharedMemory( optName, optSize, (PR_SHM_CREATE | PR_SHM_EXCL), SHM_MODE);
|
||||
if ( NULL == shm )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RO Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Create: success: %p", shm ));
|
||||
( "nameshm1: RO Create: success: %p", shm ));
|
||||
|
||||
|
||||
roAddr = PR_AttachSharedMemory( shm , PR_SHM_READONLY );
|
||||
if ( NULL == roAddr )
|
||||
roAddr = PR_AttachSharedMemory( shm, PR_SHM_READONLY );
|
||||
if ( NULL == roAddr )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RO Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Attach: success: %p", roAddr ));
|
||||
( "nameshm1: RO Attach: success: %p", roAddr ));
|
||||
|
||||
if ( optWriteRO )
|
||||
{
|
||||
|
|
@ -240,37 +233,37 @@ static void ReadOnlyTest( void )
|
|||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Detach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RO Detach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Detach: success: " ));
|
||||
( "nameshm1: RO Detach: success: " ));
|
||||
|
||||
rc = PR_CloseSharedMemory( shm );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Close: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RO Close: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Close: success: " ));
|
||||
( "nameshm1: RO Close: success: " ));
|
||||
|
||||
rc = PR_DeleteSharedMemory( optName );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Destroy: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: RO Destroy: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: RO Destroy: success: " ));
|
||||
( "nameshm1: RO Destroy: success: " ));
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
("nameshm1: ReadOnlyTest(): Passed"));
|
||||
("nameshm1: ReadOnlyTest(): Passed"));
|
||||
|
||||
return;
|
||||
} /* end ReadOnlyTest() */
|
||||
|
|
@ -280,7 +273,7 @@ static void DoClient( void )
|
|||
PRStatus rc;
|
||||
PRSem *sem1, *sem2;
|
||||
PRSharedMemory *shm;
|
||||
PRUint32 *addr;
|
||||
PRUint32 *addr;
|
||||
PRInt32 i;
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
|
|
@ -296,40 +289,40 @@ static void DoClient( void )
|
|||
if ( NULL == shm )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Create: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: DoClient(): Create: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Create: success: %p", shm ));
|
||||
( "nameshm1: DoClient(): Create: success: %p", shm ));
|
||||
|
||||
addr = PR_AttachSharedMemory( shm , 0 );
|
||||
if ( NULL == addr )
|
||||
addr = PR_AttachSharedMemory( shm, 0 );
|
||||
if ( NULL == addr )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Attach: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: DoClient(): Attach: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Attach: success: %p", addr ));
|
||||
( "nameshm1: DoClient(): Attach: success: %p", addr ));
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "Client found: %s", addr));
|
||||
( "Client found: %s", addr));
|
||||
|
||||
PR_Sleep(PR_SecondsToInterval(4));
|
||||
for ( i = 0 ; i < optPing ; i++ )
|
||||
{
|
||||
rc = PR_WaitSemaphore( sem2 );
|
||||
PR_ASSERT( PR_FAILURE != rc );
|
||||
|
||||
|
||||
(*addr)++;
|
||||
PR_ASSERT( (*addr % 2) == 0 );
|
||||
PR_ASSERT( (*addr % 2) == 0 );
|
||||
if ( optVerbose )
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Client ping: %d, i: %d", *addr, i));
|
||||
( "nameshm1: Client ping: %d, i: %d", *addr, i));
|
||||
|
||||
rc = PR_PostSemaphore( sem1 );
|
||||
PR_ASSERT( PR_FAILURE != rc );
|
||||
|
|
@ -345,25 +338,25 @@ static void DoClient( void )
|
|||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Detach: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: DoClient(): Detach: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Detach: success: " ));
|
||||
( "nameshm1: DoClient(): Detach: success: " ));
|
||||
|
||||
rc = PR_CloseSharedMemory( shm );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Close: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: DoClient(): Close: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: DoClient(): Close: success: " ));
|
||||
( "nameshm1: DoClient(): Close: success: " ));
|
||||
|
||||
return;
|
||||
} /* end DoClient() */
|
||||
|
|
@ -375,45 +368,45 @@ static void ClientServerTest( void )
|
|||
PRProcess *proc;
|
||||
PRInt32 exit_status;
|
||||
PRSharedMemory *shm;
|
||||
PRUint32 *addr;
|
||||
PRUint32 *addr;
|
||||
PRInt32 i;
|
||||
char *child_argv[8];
|
||||
char buf[24];
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Begin ClientServerTest" ));
|
||||
( "nameshm1: Begin ClientServerTest" ));
|
||||
|
||||
rc = PR_DeleteSharedMemory( optName );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Destroy: failed. No problem"));
|
||||
( "nameshm1: Server: Destroy: failed. No problem"));
|
||||
} else
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Destroy: success" ));
|
||||
( "nameshm1: Server: Destroy: success" ));
|
||||
|
||||
|
||||
shm = PR_OpenSharedMemory( optName, optSize, (PR_SHM_CREATE | PR_SHM_EXCL), SHM_MODE);
|
||||
if ( NULL == shm )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: Server: Create: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Create: success: %p", shm ));
|
||||
( "nameshm1: Server: Create: success: %p", shm ));
|
||||
|
||||
addr = PR_AttachSharedMemory( shm , 0 );
|
||||
if ( NULL == addr )
|
||||
addr = PR_AttachSharedMemory( shm, 0 );
|
||||
if ( NULL == addr )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: Server: Attach: Error: %ld. OSError: %ld", PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Attach: success: %p", addr ));
|
||||
( "nameshm1: Server: Attach: success: %p", addr ));
|
||||
|
||||
sem1 = PR_OpenSemaphore( SEM_NAME1, PR_SEM_CREATE, SEM_MODE, 0 );
|
||||
PR_ASSERT( sem1 );
|
||||
|
|
@ -438,7 +431,7 @@ static void ClientServerTest( void )
|
|||
|
||||
*addr = 1;
|
||||
for ( i = 0 ; i < optPing ; i++ )
|
||||
{
|
||||
{
|
||||
rc = PR_WaitSemaphore( sem1 );
|
||||
PR_ASSERT( PR_FAILURE != rc );
|
||||
|
||||
|
|
@ -446,9 +439,9 @@ static void ClientServerTest( void )
|
|||
PR_ASSERT( (*addr % 2) == 1 );
|
||||
if ( optVerbose )
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server pong: %d, i: %d", *addr, i));
|
||||
( "nameshm1: Server pong: %d, i: %d", *addr, i));
|
||||
|
||||
|
||||
|
||||
rc = PR_PostSemaphore( sem2 );
|
||||
PR_ASSERT( PR_FAILURE != rc );
|
||||
}
|
||||
|
|
@ -472,37 +465,37 @@ static void ClientServerTest( void )
|
|||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Detach: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: Server: Detach: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Detach: success: " ));
|
||||
( "nameshm1: Server: Detach: success: " ));
|
||||
|
||||
rc = PR_CloseSharedMemory( shm );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Close: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: Server: Close: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Close: success: " ));
|
||||
( "nameshm1: Server: Close: success: " ));
|
||||
|
||||
rc = PR_DeleteSharedMemory( optName );
|
||||
if ( PR_FAILURE == rc )
|
||||
{
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Destroy: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
( "nameshm1: Server: Destroy: Error: %ld. OSError: %ld",
|
||||
PR_GetError(), PR_GetOSError()));
|
||||
failed_already = 1;
|
||||
return;
|
||||
}
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Server: Destroy: success" ));
|
||||
( "nameshm1: Server: Destroy: success" ));
|
||||
|
||||
return;
|
||||
} /* end ClientServerTest() */
|
||||
|
|
@ -516,61 +509,67 @@ int main(int argc, char **argv)
|
|||
PLOptStatus os;
|
||||
PLOptState *opt = PL_CreateOptState(argc, argv, "Cdvw:s:p:i:");
|
||||
|
||||
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
|
||||
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
|
||||
{
|
||||
if (PL_OPT_BAD == os) continue;
|
||||
if (PL_OPT_BAD == os) {
|
||||
continue;
|
||||
}
|
||||
switch (opt->option)
|
||||
{
|
||||
case 'v': /* debug mode */
|
||||
optVerbose = 1;
|
||||
case 'v': /* debug mode */
|
||||
optVerbose = 1;
|
||||
/* no break! fall into debug option */
|
||||
case 'd': /* debug mode */
|
||||
debug = 1;
|
||||
msgLevel = PR_LOG_DEBUG;
|
||||
break;
|
||||
case 'w': /* try writing to memory mapped read-only */
|
||||
optWriteRO = 1;
|
||||
break;
|
||||
case 'C':
|
||||
optClient = 1;
|
||||
break;
|
||||
case 's':
|
||||
optSize = atol(opt->value) * 1024;
|
||||
break;
|
||||
case 'p':
|
||||
optPing = atol(opt->value);
|
||||
break;
|
||||
case 'i':
|
||||
optClientIterations = atol(opt->value);
|
||||
break;
|
||||
default:
|
||||
strcpy( optName, opt->value );
|
||||
break;
|
||||
case 'd': /* debug mode */
|
||||
debug = 1;
|
||||
msgLevel = PR_LOG_DEBUG;
|
||||
break;
|
||||
case 'w': /* try writing to memory mapped read-only */
|
||||
optWriteRO = 1;
|
||||
break;
|
||||
case 'C':
|
||||
optClient = 1;
|
||||
break;
|
||||
case 's':
|
||||
optSize = atol(opt->value) * 1024;
|
||||
break;
|
||||
case 'p':
|
||||
optPing = atol(opt->value);
|
||||
break;
|
||||
case 'i':
|
||||
optClientIterations = atol(opt->value);
|
||||
break;
|
||||
default:
|
||||
strcpy( optName, opt->value );
|
||||
break;
|
||||
}
|
||||
}
|
||||
PL_DestroyOptState(opt);
|
||||
PL_DestroyOptState(opt);
|
||||
}
|
||||
|
||||
lm = PR_NewLogModule("Test"); /* Initialize logging */
|
||||
|
||||
|
||||
PR_LOG( lm, msgLevel,
|
||||
( "nameshm1: Starting" ));
|
||||
( "nameshm1: Starting" ));
|
||||
|
||||
if ( optClient )
|
||||
{
|
||||
DoClient();
|
||||
} else {
|
||||
BasicTest();
|
||||
if ( failed_already != 0 )
|
||||
if ( failed_already != 0 ) {
|
||||
goto Finished;
|
||||
}
|
||||
ReadOnlyTest();
|
||||
if ( failed_already != 0 )
|
||||
if ( failed_already != 0 ) {
|
||||
goto Finished;
|
||||
}
|
||||
ClientServerTest();
|
||||
}
|
||||
|
||||
Finished:
|
||||
if ( debug ) printf("%s\n", (failed_already)? "FAIL" : "PASS" );
|
||||
if ( debug ) {
|
||||
printf("%s\n", (failed_already)? "FAIL" : "PASS" );
|
||||
}
|
||||
return( (failed_already)? 1 : 0 );
|
||||
} /* main() */
|
||||
/* end instrumt.c */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue