当前位置: 首页>>代码示例>>C++>>正文


C++ CYG_TEST_INFO函数代码示例

本文整理汇总了C++中CYG_TEST_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ CYG_TEST_INFO函数的具体用法?C++ CYG_TEST_INFO怎么用?C++ CYG_TEST_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CYG_TEST_INFO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main( int argc, char *argv[] )
{
    char x[300];
    char *ret;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "memset() function");
    CYG_TEST_INFO("This testcase provides simple basic tests");

    // Check 1
    my_strcpy(x, "      ");
    ret = memset(x, 'X', 5);
    if ((my_strcmp(x, "XXXXX ") == 0) && (ret == x))
        CYG_TEST_PASS("Simple memset");
    else
        CYG_TEST_FAIL("Simple memset");

    // Check 2
    my_strcpy(x, "XXXXX ");
    ret = memset(x, 'Y', 0);
    if ((my_strcmp(x, "XXXXX ") == 0) && (ret == x))
        CYG_TEST_PASS("Boundary case of 0 bytes");
    else
        CYG_TEST_FAIL("Boundary case of 0 bytes");

//    CYG_TEST_NA("Testing is not applicable to this configuration");

    CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
                    "memset() function");

} // main()
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:33,代码来源:memset.c

示例2: http_accept

// Called when a new connection was accepted.
static err_t
http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
    struct http_state *hs;

    CYG_TEST_INFO("Incoming connection");

    tcp_setprio(pcb, TCP_PRIO_MIN);

    // Allocate memory for the structure that holds the state of the connection
    hs = mem_malloc(sizeof(struct http_state));
    if (hs == NULL)
        return ERR_MEM;

    // Initialize the structure
    hs->file = NULL;
    hs->left = 0;
    hs->retries = 0;

    // Tell TCP that this is the structure we wish to be passed for our
    // callbacks
    tcp_arg(pcb, hs);

    // Register callbacks
    tcp_recv(pcb, http_recv);
    tcp_err(pcb, http_err);
    tcp_poll(pcb, http_poll, 4);

    CYG_TEST_INFO("Connection accepted");

    return ERR_OK;
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:33,代码来源:httpd_simple.c

示例3: main

int main( int argc, char *argv[] )
{
    char x[300];
    char y[300];
    char *ret;
    int ctr;
    int fail;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "strncpy() function");
    CYG_TEST_INFO("This testcase tests robustness, and may take some time");

    fail = 0;
    for (ctr = 0; ctr < NUM_ROBUSTNESS_RUNS; ctr++) {
        my_strcpy(x, "Green plastic watering can, ");
        my_strcpy(y, "for her fake Chineese rubber plant");
        ret = strncpy(x, y, my_strlen(y)+1);
        if ( (my_strcmp(x, "for her fake Chineese rubber plant") != 0) ||
             ( ret != x ) )
        {
            fail = 1;
            break;
        } // if
    } // for
    CYG_TEST_PASS_FAIL( (fail == 0), "Robustness test" );

//    CYG_TEST_NA("Testing is not applicable to this configuration");

    CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
                    "strncpy() function");
} // main()
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:33,代码来源:strncpy2.c

示例4: main

int main( int argc, char **argv )
{
    void *retval;
    pthread_attr_t attr;
    struct sched_param schedparam;

    CYG_TEST_INIT();

#ifdef TEST_NET
    sa.sin_family = AF_INET;
    sa.sin_len = sizeof(sa);
    inet_aton("127.0.0.1", &sa.sin_addr);
    sa.sin_port = htons(1234);
    init_all_network_interfaces();
#endif
    
    // Create test threads

    {
        pthread_attr_init( &attr );

        schedparam.sched_priority = 10;
        pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
        pthread_attr_setschedpolicy( &attr, SCHED_RR );
        pthread_attr_setschedparam( &attr, &schedparam );
        pthread_attr_setstackaddr( &attr, (void *)&thread1_stack[sizeof(thread1_stack)] );
        pthread_attr_setstacksize( &attr, sizeof(thread1_stack) );

        pthread_create( &thread1,
                        &attr,
                        pthread_entry1,
                        (void *)0x12345671);
    }

    {
        pthread_attr_init( &attr );

        schedparam.sched_priority = 5;
        pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
        pthread_attr_setschedpolicy( &attr, SCHED_RR );
        pthread_attr_setschedparam( &attr, &schedparam );
        pthread_attr_setstackaddr( &attr, (void *)&thread2_stack[sizeof(thread2_stack)] );
        pthread_attr_setstacksize( &attr, sizeof(thread2_stack) );

        pthread_create( &thread2,
                        &attr,
                        pthread_entry2,
                        (void *)0x12345672);
    }
    
    // Now join with thread1
    CYG_TEST_INFO( "Main: calling pthread_join(thread1)");
    pthread_join( thread1, &retval );

    // And thread 2
    CYG_TEST_INFO( "Main: calling pthread_join(thread2)");
    pthread_join( thread2, &retval );

    CYG_TEST_PASS_FINISH("select");
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:60,代码来源:select.c

示例5: CYG_TEST_INFO

void *pthread_entry2( void *arg)
{
    sigset_t mask;
    
    CYG_TEST_INFO( "Thread 2 running" );

    // Make a full set
    sigfillset( &mask );

    // remove USR2 signal
    sigdelset( &mask, SIGUSR2 );

    // Set signal mask
    pthread_sigmask( SIG_SETMASK, &mask, NULL );
    
    // Get main thread going again
    sem_post( &sem );

    while( sigusr2_called < 6 )
    {
        CYG_TEST_INFO( "Thread2: calling pause()");        
        pause();
    }

    CYG_TEST_INFO( "Thread2: calling pthread_exit()");    
    pthread_exit( arg );
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:27,代码来源:timer1.c

示例6: CYG_TEST_INFO

void *pthread_entry2( void *arg)
{
    struct timespec zzz;
    int err;
    
    zzz.tv_sec = 0;
    zzz.tv_nsec = 10*1000000;
    
    CYG_TEST_INFO( "Thread 2: running" );

    CYG_TEST_INFO( "Thread 2: sleeping" );
    nanosleep( &zzz, NULL );
    nanosleep( &zzz, NULL );
    nanosleep( &zzz, NULL );
    
    while( sigusr1_sent < NUM_TEST_SIGNALS )
    {
        nanosleep( &zzz, NULL );

        err = pthread_kill( thread1, SIGUSR1 );
        if( err < 0 ) SHOW_RESULT( pthread_kill, err );

        sigusr1_sent++;

        if( (sigusr1_sent % 500) == 0 )
            diag_printf("INFO: <Thread 2: %d signals sent>\n",sigusr1_sent);
    }

    running = false;
        
    CYG_TEST_INFO( "Thread 2: exit" );
    pthread_exit( arg );
}
开发者ID:SQGiggsHuang,项目名称:ecosgit,代码行数:33,代码来源:pselect.c

示例7: handle_req_state

static void
handle_req_state(void)
{
    switch (req_state) {
    case REQ_DNS_INIT:
        CYG_TEST_INFO("Trying to resolve host name");
        if (dns_gethostbyname(CYGDAT_NET_LWIP_PPP_TEST_HOST, &host_addr,
                              dns_found_cb, NULL) == ERR_OK) {
            // Cached
            req_state = REQ_DNS_SUCCESS;
            break;
        }
        req_state = REQ_DNS_WAIT;
        break;
    case REQ_DNS_WAIT:
        break;
    case REQ_DNS_FAILED:
        CYG_TEST_INFO("Failed to resolve host name");
        test_state = TEST_PPP_CLOSE;
        break;
    case REQ_DNS_SUCCESS:
        CYG_TEST_INFO("Successfully resolved host name");
        success++;
        test_state = TEST_PPP_CLOSE;
        break;
    }
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:27,代码来源:ppp.c

示例8: fptest_main

void fptest_main( void )
{
    
    CYG_TEST_INIT();

    if( cyg_test_is_simulator )
    {
        run_ticks = RUN_TICKS_SIM;
    }

    CYG_TEST_INFO("Run fptest in cyg_start");
    do_test( fpt3_values, FP3_COUNT, 1000, 0, "start" );
    CYG_TEST_INFO( "cyg_start run done");
    
    cyg_thread_create( BASE_PRI-1,
                       fptest1,
                       0,
                       "fptest1",
                       &stacks[0][0],
                       STACK_SIZE,
                       &thread[0],
                       &thread_struct[0]);

    cyg_thread_resume( thread[0] );

    cyg_thread_create( BASE_PRI,
                       fptest2,
                       1,
                       "fptest2",
                       &stacks[1][0],
                       STACK_SIZE,
                       &thread[1],
                       &thread_struct[1]);

    cyg_thread_resume( thread[1] );

    cyg_thread_create( BASE_PRI,
                       fptest3,
                       2,
                       "fptest3",
                       &stacks[2][0],
                       STACK_SIZE,
                       &thread[2],
                       &thread_struct[2]);

    cyg_thread_resume( thread[2] );

    cyg_alarm_create( cyg_real_time_clock(),
                      alarm_fn,
                      0,
                      &alarm,
                      &alarm_struct );

    cyg_alarm_initialize( alarm, cyg_current_time()+1, 1 );
    
    cyg_scheduler_start();

}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:58,代码来源:fptest.c

示例9: cyg_user_start

void cyg_user_start(void)
#endif
{
    char x[300];
    char y[300];

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "strcmp() function");
    CYG_TEST_INFO("This testcase provides simple basic tests");

    // Check 1
    my_strcpy(x, "I have become, comfortably numb");
    my_strcpy(y, "I have become, comfortably numb");
    CYG_TEST_PASS_FAIL( (strcmp(x, y) == 0), "Simple compare");


    // Check 2
    my_strcpy(x, "");
    my_strcpy(y, "");
    CYG_TEST_PASS_FAIL( (strcmp(x, y) == 0), "Simple empty string compare");


    // Check 3
    my_strcpy(x, "..shall snuff it. And the Lord did grin");
    my_strcpy(y, "..shall snuff it. And the Lord did grio");
    CYG_TEST_PASS_FAIL( (strcmp(x, y) < 0),
                        "Memory less than #1" );


    // Check 4
    my_strcpy(x, "A reading from the Book of Armaments, Chapter 4, "
              "Verses 16 to 20:");
    my_strcpy(y, "Bless this, O Lord, that with it thou mayst blow thine "
              "enemies to tiny bits, in thy mercy.");
    CYG_TEST_PASS_FAIL( (strcmp(x, y) < 0),
                        "Memory less than #2");

    // Check 5
    my_strcpy(x, "Lobeth this thy holy hand grenade at thy foe");
    my_strcpy(y, "Lobeth this thy holy hand grenade at thy fod");
    CYG_TEST_PASS_FAIL( (strcmp(x, y) > 0),
                        "Memory greater than #1" );


    // Check 6
    my_strcpy(y, "Three shall be the number of the counting and the");
    my_strcpy(x, "number of the counting shall be three");
    CYG_TEST_PASS_FAIL( (strcmp(x, y) > 0),
                        "Memory greater than #2" );

//    CYG_TEST_NA("Testing is not applicable to this configuration");

    CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
                    "strcmp() function");
} // main()
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:57,代码来源:strcmp1.c

示例10: cyg_user_start

void cyg_user_start(void)
#endif
{
    char x[300];
    char y[300];
    char *ret;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "strcat() function");
    CYG_TEST_INFO("This testcase provides simple basic tests");

    // Check 1
    my_strcpy(x, "One ring to rule them all.");
    my_strcpy(y, "One ring to find them.");
    ret = strcat(x, y);
    if ( my_strcmp(x, "One ring to rule them all.One ring to find them.")==0 ) 
        CYG_TEST_PASS("Simple concatenation");
    else 
        CYG_TEST_FAIL("Simple concatenation");
    // Check return val
    CYG_TEST_PASS_FAIL( ( ret == x ), "Simple concatenation return value" );


    // Check 2
    my_strcpy(x, "One ring to bring them all,");
    my_strcpy(y, "");
    ret = strcat(x, y);
    if ( my_strcmp(x, "One ring to bring them all,")==0 ) 
        CYG_TEST_PASS("Concatenation of empty string");
    else 
        CYG_TEST_FAIL("Concatenation of empty string");
    // Check return val
    CYG_TEST_PASS_FAIL( ( ret == x ),
                        "Concatenation of empty string return value" );


    // Check 3
    my_strcpy(x, "and in the darkness bind them");
    my_strcpy(y, "");
    ret = strcat(y, x);
    if ( my_strcmp(x, "and in the darkness bind them")==0 ) 
        CYG_TEST_PASS("Concatenation to empty string");
    else 
        CYG_TEST_FAIL("Concatenation to empty string");
    // Check return val
    CYG_TEST_PASS_FAIL( ( ret == y ),
                        "Concatenation to empty string return value" );

//    CYG_TEST_NA("Testing is not applicable to this configuration");

    CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
                    "strcat() function");
} // main()
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:55,代码来源:strcat1.c

示例11: cyg_user_start

void cyg_user_start(void)
#endif
{
    char x[300];
    char y[300];
    void *ret, *ptr1, *ptr2;
    char *c_ret;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "memcpy() function");
    CYG_TEST_INFO("This testcase provides simple basic tests");

    // Check 1
    ptr1 = x; 
    ptr2 = y;
    my_strcpy(x, "Great shot kid! That was one in a million!");
    ret = memcpy(ptr2, ptr1, my_strlen(x) + 1);
    CYG_TEST_PASS_FAIL( (my_strcmp(x, ptr2)==0), "Simple copy" );

    // Check return value
    CYG_TEST_PASS_FAIL( (my_strcmp(ret, ptr2)==0), "Simple copy return value");


    // Check 2
    ptr1 = x; 
    ptr2 = y;
    my_strcpy(x, "");
    my_strcpy(y, "xxxx"); // Bogus val to get overwritten
    ret = memcpy(ptr2, ptr1, 1);
    c_ret = ret;
    if ((*c_ret == '\0') && (y[0] == '\0') && (y[1] == 'x'))
        CYG_TEST_PASS("Simple copy with boundary check worked");
    else
        CYG_TEST_FAIL("Simple copy with boundary check failed");

    // Check 3
    ptr1 = x; 
    ptr2 = y;
    my_strcpy(x, "xxxx");
    my_strcpy(y, "yyyy");
    ret = memcpy(ptr1, ptr2, 0);
    c_ret = ret;
    if ((*c_ret =='x') && (x[0] == 'x'))
        CYG_TEST_PASS("Simple copy with size=0 worked");
    else
        CYG_TEST_FAIL("Simple copy with size=0 failed");

//    CYG_TEST_NA("Testing is not applicable to this configuration");

    CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
                    "memcpy() function");
} // main()
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:54,代码来源:memcpy1.c

示例12: serial_test

void
serial_test( void )
{
    cyg_io_handle_t ser_handle;
    cyg_ser_cfg_t *cfg=&test_configs[0];
    cyg_ser_cfg_t new_cfg;
    int count = sizeof(test_configs) / sizeof(cyg_ser_cfg_t);
    int i;

    test_open_ser(&ser_handle);

    // We need the filter for this test.
    test_ping(ser_handle);

    // Choose the configuration with the fastest baud rate, to be most
    // provocative. Start at 1 coz cfg already points at 0
    for (i=1; i<count; i++) {
        if (cfg->baud_rate < test_configs[i].baud_rate)
            cfg=&test_configs[i];
    }

    // Set flow control from configuration
    // Choose software first

#ifdef CYGOPT_IO_SERIAL_FLOW_CONTROL_SOFTWARE
    CYG_TEST_INFO("Setting software flow control");

    new_cfg = *cfg;
    new_cfg.flags |= CYGNUM_SERIAL_FLOW_XONXOFF_RX |
                     CYGNUM_SERIAL_FLOW_XONXOFF_TX;
    if (ENOERR == change_config(ser_handle, &new_cfg))
        run_tests( ser_handle );
#endif

    // hardware flow control
#ifdef CYGOPT_IO_SERIAL_FLOW_CONTROL_HW
    CYG_TEST_INFO("Setting RTS/CTS hardware flow control");

    new_cfg = *cfg;
    new_cfg.flags |= CYGNUM_SERIAL_FLOW_RTSCTS_RX|CYGNUM_SERIAL_FLOW_RTSCTS_TX;
    if (ENOERR == change_config(ser_handle, &new_cfg))
        run_tests( ser_handle );

    CYG_TEST_INFO("Setting DSR/DTR hardware flow control");

    new_cfg = *cfg;
    new_cfg.flags |= CYGNUM_SERIAL_FLOW_DSRDTR_RX|CYGNUM_SERIAL_FLOW_DSRDTR_TX;
    if (ENOERR == change_config(ser_handle, &new_cfg))
        run_tests( ser_handle );
#endif
 
    CYG_TEST_PASS_FINISH("flow2 test OK");
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:53,代码来源:flow2.c

示例13: net_test

void
net_test(cyg_addrword_t param)
{
    cyg_serial_baud_rate_t old;    
    cyg_ppp_options_t options;
    cyg_ppp_handle_t ppp_handle;

    CYG_TEST_INIT();
    
    diag_printf("Start TCP test - ECHO mode\n");
    init_all_network_interfaces();
    calibrate_load(DESIRED_BACKGROUND_LOAD);
#ifdef CYGPKG_SNMPAGENT
    {
        extern void cyg_net_snmp_init(void);
        cyg_net_snmp_init();
    }
#endif

    old = ppp_test_set_baud( CYGNUM_SERIAL_BAUD_115200 );

    ppp_test_announce( "TCP_ECHO" );
    
    cyg_ppp_options_init( &options );

//    options.debug = 1;
//    options.kdebugflag = 1;
//    options.flowctl = CYG_PPP_FLOWCTL_SOFTWARE;

    ppp_handle = cyg_ppp_up( CYGPKG_PPP_TEST_DEVICE, &options );

    CYG_TEST_INFO( "Waiting for PPP to come up");
    
    cyg_ppp_wait_up( ppp_handle );

    echo_test(param);

    CYG_TEST_INFO( "Bringing PPP down");

    cyg_ppp_down( ppp_handle );
    
    CYG_TEST_INFO( "Waiting for PPP to go down");

    cyg_ppp_wait_down( ppp_handle );

    cyg_thread_delay( 200 );
    
    ppp_test_set_baud( old );

    ppp_test_finish();
    
    CYG_TEST_PASS_FINISH("TCP ECHO test OK");
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:53,代码来源:tcp_echo.c

示例14: cyg_user_start

void cyg_user_start(void)
#endif
{
    char x[300];
    char y[300];
    char *ret;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "strstr() function");
    CYG_TEST_INFO("This testcase provides simple basic tests");

    // Check 1
    my_strcpy(x, "I will not have my fwends widiculed by the common soldiewy");
    my_strcpy(y, "fwends");
    ret = strstr(x, y);
    CYG_TEST_PASS_FAIL( (ret == &x[19]), "Simple strstr()" );


    // Check 2 (boundary condition)
    my_strcpy(x, "Not bad for a little fur ball. You! Stay here.");
    my_strcpy(y, "ball ");
    ret = strstr(x, y);
    CYG_TEST_PASS_FAIL( (ret == NULL), "String to search for not present" );


    // Check 3 (boundary condition)
    my_strcpy(x, "");
    my_strcpy(y, "zx");
    ret = strstr(x, y);
    CYG_TEST_PASS_FAIL( (ret == NULL), "Empty string to search" );


    // Check 4 (boundary condition)
    my_strcpy(x, "fdafdafdfahjgf");
    my_strcpy(y, "");
    ret = strstr(x, y);
    CYG_TEST_PASS_FAIL( (ret == x), "Empty search string" );

    // Check 5 (boundary condition)
    my_strcpy(x, "");
    my_strcpy(y, "");
    ret = strstr(x, y);
    CYG_TEST_PASS_FAIL( (ret == x), "Both strings empty" );

//    CYG_TEST_NA("Testing is not applicable to this configuration");

    CYG_TEST_FINISH("Finished tests from testcase " __FILE__ " for C library "
                    "strstr() function");

} // main()
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:52,代码来源:strstr.c

示例15: main

int
main(int argc, char *argv[])
{
    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C "
                  "library snprintf() function return values");
    CYG_TEST_INFO("These test return values of snprinf() family of functions");

    test(0);

    return 0;
} // main()
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:13,代码来源:snprintf.c


注:本文中的CYG_TEST_INFO函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。