示例#1
0
static void
test_threadex(void) {
	struct ymsglooper *ml;
	struct ymsghandler *mh;
	srand(time(NULL));

	ml = ymsglooper_start_looper_thread(FALSE);
	mh = ymsghandler_create(ml, NULL); /* use default handle */

	tc1(mh);
	tc2(mh);
	tc3(mh);
	tc4(mh);

	/* clean up all others */
	ymsghandler_destroy(mh);
	ymsglooper_stop(ml);
	while (YMSGLOOPER_TERMINATED != ymsglooper_get_state(ml))
		usleep(10*1000);
	ymsglooper_destroy(ml);
}
示例#2
0
// convert surface coordinates to texture coordinates, based on
// the values in the texture entry.  probably should be
// integrated with getGeometryVolume() for its texture coordinate
// generation - but i'll leave that to someone more familiar
// with the implications.
LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, LLVector3 position, LLVector3 normal)
{
	LLVector2 tc = surface_coord;
	
	const LLTextureEntry *tep = getTextureEntry();

	if (tep == NULL)
	{
		// can't do much without the texture entry
		return surface_coord;
	}

	//VECTORIZE THIS
	// see if we have a non-default mapping
    U8 texgen = getTextureEntry()->getTexGen();
	if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
	{
		LLVector4a& center = *(mDrawablep->getVOVolume()->getVolume()->getVolumeFace(mTEOffset).mCenter);
		
		LLVector4a volume_position;
		volume_position.load3(mDrawablep->getVOVolume()->agentPositionToVolume(position).mV);
		
		if (!mDrawablep->getVOVolume()->isVolumeGlobal())
		{
			LLVector4a scale;
			scale.load3(mVObjp->getScale().mV);
			volume_position.mul(scale);
		}
		
		LLVector4a volume_normal;
		volume_normal.load3(mDrawablep->getVOVolume()->agentDirectionToVolume(normal).mV);
		volume_normal.normalize3fast();
		
		switch (texgen)
		{
		case LLTextureEntry::TEX_GEN_PLANAR:
			planarProjection(tc, volume_normal, center, volume_position);
			break;
		case LLTextureEntry::TEX_GEN_SPHERICAL:
			sphericalProjection(tc, volume_normal, center, volume_position);
			break;
		case LLTextureEntry::TEX_GEN_CYLINDRICAL:
			cylindricalProjection(tc, volume_normal, center, volume_position);
			break;
		default:
			break;
		}		
	}

	if (mTextureMatrix)	// if we have a texture matrix, use it
	{
		LLVector3 tc3(tc);
		tc3 = tc3 * *mTextureMatrix;
		tc = LLVector2(tc3);
	}
	
	else // otherwise use the texture entry parameters
	{
		xform(tc, cos(tep->getRotation()), sin(tep->getRotation()),
			  tep->mOffsetS, tep->mOffsetT, tep->mScaleS, tep->mScaleT);
	}

	
	return tc;
}
示例#3
0
    /**************************************************************************
    **
    **              Main. Starts client and executes each test.
    **
    ***************************************************************************/
int main(int argc, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE");
    CIMClient client;

#ifdef TEST_GLOBMATCH
    testGlobMatch();
#endif

    String hostName = "";

    if (argc == 2)
    {
        hostName = argv[1];
    }

    if (!connectToHost(client, hostName))
    {
        cerr << "Error connection to host " << hostName << " failed." << endl;
        PEGASUS_ASSERT(false);
    }

    /**********************************************************************
    **
    **          Execute each individual test.  Each test is a single
    **          testEnumSequence instance where the paremeters are first
    **          set with calls to particular functions and then
    **          the test is executed with a call for each operation
    **          to be executed.  Multiple steps may be executed by
    **          calling, the various pull operations after the
    **          open has been executed.
    **
    **          As an option, test parameters
    **          can be reset and a testEnumSequence instance reused.
    **
    **********************************************************************/

    testEnumSequence tc(client, "test/TestProvider");
    tc.setTestName("Invalid Classname test");
    tc.setCIMException(CIM_ERR_INVALID_CLASS);
    tc._className =  "junk";
    PEGASUS_ASSERT(tc.executeEnumerateCalls());

    // Test invalid Object Path tests
    tc.setTestName("Invalid Classname in open associator/reference call");
    tc._cimObjectName = "junk.id=1";
    tc.setCIMException(CIM_ERR_INVALID_PARAMETER);
    PEGASUS_ASSERT(tc.executeAssociationCalls());

    // test Filter parameters on all operations
    tc.setTestName("Filter Parameter test- Using incorrect filterQuery");
    tc._className =  "CMPI_TEST_Person";
    tc._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
    tc._filterQuery="abc";
    tc.setCIMException(CIM_ERR_FAILED);
    PEGASUS_ASSERT(tc.executeAllOpenCalls());

#ifdef PEGASUS_ENABLE_FQL
    tc.setCIMException(CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED);
#else
    tc.setCIMException(CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED);
#endif
    tc.setTestName("Filter Instances Parameter test Using filter wth Bad Lang");
    tc._filterQueryLanguage="WQL";
    PEGASUS_ASSERT(tc.executeAllOpenInstanceCalls());

    tc.setTestName("Filter Paths Parameter test- Using filter and Language");
    tc._filterQueryLanguage="WQL";
    tc.setCIMException(CIM_ERR_FILTERED_ENUMERATION_NOT_SUPPORTED);
    PEGASUS_ASSERT(tc.executeAllOpenPathCalls());

    tc.setTestName("Filter Parameter test- Using filterQuery Language Only");
    tc._filterQuery="";
    tc.setCIMException(CIM_ERR_FAILED);
    PEGASUS_ASSERT(tc.executeAllOpenCalls());

    tc.setTestName("MaxObjectCount GT max allowed by Server");
    tc._filterQuery="";
    tc._filterQueryLanguage="";
    tc._maxObjectCount = 1000000;
    tc.setCIMException(CIM_ERR_INVALID_PARAMETER);
    PEGASUS_ASSERT(tc.executeAllOpenCalls());

    // ContinueOnError test. Should always error out
    tc.setTestName("ContinueOnError should always return exception");
    tc._maxObjectCount = 100;
    tc._continueOnError = true;
    tc.setCIMException(CIM_ERR_NOT_SUPPORTED);
    tc.setCIMExceptionMessage("ContinueOnError = true argument not supported");
    PEGASUS_ASSERT(tc.executeAllOpenCalls());
    tc.setCIMExceptionMessage("");

    //
    // Test invalid pull type not in accord with open type
    //
    {
        testEnumSequence tc3(client, "test/TestProvider");
        tc3.setTestName("OpenEnumerate followed by Incorrect Pull operation");
        tc3._className =  "CMPI_TEST_Person";
        tc3._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tc3._maxObjectCount = 0;
        PEGASUS_ASSERT(tc3.openEnumerateInstances());
        tc3.setCIMException(CIM_ERR_FAILED);
        tc3.setExpectErrorResponseOnly();
        PEGASUS_ASSERT(tc3.pullInstancePaths());

        // Now request the corect response
        tc3.setCIMException(CIM_ERR_INVALID_ENUMERATION_CONTEXT);
        tc3.setExpectErrorResponseOnly();
        PEGASUS_ASSERT(tc3.pullInstancesWithPath());
        tc3.setExpectGoodResponse();
    }
    {
        testEnumSequence tc3(client, "test/TestProvider");
        tc3.setTestName(
            "OpenEnumeratePaths followed by Incorrect Pull operation");
        tc3._className =  "CMPI_TEST_Person";
        tc3._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tc3._maxObjectCount = 0;
        PEGASUS_ASSERT(tc3.openEnumerateInstancePaths());
        tc3.setCIMException(CIM_ERR_FAILED);
        tc3.setExpectErrorResponseOnly();
        PEGASUS_ASSERT(tc3.pullInstancesWithPath());

        // Now request the corect response and expect error response
        tc3.setCIMException(CIM_ERR_INVALID_ENUMERATION_CONTEXT);
        tc3.setExpectErrorResponseOnly();
        PEGASUS_ASSERT(tc3.pullInstancePaths());
        tc3.setExpectGoodResponse();
    }

    // Test for a complete sequence that works.
    testEnumSequence tcgood(client, "test/TestProvider");
    tcgood.setTestName("Good complete open/pull response");
    tcgood._className =  "CMPI_TEST_Person";
    tcgood._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
    PEGASUS_ASSERT(tcgood.openEnumerateInstances());
    while(tcgood._endOfSequence == false)
    {
        PEGASUS_ASSERT(tcgood.pullInstancesWithPath());
    }

    /*  Interoperation Timeout tests.  Note that these tests cannot be
        completely confirmed since we have no way to test if the
        EnumerationContext is actually released, just that we get the
        error back
    */
    // test openEnumerateInstances and pull after timeout.
    tc.setTestName("Interoperation Timeout upon Pull");
    tc._className =  "CMPI_TEST_Person";
    tc._maxObjectCount = 1;
    tc._operationTimeout = 7;

    // execute the open call and then wait past timer to test for timeout
    PEGASUS_ASSERT(tc.openEnumerateInstances());
    VCOUT << "Wait for open operation to timeout. This should wait about"
             " 10 Seconds, return error, and then pass test." << endl;
    System::sleep(10);

    tc.setCIMException(CIM_ERR_INVALID_ENUMERATION_CONTEXT);
    PEGASUS_ASSERT(tc.pullInstancesWithPath());
    VCOUT << "Interoperation Timeout test passed. Note that we"
             " cannot do complete test without enum context table inspsection"
          << endl;

    //
    // Test for maximum simultaneous 0 object requests before reject
    //
    // Tests for enumerateInstancesWithPath and enumerateInstancePaths
    {
        testEnumSequence tczerotest(client, "test/TestProvider");
        tczerotest.setTestName("excessive consecutive zero length responses ");
        tczerotest._className =  "CMPI_TEST_Person";
        tczerotest._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tczerotest._maxObjectCount = 0;

        tczerotest.setCIMException(CIM_ERR_SERVER_LIMITS_EXCEEDED);
        PEGASUS_ASSERT(tczerotest.openEnumerateInstances());
        while(tczerotest._endOfSequence == false)
        {
            if (!tczerotest.pullInstancesWithPath())
            {
                break;
            }
            if (tczerotest._returnedCIMExceptionCode != CIM_ERR_SUCCESS)
            {
                break;
            }
        }
    }

    {
        testEnumSequence tczerotest(client, "test/TestProvider");
        tczerotest.setTestName("excessive consecutive zero length responses ");
        tczerotest._className =  "CMPI_TEST_Person";
        tczerotest._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tczerotest._maxObjectCount = 0;

        tczerotest.setCIMException(CIM_ERR_SERVER_LIMITS_EXCEEDED);
        PEGASUS_ASSERT(tczerotest.openEnumerateInstancePaths());
        while(tczerotest._endOfSequence == false)
        {
            if (!tczerotest.pullInstancePaths())
            {
                break;
            }
            if (tczerotest._returnedCIMExceptionCode != CIM_ERR_SUCCESS)
            {
                break;
            }
        }
    }

    // Tests for associatorInstances and associatorPaths
    {
        testEnumSequence tczerotest(client, "test/TestProvider");
        tczerotest.setTestName("excessive consecutive zero length responses ");
        tczerotest._className =  "CMPI_TEST_Person";
        tczerotest._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tczerotest._maxObjectCount = 0;

        tczerotest.setCIMException(CIM_ERR_SERVER_LIMITS_EXCEEDED);
        PEGASUS_ASSERT(tczerotest.openAssociatorInstances());
        while(tczerotest._endOfSequence == false)
        {
            if (!tczerotest.pullInstancesWithPath())
            {
                break;
            }
            if (tczerotest._returnedCIMExceptionCode != CIM_ERR_SUCCESS)
            {
                break;
            }
        }
    }
    {
        testEnumSequence tczerotest(client, "test/TestProvider");
        tczerotest.setTestName("excessive consecutive zero length responses ");
        tczerotest._className =  "CMPI_TEST_Person";
        tczerotest._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tczerotest._maxObjectCount = 0;

        tczerotest.setCIMException(CIM_ERR_SERVER_LIMITS_EXCEEDED);
        PEGASUS_ASSERT(tczerotest.openAssociatorInstancePaths());
        while(tczerotest._endOfSequence == false)
        {
            if (!tczerotest.pullInstancePaths())
            {
                break;
            }
            if (tczerotest._returnedCIMExceptionCode != CIM_ERR_SUCCESS)
            {
                break;
            }
        }
    }

    // Tests for associatorInstances and associatorPaths
    {
        testEnumSequence tczerotest(client, "test/TestProvider");
        tczerotest.setTestName("excessive consecutive zero length responses ");
        tczerotest._className =  "CMPI_TEST_Person";
        tczerotest._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tczerotest._maxObjectCount = 0;

        tczerotest.setCIMException(CIM_ERR_SERVER_LIMITS_EXCEEDED);
        PEGASUS_ASSERT(tczerotest.openReferenceInstances());
        while(tczerotest._endOfSequence == false)
        {
            if (!tczerotest.pullInstancesWithPath())
            {
                break;
            }
            if (tczerotest._returnedCIMExceptionCode != CIM_ERR_SUCCESS)
            {
                break;
            }
        }
    }

    {
        testEnumSequence tczerotest(client, "test/TestProvider");
        tczerotest.setTestName("excessive consecutive zero length responses ");
        tczerotest._className =  "CMPI_TEST_Person";
        tczerotest._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        tczerotest._maxObjectCount = 0;

        tczerotest.setCIMException(CIM_ERR_SERVER_LIMITS_EXCEEDED);
        PEGASUS_ASSERT(tczerotest.openReferenceInstancePaths());
        while(tczerotest._endOfSequence == false)
        {
            if (!tczerotest.pullInstancePaths())
            {
                break;
            }
            if (tczerotest._returnedCIMExceptionCode != CIM_ERR_SUCCESS)
            {
                break;
            }
        }
    }

    for (Uint32 i = 0; i < 10; i++)
    {
        testEnumSequence tc(client, "test/TestProvider");
        tc.setTestName("Interoperation Timeout after Open");
        tc._className =  "CMPI_TEST_Person";
        tc._maxObjectCount = 0;
        tc._operationTimeout = 7;
        // execute the open call and then wait past timer to test for timeout
        PEGASUS_ASSERT(tc.openEnumerateInstances());
    }

    {
        // Just make sure we can receive good responses
        // Test for a complete sequence that works.
        testEnumSequence tcgood(client, "test/TestProvider");
        tcgood.setTestName("Good complete open/pull response");
        tcgood._className =  "TST_ResponseStressTestCxx";
        tcgood._maxObjectCount = 1;
        //tcgood._cimObjectName = "CMPI_TEST_Person.name=\"Melvin\"";
        PEGASUS_ASSERT(tcgood.openEnumerateInstances());
        while(tcgood._endOfSequence == false)
        {
            PEGASUS_ASSERT(tcgood.pullInstancesWithPath());
        }
    }

    {
        // Test for a complete sequence that works.
        testEnumSequence tcgood(client, "test/TestProvider");
        tcgood.setTestName("Good complete open/pull response");
        tcgood._className =  "TST_ResponseStressTestCxx";
        tcgood._maxObjectCount = 1;
        PEGASUS_ASSERT(tcgood.openEnumerateInstancePaths());
        while(tcgood._endOfSequence == false)
        {
            PEGASUS_ASSERT(tcgood.pullInstancePaths());
        }
    }
    // Added to help server clean up all enum contexts before shutdown
    // Used to insure that the TestMakefile test works.
    System::sleep(30);
    cout << argv[0] <<" +++++ passed all tests" << endl;
    return 0;
}