Esempio n. 1
0
    /**
     * Just excersizes AIP. Unclear how to create pass/fail tests
     */
    void testIterator()
    {
        OsStatus stat;
        OsProcess process;
        OsProcessIterator pi;

        stat = pi.findFirst(process);
        KNOWN_BUG("Unknown failure", "XPL-12");
        CPPUNIT_ASSERT_MESSAGE("First process", stat == OS_SUCCESS);

        while (stat == OS_SUCCESS)
        {
            UtlString name;
            process.getProcessName(name);
            #if defined(WIN32) || defined(__hpux)
            /*on Windows and HP-UX, the system process is pid 0 */
            CPPUNIT_ASSERT_MESSAGE("Valid PID",process.getPID() >= 0);
            #else
            CPPUNIT_ASSERT_MESSAGE("Valid PID", process.getPID() != 0);
            #endif
            CPPUNIT_ASSERT_MESSAGE("Valid Parent PID", process.getParentPID() >= 0);
            CPPUNIT_ASSERT_MESSAGE("Valid process name", name.data() != NULL);
            
            stat = pi.findNext(process);
        }
    }
    /**
     * Just excersizes AIP. Unclear how to create pass/fail tests
     */
    void testIterator()
    {
        OsStatus stat;
        OsProcess process;
        OsProcessIterator pi;

        stat = pi.findFirst(process);
        CPPUNIT_ASSERT_MESSAGE("First process", stat == OS_SUCCESS);

        while (stat == OS_SUCCESS)
        {
            UtlString name;
            process.getProcessName(name);
            #ifdef WIN32
            /*on Windows, the system process is pid 0 */
            CPPUNIT_ASSERT_MESSAGE("Valid PID",process.getPID() >= 0);
            #else
            CPPUNIT_ASSERT_MESSAGE("Valid PID", process.getPID() != 0);
            #endif
            CPPUNIT_ASSERT_MESSAGE("Valid Parent PID", process.getParentPID() >= 0);
            CPPUNIT_ASSERT_MESSAGE("Valid process name", name.data() != NULL);
            
            stat = pi.findNext(process);
        }
    }
Esempio n. 3
0
/* ============================ Os Process Test Funcs ================================= */
OsStatus TestProcessIterator()
{
    OsProcessIterator *processIterator;
    cout << "Starting Process Iterator Test..." << endl;

    processIterator = new OsProcessIterator();

    OsStatus retval = processIterator->findFirst(process);
    while (retval == OS_SUCCESS)
    {
        UtlString name;
        process.getProcessName(name);
        cout << "Found PID = " << process.getPID() << "  ParentPID = " << process.getParentPID() << "  Name = " <<
            name.data() << endl;
        retval = processIterator->findNext(process);
    }

    delete processIterator;

    cout << "DONE Process Iterator Test.\n";

    retval = OS_SUCCESS;
    return retval;
}