Example #1
0
File: tests.c Project: Ri0n/libotr
int main(int argc, char **argv)
{
    OTRL_INIT;
    us = otrl_userstate_create();

    otrl_privkey_read(us, "/home/iang/.gaim/otr.private_key");
    otrl_instag_read(us, "inst.txt");

    test(1,0);
    test(2,0);
    test(3,0);
    test(1,1);
    test(2,1);
    test_unreadable();
    test_crash1();
    test_refresh(3);
    test_refresh(2);
    test_refresh(1);

    otrl_userstate_free(us);

    return 0;
}
Example #2
0
/*-------------------------------------------------------------------------
 * Function:    main
 *
 * Purpose:     This function coordinates the test of flush/refresh
 *              functionality verification. It accepts either one, two or 
 *              no command line parameters. The main test routine runs
 *              with no command line parameters specified, while verification
 *              routines run with one or two command line parameters.
 * 
 *              Note: This program should not be run manually, as the 
 *              test is controlled by the testflushrefresh.sh script. Running
 *              the flushrefresh program manually will result in failure, as
 *              it will time out waiting for a signal from the test script
 *              which will never come.
 *
 * Return:      0 on Success, 1 on Failure
 *
 * Programmer:  Mike McGreevy
 *              July 1, 2010
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int main(int argc, const char *argv[]) 
{
    /* Variables */
    const char *envval = NULL;

    /* Initialize library */
    if(H5open() < 0)
        TEST_ERROR;

    /* Parse command line options */
    if (argc == 1) {

        /* No arguments supplied. Run main test routines if 
         * using sec2 or stdio driver, otherwise don't run 
         * anything. */

        /* Determine driver being used */
        envval = HDgetenv("HDF5_DRIVER");
        if(envval == NULL)
            envval = "";

        if (!HDstrcmp(envval, "sec2") || !HDstrcmp(envval, "stdio") || !HDstrcmp(envval, "")) {

            if (test_flush() != SUCCEED) TEST_ERROR;
            if (test_refresh() != SUCCEED) TEST_ERROR;

        } /* end if */

        else {
            
            HDfprintf(stdout, "Skipping all flush/refresh tests (only run with sec2 or stdio file drivers).\n");
            
            /* Test script is expecting some signals, so send them out to end it. */
            if (end_verification() < 0) TEST_ERROR;
            if (end_verification() < 0) TEST_ERROR;

        } /* end else */

    } else if (argc == 3) {

        /* Two arguments supplied. Pass them to flush verification routine. */

        if (flush_verification(argv[1], argv[2]) != 0) PROCESS_ERROR;

    } else if (argc == 2) {

        /* One argument supplied. Pass it to refresh verification routine. */

        if (refresh_verification(argv[1]) != 0) PROCESS_ERROR;
    
    } else {

        /* Illegal number of arguments supplied. Error. */

        HDfprintf(stderr, "Error. %d is an Invalid number of arguments to main().\n", argc);
        PROCESS_ERROR

    } /* end if */

    return SUCCEED;

error:
        
    /* Return */
    return FAIL;

} /* main */