• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CYG_TEST_INIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: cyg_package_start

externC void
cyg_package_start( void )
{
    CYG_TEST_INIT();
    CYG_TEST_INFO( "Calling cyg_uitron_start()" );
    cyg_uitron_start();
}
开发者ID:0xCA5A,项目名称:dd-wrt,代码行数:7,代码来源:test9.c


示例2: main

int main(int argc, char **argv)
{
    pthread_t thread;
    pthread_attr_t attr;
    void *retval;

    CYG_TEST_INIT();

    // Create test thread
    pthread_attr_init( &attr );

    pthread_attr_setstackaddr( &attr, (void *)&thread_stack[sizeof(thread_stack)] );
    pthread_attr_setstacksize( &attr, sizeof(thread_stack) );

    pthread_create( &thread,
                    &attr,
                    pthread_entry1,
                    (void *)0x12345678);

    // Now join with it
    pthread_join( thread, &retval );

    // check retval
    
    if( (long)retval == 0x12345679 )
        CYG_TEST_PASS_FINISH( "pthread1" );
    else
        CYG_TEST_FAIL_FINISH( "pthread1" );
}
开发者ID:KarenHung,项目名称:ecosgit,代码行数:29,代码来源:pthread1.c


示例3: cyg_start

void
cyg_start(void)
{
    CYG_TEST_INIT();
    
    //
    // open CAN device driver
    //
    if (ENOERR != cyg_io_lookup("/dev/can0", &hCAN0)) 
    {
        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
    }
    
   
    //
    // create the two threads which access the CAN device driver
    // a reader thread with a higher priority and a writer thread
    // with a lower priority
    //
    cyg_thread_create(4, can0_thread, 
                        (cyg_addrword_t) 0,
		                "can0_thread", 
		                (void *) can0_thread_data.stack, 
		                1024 * sizeof(long),
		                &can0_thread_data.hdl, 
		                &can0_thread_data.obj);
		                
    cyg_thread_resume(can0_thread_data.hdl);
    
    cyg_scheduler_start();
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:31,代码来源:can_filter.c


示例4: cyg_start

void
cyg_start(void)
{
    CYG_TEST_INIT();
    
    //
    // open CAN device driver
    //
    if (ENOERR != cyg_io_lookup("/dev/can0", &hCAN0)) 
    {
        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
    }
    
    //
    // create the thread that accesses the CAN device driver
    //
    cyg_thread_create(4, can0_thread, 
                        (cyg_addrword_t) 0,
		                "can0_thread", 
		                (void *) can0_thread_data.stack, 
		                1024 * sizeof(long),
		                &can0_thread_data.hdl, 
		                &can0_thread_data.obj);
		                
    cyg_thread_resume(can0_thread_data.hdl);
    
    cyg_scheduler_start();
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:28,代码来源:can_remote.c


示例5: cyg_start

externC void
cyg_start( void )
{
    CYG_TEST_INIT();

    CYG_TEST_NA("This test needs DHCP enabled");
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:7,代码来源:dns2.c


示例6: 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


示例7: timeslice_main

void timeslice_main( void )
{
    CYG_TEST_INIT();

    // Work out how many CPUs we actually have.
    ncpus = CYG_KERNEL_CPU_COUNT();

    cyg_thread_create(0,              // Priority - just a number
                      run_tests, // entry
                      0,               // index
                      "run_tests",     // Name
                      test_stack,   // Stack
                      STACK_SIZE,      // Size
                      &main_thread,     // Handle
                      &test_thread // Thread data structure
        );
    cyg_thread_resume( main_thread);

    cyg_thread_create(5,               // Priority - just a number
                      hipri_test,      // entry
                      0,               // index
                      "hipri_run",     // Name
                      hipri_stack,   // Stack
                      STACK_SIZE,      // Size
                      &hipri_thread,     // Handle
                      &hipri_thread_obj // Thread data structure
        );
    cyg_thread_resume( hipri_thread);
    
    cyg_scheduler_start();
}
开发者ID:SQGiggsHuang,项目名称:ecosgit,代码行数:31,代码来源:timeslice2.c


示例8: main

int
main( int argc, char *argv[] )
{
    int num, denom;
    div_t result;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "div() function");

    num = 10232;
    denom = 43;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==237) && (result.rem==41),
                        "div( 10232, 43 )");

    num = 4232;
    denom = 2000;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==2) && (result.rem==232),
                        "div( 4232, 2000 )");


    num = 20;
    denom = 20;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==1) && (result.rem==0),
                        "div( 20, 20 )");

    num = -5;
    denom = 4;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==-1) && (result.rem==-1),
                        "div( -5, 4 )");

    num = 5;
    denom = -4;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==-1) && (result.rem==1),
                        "div( 5, -4 )");

    num = -5;
    denom = -3;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==1) && (result.rem==-2),
                        "div( -5, -3 )");

    num = -7;
    denom = -7;
    result = div(num, denom);
    CYG_TEST_PASS_FAIL( (result.quot==1) && (result.rem==0),
                        "div( -7, -7 )");


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

} // main()
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:59,代码来源:div.c


示例9: 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


示例10: 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


示例11: cyg_start

externC void
cyg_start( void )
{
    CYG_TEST_INIT();
    CYG_TEST_NA("FP test requires:\n"
                "CYGFUN_KERNEL_API_C && \n"
                "CYGSEM_KERNEL_SCHED_MLQUEUE && \n"
                "(CYGNUM_KERNEL_SCHED_PRIORITIES > 12)\n");
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:9,代码来源:fptest.c


示例12: main

int main(int argc, char **argv)
{
    int i, j;
    int ret;
    void *retval[NTHREADS];

    CYG_TEST_INIT();

    // Create test threads
    for( i = 0; i < NTHREADS; i++ )
    {
        pthread_attr_t attr;
        pthread_attr_init( &attr );

        pthread_attr_setstackaddr( &attr, (void *)&thread_stack[i][sizeof(thread_stack[i])] );
        pthread_attr_setstacksize( &attr, sizeof(thread_stack[i]) );

        ret = pthread_create( &thread[i],
                              &attr,
                              pthread_entry[i],
                              (void *)(0x12340000+i));
        CYG_TEST_CHECK( ret == 0, "pthread_create() returned error");
    }

    // Let the threads get going    
    for ( i = 0; i < NTHREADS ; i++ ) {
        while ( thread_ready[i] == false )
            sched_yield();
    }

    // Now wait a bit to be sure that the other threads have reached
    // their cancellation points.
    for ( j = 0; j < 20 ; j++ )
        sched_yield();
    
    // Now cancel them
    for( i = 0; i < NTHREADS; i++ )    
        pthread_cancel( thread[i] );
        
    // Now join with threads
    for( i = 0; i < NTHREADS; i++ )
        pthread_join( thread[i], &retval[i] );


    // check retvals
    for( i = 0; i < NTHREADS; i++ )
        CYG_TEST_CHECK( retval[i] == PTHREAD_CANCELED,
                        "thread didn't exit with PTHREAD_CANCELED" );

    CYG_TEST_CHECK( cancel_handler1_called, "cancel_handler1 not called" );
    CYG_TEST_CHECK( cancel_handler2_called, "cancel_handler2 not called" );
    CYG_TEST_CHECK( cancel_handler3_called, "cancel_handler3 not called" );

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


示例13: kflag0_main

void kflag0_main( void )
{
    CYG_TEST_INIT();

    CHECK(flash());
    CHECK(flash());
    
    CYG_TEST_PASS_FINISH("Kernel C API Flag 0 OK");
    
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:10,代码来源:kflag0.c


示例14: kcache2_main

void kcache2_main( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kcache1",
        (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_scheduler_start();
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:10,代码来源:kcache1.c


示例15: 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


示例16: cyg_start

externC void
cyg_start( void )
{
    CYG_TEST_INIT();
    CYG_TEST_INFO("FP test requires:\n"
                "CYGFUN_KERNEL_API_C && \n"
                "CYGSEM_KERNEL_SCHED_MLQUEUE && \n"
                "(CYGNUM_KERNEL_SCHED_PRIORITIES > 12) &&\n"
                "(CYGMEM_REGION_ram_SIZE >= (49152-4096))\n");
    CYG_TEST_NA("FP test requirements");
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:11,代码来源:fptest.c


示例17: cyg_start

externC void
cyg_start( void )
{
    CYG_TEST_INIT();

    cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "intr",
        (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);

    cyg_scheduler_start();
}
开发者ID:lijinlei,项目名称:Kernel_BOOX60,代码行数:11,代码来源:intr0.c


示例18: 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


示例19: main

int
main(int argc, char *argv[])
{
    time_t t1, t2;
    unsigned long ctr;

    CYG_TEST_INIT();

    CYG_TEST_INFO("Starting tests from testcase " __FILE__ " for C library "
                  "time() function");

    t1 = time(&t2);

    CYG_TEST_PASS_FAIL(t1==t2, "time() return value == argument");
    
    if (t1 == (time_t)-1)  // unimplemented is just as valid
    {
#ifndef CYGSEM_LIBC_TIME_TIME_WORKING
        CYG_TEST_PASS_FINISH( "time() returns -1, meaning unimplemented");
#else
        CYG_TEST_FAIL("time() returned -1 unnecessarily");
#endif
    } // if

    // First wait for a clock tick 

    for (ctr = 0; ctr<MAX_TIMEOUT; ctr++) {
        if ((t2=time(NULL)) > t1)
            break; // Hit the next time pulse
    }
    CYG_TEST_PASS_FAIL( ctr< MAX_TIMEOUT, "time()'s state changes");
    
#ifdef CYGSEM_LIBC_TIME_SETTIME_WORKING
    CYG_TEST_PASS_FAIL(cyg_libc_time_settime(0)==0, "Set time to 0");
    
    t1 = time(NULL);
    
    // give it a small amount of tolerance
    CYG_TEST_PASS_FAIL(t1 < 3, "t1 remembered setting");
    
    CYG_TEST_PASS_FAIL(cyg_libc_time_settime(1000)==0, "Set time to 1000");
    
    // give it a small amount of tolerance
    CYG_TEST_PASS_FAIL(t1 < 1003, "t1 remembered setting");
    
#else // ! CYGSEM_LIBC_TIME_SETTIME_WORKING
    CYG_TEST_PASS_FAIL(cyg_libc_time_settime(0)!=0,
                       "Set time expected fail");
#endif // CYGSEM_LIBC_TIME_SETTIME_WORKING

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


示例20: httpd_test

void
httpd_test(cyg_addrword_t p)
{
  
  CYG_TEST_INIT();

  init_all_network_interfaces();

  cyg_thread_delay(1 * 60 * 100);

  CYG_TEST_PASS_FINISH( "httpd test finished" );
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:12,代码来源:httpd1.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CYG_TEST_NA函数代码示例发布时间:2022-05-30
下一篇:
C++ CYG_TEST_INFO函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap