Exemplo n.º 1
0
Variant NEVER_INLINE c_SoapFault::ifa___construct(MethodCallPackage &mcp, int count, INVOKE_FEW_ARGS_IMPL_ARGS) {
  if (UNLIKELY(mcp.obj == 0)) {
    return ObjectData::ifa_dummy(mcp, count, INVOKE_FEW_ARGS_PASS_ARGS, ifa___construct, coo_SoapFault);
  }
  c_SoapFault *self ATTRIBUTE_UNUSED (static_cast<c_SoapFault*>(mcp.obj));
  if (UNLIKELY(count < 2)) return throw_wrong_arguments("SoapFault::__construct", count, 2, 6, 2);
  CVarRef arg0(a0);
  CVarRef arg1(a1);
  if (count <= 2) return (self->t___construct(arg0, arg1), null);
  CVarRef arg2(a2);
  if (count <= 3) return (self->t___construct(arg0, arg1, arg2), null);
  CVarRef arg3(a3);
  if (count <= 4) return (self->t___construct(arg0, arg1, arg2, arg3), null);
  CVarRef arg4(a4);
  if (count <= 5) return (self->t___construct(arg0, arg1, arg2, arg3, arg4), null);
  CVarRef arg5(a5);
  return (self->t___construct(arg0, arg1, arg2, arg3, arg4, arg5), null);
}
Exemplo n.º 2
0
TInt ClientThread(TAny* aTestMode)
//
// Passed as the first client thread - signals the server to do several tests
//
	{
	// Create the message arguments to be pinned.  Should be one of each type of
	// descriptor to test that the pinning code can correctly pin each type 
	// descriptor data.  Each descriptor's data should in a separate page in 
	// thread's stack to ensure that access to each argument will cause a 
	// separate page fault.

	TUint8 argBufs[KPageSize*(6+2)]; // enough for 6 whole pages
	TUint8* argBuf0 = (TUint8*)(TUintPtr(argBufs+gPageMask)&~gPageMask);
	TUint8* argBuf1 = argBuf0+KPageSize;
	TUint8* argBuf2 = argBuf1+KPageSize;
	TUint8* argBuf3 = argBuf2+KPageSize;
	TUint8* argBuf4 = argBuf3+KPageSize;
	TUint8* argBuf5 = argBuf4+KPageSize;

	argBuf0[0]='a'; argBuf0[1]='r'; argBuf0[2]='g'; argBuf0[3]='0'; argBuf0[4]='\0';
	TPtr8 arg0(argBuf0, 5, 20);

	TBufC8<5>& arg1 = *(TBufC8<5>*)argBuf1;
	new (&arg1) TBufC8<5>((const TUint8*)"arg1");

	argBuf2[0]='a'; argBuf2[1]='r'; argBuf2[2]='g'; argBuf2[3]='1'; argBuf2[4]='\0';
	TPtrC8 arg2((const TUint8*)argBuf2);

	TBuf8<50>& arg3 = *(TBuf8<50>*)argBuf3;
	new (&arg3) TBuf8<50>((const TUint8*)"arg3");

	// For some tests use this 5th and final type of descriptor.
	HBufC8* argTmp = HBufC8::New(7);
	*argTmp = (const TUint8*)"argTmp";
	RBuf8 argTmpBuf(argTmp);

	// Need a couple of extra writable argments
	argBuf4[0]='a'; argBuf4[1]='r'; argBuf4[2]='g'; argBuf4[3]='4'; argBuf4[4]='\0';
	TPtr8 arg4(argBuf4, 5, 20);
	argBuf5[0]='a'; argBuf5[1]='r'; argBuf5[2]='g'; argBuf5[3]='5'; argBuf5[4]='\0';
	TPtr8 arg5(argBuf5, 5, 20);

	RTest test(_L("T_SVRPINNING...client"));
	RSession session;
	TInt r = session.PublicCreateSession(_L("CTestServer"),5);
	if (r != KErrNone)
		{
		gSem.Signal();
		test(0);
		}

	switch((TInt)aTestMode)
		{
		case CTestSession::ETestRdPinAll:
			test.Printf(_L("Test pinning all args\n"));
			r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs());
			break;

		case CTestSession::ETestRdUnpin3:
			test.Printf(_L("Read Arg3 unpinned\n"));
			r = session.PublicSendReceive(CTestSession::ETestRdUnpin3, TIpcArgs(&arg0, argTmp, &argTmpBuf, &arg3).PinArgs(ETrue, ETrue, ETrue, EFalse));
			break;

		case CTestSession::ETestRdUnpin2:
			test.Printf(_L("Read Arg2 unpinned\n"));
			r = session.PublicSendReceive(CTestSession::ETestRdUnpin2, TIpcArgs(argTmp, &arg1, &arg2, &arg3).PinArgs(ETrue, ETrue, EFalse,  ETrue));
			break;

		case CTestSession::ETestRdUnpin1:
			test.Printf(_L("Read Arg1 unpinned\n"));
			r = session.PublicSendReceive(CTestSession::ETestRdUnpin1, TIpcArgs(&argTmpBuf, &arg1, &arg2, &arg3).PinArgs(ETrue, EFalse,  ETrue,  ETrue));
			break;

		case CTestSession::ETestRdUnpin0:
			test.Printf(_L("Read Arg0 unpinned\n"));
			r = session.PublicSendReceive(CTestSession::ETestRdUnpin0, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs(EFalse, ETrue, ETrue, ETrue));
			break;

		case CTestSession::ETestPinDefault:
			test.Printf(_L("Test the default pinning policy of this server\n"));
			r = session.PublicSendReceive(CTestSession::ETestPinDefault, TIpcArgs(&arg0, &arg1, &arg2, argTmp));
			break;

		case CTestSession::ETestWrPinAll:
			test.Printf(_L("Test writing to pinned descriptors\n"));
			r = session.PublicSendReceive(CTestSession::ETestWrPinAll, TIpcArgs(&arg0, &arg3, &arg4, &arg5).PinArgs(ETrue, ETrue, ETrue, ETrue));
			// Verify the index of each argument has been written to each descriptor.
			{
			TUint maxLength = arg0.MaxLength();
			test_Equal(maxLength, arg0.Length());
			TUint j = 0;
			for (; j < maxLength; j++)
				test_Equal(0, arg0[j]);
			maxLength = arg3.MaxLength();
			test_Equal(maxLength, arg3.Length());
			for (j = 0; j < maxLength; j++)
				test_Equal(1, arg3[j]);
			maxLength = arg4.MaxLength();
			test_Equal(maxLength, arg4.Length());
			for (j = 0; j < maxLength; j++)
				test_Equal(2, arg4[j]);
			maxLength = arg5.MaxLength();
			test_Equal(maxLength, arg5.Length());
			for (j = 0; j < maxLength; j++)
				test_Equal(3, arg5[j]);
			}
			break;

		case CTestSession::ETestWrPinNone:
			test.Printf(_L("Test writing to unpinned descriptors\n"));
			r = session.PublicSendReceive(CTestSession::ETestWrPinNone, TIpcArgs(&arg0, &arg3, &arg4, &arg5).PinArgs(EFalse, EFalse, EFalse, EFalse));
			// Verify the index of each argument has been written to each descriptor.
			// Unless this is a pinnning server than the thread will be panicked before we reach there.
			{
			TUint maxLength = arg0.MaxLength();
			test_Equal(maxLength, arg0.Length());
			TUint j = 0;
			for (j = 0; j < maxLength; j++)
				test_Equal(0, arg0[j]);
			maxLength = arg3.MaxLength();
			test_Equal(maxLength, arg3.Length());
			for (j = 0; j < maxLength; j++)
				test_Equal(1, arg3[j]);
			maxLength = arg4.MaxLength();
			test_Equal(maxLength, arg4.Length());
			for (j = 0; j < maxLength; j++)
				test_Equal(2, arg4[j]);
			maxLength = arg5.MaxLength();
			test_Equal(maxLength, arg5.Length());
			for (j = 0; j < maxLength; j++)
				test_Equal(3, arg5[j]);
			}
			break;

		case CTestSession::ETestDeadServer:
			test.Printf(_L("Test pinning to dead server\n"));
			gSem.Signal();
			gSem1.Wait();
			r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs());
			break;

		case CTestSession::ETestPinOOM:
			test.Printf(_L("Pinning OOM tests\n"));
			__KHEAP_MARK;
			const TUint KMaxKernelAllocations = 1024;
			TUint i;
			r = KErrNoMemory;
			for (i = 0; i < KMaxKernelAllocations && r == KErrNoMemory; i++)
				{
				__KHEAP_FAILNEXT(i);
				r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs());
				__KHEAP_RESET;
				}
			test.Printf(_L("SendReceive took %d tries\n"),i);
			test_KErrNone(r);

			__KHEAP_MARKEND;
			break;
		}

	session.Close();
	test.Close();
	return r;
	}