Beispiel #1
0
HRESULT CTestPolling::Test3()
{
    HRESULT hr = S_OK;

    const size_t c_maxSockets = 10;
    
    ChkA(TestInit(c_maxSockets, 0));
    
    ChkA(_spPolling->Add(3, IPOLLING_READ));
    ChkA(_spPolling->Remove(3));
    ChkA(_spPolling->Add(5, IPOLLING_READ));
    ChkA(_spPolling->Add(7, IPOLLING_READ));
    ChkA(_spPolling->Add(9, IPOLLING_READ));
    ChkA(_spPolling->Remove(5));
    ChkA(_spPolling->Add(11, IPOLLING_READ));
    ChkA(_spPolling->Add(13, IPOLLING_READ));
    ChkA(_spPolling->Remove(7));
    ChkA(_spPolling->Add(15, IPOLLING_READ));
    ChkA(_spPolling->Add(17, IPOLLING_READ));
    ChkA(_spPolling->Add(19, IPOLLING_READ));
    ChkA(_spPolling->Remove(11));
    ChkA(_spPolling->Add(21, IPOLLING_READ));
    ChkA(_spPolling->Add(23, IPOLLING_READ));
    ChkA(_spPolling->Add(25, IPOLLING_READ));
    ChkA(_spPolling->Add(27, IPOLLING_READ));
    ChkA(_spPolling->Remove(13));
    
Cleanup:
    return hr;
    
}
Beispiel #2
0
//================================================================================
void ATHEngine::Init()
{
	// Load from config
	LoadConfig();

	// Create the operating system construct for the game
	if (!CreateViewport())
		return;

#ifdef _WIN32
	// Start the renderer
	m_pRenderer = ATHRenderer::GetInstance();
	m_pRenderer->Initialize(m_hWnd, m_hInstance, m_nScreenWidth, m_nScreenHeight, m_bFullscreen, m_bVsync);
	m_pRenderer->SetDebugLines(m_bDebugLines);
	// Setup input management
	m_pInputManager = ATHInputManager::GetInstance();
	m_pInputManager->Init(m_hWnd, m_hInstance, m_nScreenWidth, m_nScreenWidth, m_nScreenWidth / 2, m_nScreenWidth / 2);

	// Start Audio Manager
	m_pAudioManager = ATHAudio::GetInstance();
	m_pAudioManager->InitXAudio2();
#endif // _WIN32

	// Create event manager
	m_pEventManager = ATHEventManager::GetInstance();

	// Setup Object manager
	m_pObjectManager = new ATHObjectManager();
	m_pObjectManager->Init();

	// Test init code
	TestInit();

	m_bShutdown = false;
}
Beispiel #3
0
int main(int argc, char** argv)
{
    unsigned short usRes = 0;
    if((usRes = TestHeartPokers()))
    {
        printf("Test Heart Pokers Error at %u\n", usRes);
        return 1;
    }

    if((usRes = TestDiamondPokers()))
    {
        printf("Test Diamond Pokers Error at %u\n", usRes);
        return 1;
    }

    if((usRes = TestSpadePokers()))
    {
        printf("Test Spade Pokers Error at %u\n", usRes);
        return 1;
    }

    if((usRes = TestClubPokers()))
    {
        printf("Test Club Pokers Error at %u\n", usRes);
        return 1;
    }

    if((usRes = TestInit()))
    {
        printf("Test Init Error at %u\n", usRes);
        return 1;
    }
    printf("Test Success\n");
    return 0;
}
Beispiel #4
0
 void CLogger::VPrint(unsigned int Filter, const char* Format, va_list& argList) {
     TestInit();
     char Buffer[4096];
     {
         //weirdly, it is found, sometime it crashed in vsnprintf
         //so, to protect it for the multithreading
         gs_lock->Lock();
         string_vnprintf(Buffer, sizeof(Buffer), Format, argList);
         gs_lock->Unlock();
     }
     Output(Filter, Buffer);
 }
Beispiel #5
0
int
main(int argc, char *argv[])
{
    /* Initialize testing framework */
    TestInit(argv[0], NULL, NULL);

    /* Tests are generally arranged from least to most complexity... */
    AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL);
    AddTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code", NULL);
    AddTest("tst", test_tst, NULL,  "Ternary Search Trees", NULL);
    AddTest("heap", test_heap, NULL,  "Memory Heaps", NULL);
    AddTest("skiplist", test_skiplist, NULL,  "Skip Lists", NULL);
    AddTest("refstr", test_refstr, NULL,  "Reference Counted Strings", NULL);
    AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL);
    AddTest("h5s",  test_h5s,  cleanup_h5s,  "Dataspaces", NULL);
    AddTest("coords",  test_coords,  cleanup_coords,  "Dataspace coordinates", NULL);
    AddTest("attr", test_attr, cleanup_attr,  "Attributes", NULL);
    AddTest("select", test_select, cleanup_select,  "Selections", NULL);
    AddTest("time", test_time, cleanup_time,  "Time Datatypes", NULL);
    AddTest("reference", test_reference, cleanup_reference,  "References", NULL);
    AddTest("vltypes", test_vltypes, cleanup_vltypes,  "Variable-Length Datatypes", NULL);
    AddTest("vlstrings", test_vlstrings, cleanup_vlstrings,  "Variable-Length Strings", NULL);
    AddTest("iterate", test_iterate, cleanup_iterate,  "Group & Attribute Iteration", NULL);
    AddTest("array", test_array, cleanup_array,  "Array Datatypes", NULL);
    AddTest("genprop", test_genprop, cleanup_genprop,  "Generic Properties", NULL);
    AddTest("misc", test_misc, cleanup_misc,  "Miscellaneous", NULL);

    /* Display testing information */
    TestInfo(argv[0]);

    /* Parse command line arguments */
    TestParseCmdLine(argc,argv);

    /* Perform requested testing */
    PerformTests();

    /* Display test summary, if requested */
    if (GetTestSummary())
        TestSummary();

    /* Clean up test files, if allowed */
    if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
        TestCleanup();

    return (GetTestNumErrs());
}                               /* end main() */
Beispiel #6
0
    void ConsoleOut::Dump(uint32_t Filter, const void* pUserData, size_t UserSize)
    {
        TestInit();

        if ((pUserData) && (UserSize > 0))
        {
            char        Str[80];
            size_t		i;
            uint8_t*    pData;
            size_t		Size;
            size_t		StartingOfs;
            size_t		EndingOfs;
            pData = BEHAVIAC_ALIGN_PTR(uint8_t*, pUserData, 16);
            StartingOfs = (size_t)BEHAVIAC_DIFF_PTR(pUserData, pData);
            EndingOfs = StartingOfs + UserSize;
            Size = BEHAVIAC_ROUND(EndingOfs, 16);

            for (i = 0; i < (Size / 16); i++)
            {
                memset(Str, ' ', sizeof(Str));
                string_snprintf(Str, sizeof(Str), "%p", pData + i * 16);
                Str[8] = ':';

                for (size_t j = 0; j < 16; j++)
                {
                    size_t Ofs = i * 16 + j;
                    size_t Index = (j * 3) + ((j > 7) ? 11 : 10);

                    if ((Ofs >= StartingOfs) && (Ofs < EndingOfs))
                    {
                        string_snprintf(Str + Index, sizeof(Str) - Index, "%02X", pData[Ofs]);
                        Str[Index + 2] = ' ';
                        //Str[60+j] = Str::IsPrintable(pData[Ofs]) ? pData[Ofs] : '.';
                        Str[60 + j] = pData[Ofs];
                    }
                }

                Str[76] = '\n';
                Str[77] = 0;
                Output(Filter, Str);
            } // for(i = 0; i < (Size / 16) ; i++)
        } // if((pData) && (Size > 0))
Beispiel #7
0
    void CLogger::PrintLines(ETagLogLevel Filter, const char* pStr) {
        BEHAVIAC_UNUSED_VAR(Filter);

        TestInit();

        const int kMaxStringLength = 2048;
        int count = 0;
        char line[kMaxStringLength];

        while (*pStr != '\0' && *pStr != '\n') {
            line[count++] = *pStr++;
        }

        if (*pStr == '\n') {
            line[count++] = *pStr++;
        }

        line[count++] = '\0';

        BEHAVIAC_ASSERT(count < kMaxStringLength);
        count = 0;

        //the first line
        OutputDecoratedLine(Filter, line);

        while (*pStr != '\0') {
            while (*pStr != '\0' && *pStr != '\n') {
                line[count++] = *pStr++;
            }

            if (*pStr == '\n') {
                line[count++] = *pStr++;
            }

            line[count++] = '\0';

            BEHAVIAC_ASSERT(count < kMaxStringLength);
            count = 0;

            OutputLine(line);
        }
    }
Beispiel #8
0
int main(int argc, char **argv)
{
  int server_sock, session_sock;
  
  if (argc > 1) TestInit(0);

  server_sock = OpenUDPSocket( 1701 );
  session_sock = OpenPPPoL2TPSocket();

  /* Try sending packets first to see if that helps */
  // SendRawPacket( server_sock, 1701, control_packet, sizeof( control_packet ) );
  // SendRawPacket( server_sock, 1701, data_packet,    sizeof( data_packet    ) );

  fcntl( server_sock, F_SETFL, O_NONBLOCK );
  fcntl( session_sock, F_SETFL, O_NONBLOCK );
  
  CheckPipe( server_sock );
  
  ConnectSock( session_sock, server_sock, 1701, 1, 2, 3, 4 );

  system( "./subtest-proc" );
  
  SendRawPacket( server_sock, 1701, control_packet, sizeof( control_packet ) );
  SendRawPacket( server_sock, 1701, data_packet,    sizeof( data_packet    ) );

  system( "./subtest-proc" );

  CheckPipe( server_sock );
  CheckPipe( session_sock );

  system( "./subtest-proc" );
  
  /* Close session socket first, because other way round breaks right now */  
  TestPrintf( "Closing session socket\n" );  
  close( session_sock );
  TestPrintf( "Closing server socket\n" );  
  close( server_sock );
  
  return 0;
}
Beispiel #9
0
// simplest of all tests. Just set a file descriptor and see that it's available
// repeat many times
HRESULT CTestPolling::Test1()
{
    HRESULT hr = S_OK;
    HRESULT hrResult;
    size_t size;
    PollEvent event;    
    int fd;
    int count = 0;
    
    srand(100);

    ChkA(TestInit(10, 10));
    
    size = _pipes.size();
    
    hrResult = _spPolling->WaitForNextEvent(&event, 0);
    ChkIfA(hrResult != S_FALSE, E_UNEXPECTED);    
    
    // one event at a time model
    for (int index = 0; index < 100; index++)
    {

        size_t item = rand() % size;
        
        ChkA(WritePipe(&_pipes[item]));
        
        ConsumeEvent(&fd, &count);
        
        ChkIfA(fd != _pipes[item].readpipe, E_UNEXPECTED);
        ChkIfA(count != 1, E_UNEXPECTED);
    }
    
    hrResult = _spPolling->WaitForNextEvent(&event, 0);
    ChkIfA(hrResult != S_FALSE, E_UNEXPECTED);
    
Cleanup:
    return hr;
}
Beispiel #10
0
int my_main(const char* str_latero_ip, int print_response, int npack, 
            unsigned int* dacval, int dacval_cnt,
            char rd, char wr, int addr, int value, char dst_main, char dst_io, int testpattern )
{
  latero_conn latero;


  /*
  struct sockaddr_in si_server, si_other;
  int s, ii, slen=sizeof(si_other);
  char pktbuff[BUFLEN];
  char rspbuff[BUFLEN];
  */

  int ii;

  uint8_t  blades[64];
  uint16_t dio_out = 0x0000;
  // For raw address commands
  uint16_t saddr    = 0x0000;
  uint16_t sdata    = 0x0000;
  latero_dst_device destination;

  int numbytes = 0;

  latero_pkt_t response;

  printf("Init Connection: ");
  if ( ii = init_connection( &latero, str_latero_ip ) < 0 ) {
    printf("Error (%d)!\n",ii );
    return(-1);
  } else {
    printf("OK.\n");
  }

 
  // Sanitize the dac values
  for(ii = 0 ; ii < 4 ; ii++ ) {
      if (ii < dacval_cnt ) { 
          setDAC( &latero, ii, dacval[ii] );
      }
  }

/*	
  for(ii = 0 ; ii<64 ; ii++ ) {
      blades[ii] = ii;
  }
  setBlades( &latero, blades );
*/
  // Run a few test cases here
  TestInit();
  ii = 0;
  switch(testpattern) {	
    case 1:
        TestSplit1(&latero);
        sleep(1);
        TestSplit2(&latero);
    break;
    case 2:
        TestAllpin(&latero);
    break;
    case 3:
        TestRow(&latero);
        sleep(1);
        TestCol(&latero);
    break;
    case 4:
	// Test continuously without stopping
        while(1) {
		printf("%d ", ii);
		TestRow(&latero);
		printf("%d ", ii);
        	TestCol(&latero);
		ii++;
	}
    break;

  }
	
  /* Just on led is turned on... */
  setDIO( &latero, 0xDEAC );
  // setDAC( &latero, 0x0, 0x1234 );
  // setDAC( &latero, 0x1, 0x5678 );
  // setDAC( &latero, 0x2, 0x9ABC );
  // setDAC( &latero, 0x3, 0xDEF0 );

  printf("Sending\n");
  sendNormalPacket( &latero, &response );
  printf("printing\n");
  printPacket( &response );

/*
  printf("Test Connection\n");
  if( test_connection( &latero ) < 0 ) {
      fprintf(stderr,"The test_connection() failed\n");
  } else {
      printf("Connection with Latero is OK.\n");
  }
*/

  if( rd > 0 || wr > 0 ) {
    saddr = addr & 0xFFFF;
    sdata = value & 0xFFFF;

    if ( dst_main > 0 ) {
        destination = LATERO_CONTROLLER;
    } else if ( dst_io > 0 ) {
        destination = LATERO_IO;
    }
    if( rd > 0 ) {
        rawRead( &latero, destination, saddr, &sdata );
        printf("Data Read at address 0x%4.4X = 0x%4.4X\n", saddr,sdata);
    } else { /* Write */
        rawWrite(&latero, destination, saddr, sdata  );
        printf("0x%4.4X written at address 0x%4.4X\n", sdata,saddr );
    }
  } else {
    // Normal Latero Packets
    //fillNormalPacket(PKT_TYPE_FULL, dac, blades, dio_out, &packetSend);
  }

  return( close_connection( &latero ) );

}
Beispiel #11
0
// create a polling set
HRESULT CTestPolling::Test2()
{
    // simulate the following events in random order:
    //    socket added (did it succeed as expected)
    //    incoming data (write to a random pipe)
    //    WaitForNextEvent called (did it return an expected result/socket)
    //        Remove socket last notified about

    HRESULT hr = S_OK;
    HRESULT hrResult;
    PollEvent event;  
    const size_t c_maxSockets = 10;
    
    srand(100);

    ChkA(TestInit(c_maxSockets, 0));
    
   
    hrResult = _spPolling->WaitForNextEvent(&event, 0);
    ChkIfA(hrResult != S_FALSE, E_UNEXPECTED);    
    
    
    for (size_t index = 0; index < 1000; index++)
    {
        int randresult = ::rand() % 4;
        
        switch (randresult)
        {
            case 0:
            {
                // simulate a new socket being added
                if (_pipes.size() >= c_maxSockets)
                {
                    continue;
                }
                
                ChkA(CreateAndAddPipe());

                break;
            }
            
            case 1:
            {
                // simulate incoming data
                size_t size = _pipes.size();
                size_t itemindex;
                
                if (size == 0)
                {
                    continue;
                }
                
                itemindex = rand() % size;
                ChkA(WritePipe(&_pipes[itemindex]));
                
                break;
            }
            
            case 2:
            case 3:
            {
                int fd;
                size_t pending = GetPendingCount();
                if (pending == 0)
                {
                    continue;
                }
                
                ChkA(ConsumeEvent(&fd, NULL));
                
                if (randresult == 3)
                {
                    // simulate removing this pipe from the set
                    ChkA(RemovePipe(FindPipePairIndex(fd)));
                }
                break;
            } // case
        } // switch
    } // for

Cleanup:
    return hr;
}
Beispiel #12
0
EXTERN UINT YICALL KernelMain()
{
	/* struct aa test;
	YI_PLIST_HEAD ptest;
	ptest=&test.list;
	YI_LIST_ENTRY(ptest, struct aa, list)->list.pNext = 0;*/
#if CFG_VBE == 1
    YIDrawFillRect(0, 0, 800, 600, 0);
#endif /* CFG_VBE */
#if	(CFG_DEBUG == 1)
  	YIDbgInitDebug();
    /*YIDebugPoint();*/
#endif

	YIIntInitialize();

	/* __asm__("cli\n\thlt");*/
	YMInitialize();    

	YITimeInitialize();
    
    /* YIDebugPoint(); */

    YIDriverKBInitialize();
    YIDriverPs2MouInitialize();
    YIDriverComInitialize();
#if CFG_KERNEL_SCHED_METHOD_RM == 1
	YIKeSchedRMInit();
#endif /* CFG_KERNEL_SCHED_METHOD_RM */
#if CFG_KERNEL_SCHED_METHOD_TIMESLICE == 1
	YIKeSchedRMInit();
#endif /* CFG_KERNEL_SCHED_METHOD_TIMESLICE */


	/* YIRtlKernelMsg("Welcome to YingOS! Copyright(C) 2004-2005");*/
                                                                          
	YIRtlKernelMsg("\n    +-----------------------------------------+\n");
	YIRtlKernelMsg("    |Welcome to                Ver: 1.0.0     |\n");
	YIRtlKernelMsg("    |                                         |\n");
	YIRtlKernelMsg("    |__     __                  ____    _____ |\n");
	YIRtlKernelMsg("    |\\ \\   / /_                / __ \\  / ____||\n");
	YIRtlKernelMsg("    | \\ \\_/ /(_) _ __    __ _ | |  | || (___  |\n");
	YIRtlKernelMsg("    |  \\   / | || '_ \\  / _` || |  | | \\___ \\ |\n");
	YIRtlKernelMsg("    |   | |  | || | | || (_| || |__| | ____) ||\n");
	YIRtlKernelMsg("    |   |_|  |_||_| |_| \\__, | \\____/ |_____/ |\n");
	YIRtlKernelMsg("    |                   |___/                 |\n");
	YIRtlKernelMsg("    |-----------------------------------------|\n");
	YIRtlKernelMsg("    |    Copyright (2004-2005) Devin Wang     |\n");
	YIRtlKernelMsg("    +-----------------------------------------+\n");

#if CFG_GUI > 0
	YIRtlKernelMsg("   ÄúºÃ,»¶Ó­Ê¹ÓÃYingOS!\n");
#endif /* CFG_GUI */

    YIDrawFillRect(100, 100, 200, 200, 0x0000ff00); 
    /* YIDebugPoint();*/
	TestInit();
    /*YIHLT(); */
    /* YIDebugPoint(); */
	/* YIHalExitCritical();	*/
	YIHalReSched();
    /*asm("sti");
    for(;;)
    {
        asm("hlt");
    }*/
	
		
  return 0;
}
Beispiel #13
0
int main(int argc, char **argv)
{
  int server_sock1, session_sock1;
  int server_sock2, session_sock2;
  
  if (argc > 1) TestInit(0);

  server_sock1 = OpenUDPSocket( 1701 );
  session_sock1 = OpenPPPoL2TPSocket();

  server_sock2 = OpenUDPSocket( 1702 );
  session_sock2 = OpenPPPoL2TPSocket();

#if 0
  /* Try sending packets first to see if that helps */
  SendTestPacket( server_sock1, 1702 );
  SendTestPacket( server_sock2, 1701 );
#endif

  fcntl( server_sock1,  F_SETFL, O_NONBLOCK );
  fcntl( session_sock1, F_SETFL, O_NONBLOCK );
  fcntl( server_sock2,  F_SETFL, O_NONBLOCK );
  fcntl( session_sock2, F_SETFL, O_NONBLOCK );

  fcntl( server_sock1,  F_SETFD, FD_CLOEXEC );
  fcntl( session_sock1, F_SETFD, FD_CLOEXEC );
  fcntl( server_sock2,  F_SETFD, FD_CLOEXEC );
  fcntl( session_sock2, F_SETFD, FD_CLOEXEC );

  CheckPipe( server_sock1 );
  CheckPipe( server_sock2 );
    
  ConnectSock( session_sock1, server_sock1, 1702, 1, 2, 3, 4 );
  ConnectSock( session_sock2, server_sock2, 1701, 3, 4, 1, 2 );

  system( "./subtest-proc" );
  
  SendTestPacket( session_sock1, 1702 );
  SendTestPacket( session_sock2, 1701 );

  system( "./subtest-proc" );

  CheckPipe( server_sock1 );
  CheckPipe( session_sock1 );
  CheckPipe( server_sock2 );
  CheckPipe( session_sock2 );
  
  if (argc == 0)
  {
    StartLoopingFunction( session_sock1, 0, 0 );
    StartLoopingFunction( session_sock2, 0, 0 );
    StartLoopingFunction( server_sock1, 1702, 0 );
    StartLoopingFunction( server_sock2, 1701, 0 );
  }
  else
  {
    StartLoopingFunction( session_sock1, 0, 1000 );
    StartLoopingFunction( session_sock2, 0, 2000 );
    StartLoopingFunction( server_sock1, 1702, 3000 );
    StartLoopingFunction( server_sock2, 1701, 4000 );
  }

  if (argc == 0) 
  {
    char buf[16];
    fprintf( stdout, "Press any key to continue\n" );
    fgets( buf, 10, stdin );
  } 
  else 
  {
    fprintf(stdout, "Waiting 60 seconds...\n");
    sleep(60);
  }

  system( "./subtest-proc" );

  TestPrintf( "Closing server2 socket\n" );  
  close( server_sock2 );
  TestPrintf( "Closing session2 socket\n" );  
  close( session_sock2 );
  TestPrintf( "Closing session1 socket\n" );  
  close( session_sock1 );
  TestPrintf( "Closing server1 socket\n" );  
  close( server_sock1 );
  
  return 0;
}
int main(int argc, char **argv)
{
    int mpi_size, mpi_rank;				/* mpi variables */
    H5Ptest_param_t ndsets_params, ngroups_params;
    H5Ptest_param_t collngroups_params;
    H5Ptest_param_t io_mode_confusion_params;

    /* Un-buffer the stdout and stderr */
    setbuf(stderr, NULL);
    setbuf(stdout, NULL);

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);

    dim0 = ROW_FACTOR*mpi_size;
    dim1 = COL_FACTOR*mpi_size;

    if (MAINPROCESS) {
        printf("===================================\n");
        printf("PHDF5 TESTS START\n");
        printf("===================================\n");
    }
    H5open();
    h5_show_hostname();

    /* Initialize testing framework */
    TestInit(argv[0], usage, parse_options);

    /* Tests are generally arranged from least to most complexity... */
    AddTest("mpiodup", test_fapl_mpio_dup, NULL,
            "fapl_mpio duplicate", NULL);
    AddTest("posixdup", test_fapl_mpiposix_dup, NULL,
            "fapl_mpiposix duplicate", NULL);

    AddTest("split", test_split_comm_access, NULL,
            "dataset using split communicators", PARATESTFILE);

    AddTest("idsetw", dataset_writeInd, NULL,
            "dataset independent write", PARATESTFILE);
    AddTest("idsetr", dataset_readInd, NULL,
            "dataset independent read", PARATESTFILE);

    AddTest("cdsetw", dataset_writeAll, NULL,
            "dataset collective write", PARATESTFILE);
    AddTest("cdsetr", dataset_readAll, NULL,
            "dataset collective read", PARATESTFILE);

    AddTest("eidsetw", extend_writeInd, NULL,
            "extendible dataset independent write", PARATESTFILE);
    AddTest("eidsetr", extend_readInd, NULL,
            "extendible dataset independent read", PARATESTFILE);
    AddTest("ecdsetw", extend_writeAll, NULL,
            "extendible dataset collective write", PARATESTFILE);
    AddTest("ecdsetr", extend_readAll, NULL,
            "extendible dataset collective read", PARATESTFILE);
    AddTest("eidsetw2", extend_writeInd2, NULL,
            "extendible dataset independent write #2", PARATESTFILE);
    AddTest("selnone", none_selection_chunk, NULL,
            "chunked dataset with none-selection", PARATESTFILE);
    AddTest("calloc", test_chunk_alloc, NULL,
            "parallel extend Chunked allocation on serial file", PARATESTFILE);
    AddTest("fltread", test_filter_read, NULL,
            "parallel read of dataset written serially with filters", PARATESTFILE);

#ifdef H5_HAVE_FILTER_DEFLATE
    AddTest("cmpdsetr", compress_readAll, NULL,
            "compressed dataset collective read", PARATESTFILE);
#endif /* H5_HAVE_FILTER_DEFLATE */

    ndsets_params.name = PARATESTFILE;
    ndsets_params.count = ndatasets;
    AddTest("ndsetw", multiple_dset_write, NULL,
            "multiple datasets write", &ndsets_params);

    ngroups_params.name = PARATESTFILE;
    ngroups_params.count = ngroups;
    AddTest("ngrpw", multiple_group_write, NULL,
            "multiple groups write", &ngroups_params);
    AddTest("ngrpr", multiple_group_read, NULL,
            "multiple groups read", &ngroups_params);

    AddTest("compact", compact_dataset, NULL,
            "compact dataset test", PARATESTFILE);

    collngroups_params.name = PARATESTFILE;
    collngroups_params.count = ngroups;
    AddTest("cngrpw", collective_group_write, NULL,
            "collective group and dataset write", &collngroups_params);
    AddTest("ingrpr", independent_group_read, NULL,
            "independent group and dataset read", &collngroups_params);
    AddTest("bigdset", big_dataset, NULL,
            "big dataset test", PARATESTFILE);
    AddTest("fill", dataset_fillvalue, NULL,
            "dataset fill value", PARATESTFILE);

    AddTest("cchunk1",
            coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
    AddTest("cchunk2",
            coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
    AddTest("cchunk3",
            coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
    AddTest("cchunk4",
            coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);

    if((mpi_size < 3)&& MAINPROCESS ) {
        printf("Collective chunk IO optimization APIs ");
        printf("needs at least 3 processes to participate\n");
        printf("Collective chunk IO API tests will be skipped \n");
    }
    AddTest((mpi_size <3)? "-cchunk5":"cchunk5" ,
            coll_chunk5,NULL,
            "linked chunk collective IO without optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6",
            coll_chunk6,NULL,
            "multi-chunk collective IO without optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7",
            coll_chunk7,NULL,
            "linked chunk collective IO with optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8",
            coll_chunk8,NULL,
            "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9",
            coll_chunk9,NULL,
            "multiple chunk collective IO with optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10",
            coll_chunk10,NULL,
            "multiple chunk collective IO transferring to independent IO",PARATESTFILE);



    /* irregular collective IO tests*/
    AddTest("ccontw",
            coll_irregular_cont_write,NULL,
            "collective irregular contiguous write",PARATESTFILE);
    AddTest("ccontr",
            coll_irregular_cont_read,NULL,
            "collective irregular contiguous read",PARATESTFILE);
    AddTest("cschunkw",
            coll_irregular_simple_chunk_write,NULL,
            "collective irregular simple chunk write",PARATESTFILE);
    AddTest("cschunkr",
            coll_irregular_simple_chunk_read,NULL,
            "collective irregular simple chunk read",PARATESTFILE);
    AddTest("ccchunkw",
            coll_irregular_complex_chunk_write,NULL,
            "collective irregular complex chunk write",PARATESTFILE);
    AddTest("ccchunkr",
            coll_irregular_complex_chunk_read,NULL,
            "collective irregular complex chunk read",PARATESTFILE);


#if 0
    if((mpi_size > 3) && MAINPROCESS) {
        printf("Collective irregular chunk IO tests haven't been tested \n");
        printf("  for the number of process greater than 3.\n");
        printf("Please try with the number of process \n");
        printf("  no greater than 3 for collective irregular chunk IO test.\n");
        printf("Collective irregular chunk tests will be skipped \n");
    }
    AddTest((mpi_size > 3) ? "-ccontw" : "ccontw",
            coll_irregular_cont_write,NULL,
            "collective irregular contiguous write",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-ccontr" : "ccontr",
            coll_irregular_cont_read,NULL,
            "collective irregular contiguous read",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-cschunkw" : "cschunkw",
            coll_irregular_simple_chunk_write,NULL,
            "collective irregular simple chunk write",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-cschunkr" : "cschunkr",
            coll_irregular_simple_chunk_read,NULL,
            "collective irregular simple chunk read",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-ccchunkw" : "ccchunkw",
            coll_irregular_complex_chunk_write,NULL,
            "collective irregular complex chunk write",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-ccchunkr" : "ccchunkr",
            coll_irregular_complex_chunk_read,NULL,
            "collective irregular complex chunk read",PARATESTFILE);
#endif


    AddTest("null", null_dataset, NULL,
            "null dataset test", PARATESTFILE);

    io_mode_confusion_params.name  = PARATESTFILE;
    io_mode_confusion_params.count = 0; /* value not used */

    AddTest("I/Omodeconf", io_mode_confusion, NULL,
            "I/O mode confusion test -- hangs quickly on failure",
            &io_mode_confusion_params);

    /* Display testing information */
    TestInfo(argv[0]);

    /* setup file access property list */
    fapl = H5Pcreate (H5P_FILE_ACCESS);
    H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);

    /* Parse command line arguments */
    TestParseCmdLine(argc, argv);

    if (facc_type == FACC_MPIPOSIX && MAINPROCESS) {
        printf("===================================\n"
               "   Using MPIPOSIX driver\n"
               "===================================\n");
    }

    if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) {
        printf("===================================\n"
               "   Using Independent I/O with file set view to replace collective I/O \n"
               "===================================\n");
    }


    /* Perform requested testing */
    PerformTests();

    /* make sure all processes are finished before final report, cleanup
     * and exit.
     */
    MPI_Barrier(MPI_COMM_WORLD);

    /* Display test summary, if requested */
    if (MAINPROCESS && GetTestSummary())
        TestSummary();

    /* Clean up test files */
    h5_cleanup(FILENAME, fapl);

    nerrors += GetTestNumErrs();

    /* Gather errors from all processes */
    {
        int temp;
        MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
        nerrors=temp;
    }

    if (MAINPROCESS) {		/* only process 0 reports */
        printf("===================================\n");
        if (nerrors)
            printf("***PHDF5 tests detected %d errors***\n", nerrors);
        else
            printf("PHDF5 tests finished with no errors\n");
        printf("===================================\n");
    }
    /* close HDF5 library */
    H5close();

    /* MPI_Finalize must be called AFTER H5close which may use MPI calls */
    MPI_Finalize();

    /* cannot just return (nerrors) because exit code is limited to 1byte */
    return(nerrors!=0);
}
Beispiel #15
0
HRESULT ViewTest2::Run()
{
	// Make a special VwGraphics (#define BASELINE in compiling it turns on special features).
	// This VwGraphics will not draw (2nd arg false) but will record attempts at drawing into
	// the baseline.
	m_psts = NewObj SilTestSite();
	m_qst.Attach(m_psts);
	m_qvg.Attach(NewObj VwGraphics(m_psts, false, true));
	m_qst->SetBaselineFile(SmartBstr(L"c:\\fw\\testlog\\log\\VwGraphics").Bstr());

	// Todo LukeU(JohnT): make an off-screen bitmap HDC and initialize the VwGraphics to use it.
	// Here is your off-screen bitmap and memory surface
	HDC hdcScr, hdcMem;
	hdcScr = GetDC(NULL);
	hdcMem = CreateCompatibleDC(hdcScr);
	HBITMAP hBitmap = CreateCompatibleBitmap(hdcMem, 400, 400);
	SelectObject(hdcMem, hBitmap);
	ReleaseDC(NULL, hdcScr);

	m_qvg->Initialize(hdcMem);

	// Make a dummy root site for the Root box to talk back to
	m_qtrs.Attach(NewObj VwTestRootSite);
	m_qtrs->SetVgObject(m_qvg);
	Rect rcSrc(0, 0, 96, 96);
	Rect rcDst(0, 0, 96, 96);
	m_qtrs->SetSrcRoot(rcSrc);
	m_qtrs->SetDstRoot(rcDst);

	// Make our view constructor.
	m_qtvc.Attach(NewObj TestStVc);

	// Put some dummy data into a cache. HVO 1 identifies the text as a whole.
	// Arbitrarily objects 2, 3, and 4 are the three paragraphs of our test data.
	m_qda.Attach(NewObj VwCacheDa);

	HVO rghvoPara[3] = {2, 3, 4};
	m_qda->CacheVecProp(1, kflidStText_Paragraphs, rghvoPara, 3);

	ITsStrFactoryPtr qtsf;
	qtsf.CreateInstance(CLSID_TsStrFactory);

	ITsStringPtr qtss;
	int enc = 100;

	StrUni stuPara0 = L"This is the first paragraph";
	StrUni stuPara1 = L"Here is another paragraph, quite silly and trivial but it should "
						L"help test things";
	StrUni stuPara2 = L"I try to keep the text in these quite different so they can't be "
						L"confused";

	CheckHr(qtsf->MakeStringRgch(stuPara0.Chars(), stuPara0.Length(), enc, &qtss));
	m_qda->CacheStringProp(rghvoPara[0], kflidStTxtPara_Contents, qtss);

	CheckHr(qtsf->MakeStringRgch(stuPara1.Chars(), stuPara1.Length(), enc, &qtss));
	m_qda->CacheStringProp(rghvoPara[1], kflidStTxtPara_Contents, qtss);

	CheckHr(qtsf->MakeStringRgch(stuPara2.Chars(), stuPara2.Length(), enc, &qtss));
	m_qda->CacheStringProp(rghvoPara[2], kflidStTxtPara_Contents, qtss);

	ITsPropsBldrPtr qtpb;
	qtpb.CreateInstance(CLSID_TsPropsBldr);
	StrUni stuNormal = L"Normal";
	CheckHr(qtpb->SetStrPropValue(kspNamedStyle, stuNormal.Bstr()));

	// Make the root box and initialize it.
	m_qrootb.CreateInstance(CLSID_VwRootBox);

	// OK, we have a root box set up. Now we can try some tests on it!
	TestInit();
	TestDataAccess();
	TestLayout(350);

	TestDrawRoot();
	TestOverlay();

	TestMakeSimpleSel();
	TestMakeTextSelection();

	TestKeys();
	TestMouse();

	Testget_Site();
	TestLoseFocus();
	TestListener();

	m_qrootb->Close();
	m_qrootb.Clear();
	m_qda.Clear();

	DeleteDC(hdcMem);
	DeleteObject(hBitmap);
	return S_OK;
}
Beispiel #16
0
	//************************************************
	//*操纵杆输入线程
	//************************************************
	DWORD WINAPI t1::InputThreadProcedure(LPVOID lpStartupParam)
	{
		// get the data we passed to the thread. Note that we don't have to use this
		// at all if we don't want
		MYDATA* pMyData = (MYDATA*)lpStartupParam;

		// access some imaginary members of MYDATA, which you can define on
		// your own later
		pMyData->nTime = GetCurrentTime(); // imaginary function I created
		pMyData->nNumber = 5;


		// here's the thread's main loop ?kind of like the main loop in WinMain
		MSG msg;
		int i;
		for (;;)
		{
			//处理外部消息
			if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
			{
				GetMessage(&msg, NULL, 0, 0);

				if (msg.message == WM_THREADSTOP)
					break; // only way out of the for( ;; ) loop

				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
			else
			{
				switch (m_TestState)
				{
				case STATE_DISPLAYINSTURCTION:
				case STATE_DISPLAYNEXT:
				case STATE_DISPLAYOPTION:
					//呈现开始选项,等待按任意键开始测试
					if (JoystickUpdate())
					{
						for (i = 0; i<8; i++)
						{
							if (IsButtonDown(KEY_YES))
							{
								m_TrialNo++;
								TestInit();
								m_TestState = STATE_DISPLAYOBJ;
								break;
							}
						}
					}
					break;
				case STATE_DISPLAYOBJ:
				case STATE_MOVINGOBJ:
					//测试过程中获得操纵杆输入
					if (JoystickUpdate())
					{
						JoyX = GetXAxis();//GetYAxis();//
						JoyY = GetYAxis();//-GetZAxis();//
						if (m_Setting.m_MoveMode == MODE_MOVEROATE)
						{
							JoyZ = GetZAxis();//GetXAxis();//
							post_fai = (float)(JoyZ - post_fai0)*(3600.0 / 1024.0) / m_HardSetting.m_KnobSensitive;//GetZAxis()*PI/400.0;
							while (post_fai<-180)
							{
								post_fai = post_fai + 360;
							}
							while (post_fai>180)
							{
								post_fai = post_fai - 360;
							}
						}
					}
					break;
				case STATE_OVER:
					//测试结束,等待按任意键退出
					if (JoystickUpdate())
					{
						for (i = 0; i<12; i++)
						{
							if (IsButtonDown(i))
							{
								PostThreadMessage(dwInputThreadID, WM_THREADSTOP, 0, 0);
								m_TestState = STATE_NEXT;// STATE_EXIT --> STATE_NEXT
							}
						}
					}
					break;
				default:
					break;
				}
				// do the task ?add in your own stuff here

				// yield to other threads, because we almost never get messages
				// (note that we may be yielding to WinMain too)
				//以键盘代替操纵杆
				if (JOY == 0)
				{
					if (IsButtonDown(DIK_ESCAPE))
					{
						PostThreadMessage(dwInputThreadID, WM_THREADSTOP, 0, 0);
						m_TestState = STATE_EXIT;
					}
				}
			}
			Sleep(1);
		}
		g_nThreadExitCount++;
		return 0;
	}
/**
 * Provide an alternate "main loop" via StartCompetition().
 * 
 * This specific StartCompetition() implements "main loop" behaviour synced with the DS packets
 */
void IterativeRobot::StartCompetition()
{
	HALReport(HALUsageReporting::kResourceType_Framework, HALUsageReporting::kFramework_Iterative);

	LiveWindow *lw = LiveWindow::GetInstance();
	// first and one-time initialization
	SmartDashboard::init();
	NetworkTable::GetTable("LiveWindow")->GetSubTable("~STATUS~")->PutBoolean("LW Enabled", false);
	RobotInit();

    // We call this now (not in Prestart like default) so that the robot
    // won't enable until the initialization has finished. This is useful
    // because otherwise it's sometimes possible to enable the robot
    // before the code is ready.
	HALNetworkCommunicationObserveUserProgramStarting();

	// loop forever, calling the appropriate mode-dependent function
	lw->SetEnabled(false);
	while (true)
	{
		// Call the appropriate function depending upon the current robot mode
		if (IsDisabled())
		{
			// call DisabledInit() if we are now just entering disabled mode from
			// either a different mode or from power-on
			if(!m_disabledInitialized)
			{
				lw->SetEnabled(false);
				DisabledInit();
				m_disabledInitialized = true;
				// reset the initialization flags for the other modes
				m_autonomousInitialized = false;
                m_teleopInitialized = false;
                m_testInitialized = false;
			}
			HALNetworkCommunicationObserveUserProgramDisabled();
			DisabledPeriodic();
		}
		else if (IsAutonomous())
		{
			// call AutonomousInit() if we are now just entering autonomous mode from
			// either a different mode or from power-on
			if(!m_autonomousInitialized)
			{
				lw->SetEnabled(false);
				AutonomousInit();
				m_autonomousInitialized = true;
				// reset the initialization flags for the other modes
				m_disabledInitialized = false;
                m_teleopInitialized = false;
                m_testInitialized = false;
			}
			HALNetworkCommunicationObserveUserProgramAutonomous();
			AutonomousPeriodic();
		}
        else if (IsTest())
        {
            // call TestInit() if we are now just entering test mode from
            // either a different mode or from power-on
            if(!m_testInitialized)
            {
            	lw->SetEnabled(true);
                TestInit();
                m_testInitialized = true;
                // reset the initialization flags for the other modes
                m_disabledInitialized = false;
                m_autonomousInitialized = false;
                m_teleopInitialized = false;
            }
            HALNetworkCommunicationObserveUserProgramTest();
            TestPeriodic();
        }
		else
		{
			// call TeleopInit() if we are now just entering teleop mode from
			// either a different mode or from power-on
			if(!m_teleopInitialized)
			{
				lw->SetEnabled(false);
				TeleopInit();
				m_teleopInitialized = true;
				// reset the initialization flags for the other modes
				m_disabledInitialized = false;
                m_autonomousInitialized = false;
                m_testInitialized = false;
                Scheduler::GetInstance()->SetEnabled(true);
			}
			HALNetworkCommunicationObserveUserProgramTeleop();
			TeleopPeriodic();
		}
		// wait for driver station data so the loop doesn't hog the CPU
		m_ds->WaitForData();
	}	
}
int main(int argc,
         char **argv) {
  int                     opt;
  uint64_t                sleep_start_usec = kDefaultSleepStartMicroSeconds;
  uint64_t                sleep_end_usec = kDefaultSleepEndMicroSeconds;
  uint64_t                sleep_incr_usec = kDefaultSleepIncrMicroSeconds;
  uint64_t                sleep_usec;
  uint64_t                min_sleep;
  uint64_t                max_sleep;
  uint64_t                total_usec;
  char                    *nacl_verbosity = getenv("NACLVERBOSITY");
  struct TestFunctorArg   arg;

  int                     alarmer = 1;

  static void             (*const test_tbl[])(void *) = {
    TestAbsWait, TestRelWait,
  };

  size_t                  ix;

  while (EOF != (opt = getopt(argc, argv,"aAc:C:e:f:F:i:s:v"))) {
    switch (opt) {
      case 'a':
        alarmer = 1;
        break;
      case 'A':
        alarmer = 0;
        break;
      case 'c':
        gSchedulerMinFuzzConst = strtoul(optarg, (char **) 0, 0);
        break;
      case 'C':
        gSchedulerMaxMin = strtoul(optarg, (char **) 0, 0);
        break;
      case 'e':
        sleep_end_usec = strtoul(optarg, (char **) 0, 0);
        break;
      case 'f':
        gSchedulerMinFuzzFactor = atof(optarg);
        break;
      case 'F':
        gSchedulerMaxFuzzFactor = atof(optarg);
        break;
      case 'i':
        sleep_incr_usec = strtoul(optarg, (char **) 0, 0);
        break;
      case 's':
        sleep_start_usec = strtoul(optarg, (char **) 0, 0);
        break;
      case 'v':
        ++gVerbosity;
        break;
      default:
        fprintf(stderr,
                "Usage: nacl_sync_cond_test [flags]\n"
                " where flags specify the range of condition variable\n"
                " wait times:\n"
                " -a use an alarm thread to detect significant oversleep\n"
                " -A do not use an alarm thread\n"
                " -s start microseconds\n"
                " -e end microseconds\n"
                " -i increment microseconds\n"
                " -f scheduler fuzz factor (double; for min elapsed time)\n"
                " -F scheduler fuzz factor (double; max elapsed time)\n"
                " -c scheduler fuzz constant (int, uS)\n"
                "    allow actual elapsed time to be this much less\n"
                "    than requested.\n"
                " -C scheduler fuzz constant (int, uS)\n"
                "    max allowed elapsed time is at least this\n"
                );
        return 1;
    }
  }

  NaClAllModulesInit();
  NaClLogSetVerbosity((NULL == nacl_verbosity)
                      ? 0 : strtol(nacl_verbosity, (char **) 0, 0));

  TestInit();
  ASSERT_MSG(sleep_end_usec > sleep_start_usec,
             "nonsensical start/end times");
  ASSERT_MSG(0 < sleep_incr_usec,
             "nonsensical increment time");

  /*
   * sum of [m..n) by k is (m+n)(n-m)/k/2, and we run Rel and Abs, so
   * the expected time is twice the sum
   */
  total_usec = (sleep_end_usec + sleep_start_usec)
      * (sleep_end_usec - sleep_start_usec) / sleep_incr_usec;

  printf("Test should take approximately %"NACL_PRId64
         ".%06"NACL_PRId64" seconds"
         " on an unloaded machine.\n",
         total_usec / kMicroXinX, total_usec % kMicroXinX);
  for (sleep_usec = sleep_start_usec;
       sleep_usec < sleep_end_usec;
       sleep_usec += sleep_incr_usec) {
    if (gVerbosity) {
      printf("testing wait limit of %"NACL_PRId64
             " microseconds.\n", sleep_usec);
    }
    arg.sleep_usec = sleep_usec;
    min_sleep = (int64_t) (gSchedulerMinFuzzFactor * sleep_usec);
    if (min_sleep < gSchedulerMinFuzzConst) {
      min_sleep = 0;
    } else {
      min_sleep -= gSchedulerMinFuzzConst;
    }
    max_sleep = (uint64_t) (gSchedulerMaxFuzzFactor * sleep_usec);
    if (max_sleep < gSchedulerMaxMin) {
      max_sleep = gSchedulerMaxMin;
    }

    for (ix = 0; ix < NACL_ARRAY_SIZE(test_tbl); ++ix) {
      FunctorDelays(test_tbl[ix], &arg, sleep_usec, min_sleep, max_sleep,
                    alarmer);
    }
  }
  TestFini();

  NaClAllModulesFini();
  printf("PASS\n");
  return 0;
}
Beispiel #19
0
/**
 * Provide an alternate "main loop" via StartCompetition().
 *
 * This specific StartCompetition() implements "main loop" behavior like that of the FRC
 * control system in 2008 and earlier, with a primary (slow) loop that is
 * called periodically, and a "fast loop" (a.k.a. "spin loop") that is
 * called as fast as possible with no delay between calls.
 */
void IterativeRobot::StartCompetition()
{
	LiveWindow *lw = LiveWindow::GetInstance();
	// first and one-time initialization
	SmartDashboard::init();
	NetworkTable::GetTable("LiveWindow")->GetSubTable("~STATUS~")->PutBoolean("LW Enabled", false);
	RobotInit();

	// loop forever, calling the appropriate mode-dependent function
	lw->SetEnabled(false);
	while (true)
	{
		// Call the appropriate function depending upon the current robot mode
		if (IsDisabled())
		{
			// call DisabledInit() if we are now just entering disabled mode from
			// either a different mode or from power-on
			if(!m_disabledInitialized)
			{
				lw->SetEnabled(false);
				DisabledInit();
				m_disabledInitialized = true;
				// reset the initialization flags for the other modes
				m_autonomousInitialized = false;
                m_teleopInitialized = false;
                m_testInitialized = false;
			}
			if (NextPeriodReady())
			{
				// TODO: HALNetworkCommunicationObserveUserProgramDisabled();
				DisabledPeriodic();
			}
		}
		else if (IsAutonomous())
		{
			// call AutonomousInit() if we are now just entering autonomous mode from
			// either a different mode or from power-on
			if(!m_autonomousInitialized)
			{
				lw->SetEnabled(false);
				AutonomousInit();
				m_autonomousInitialized = true;
				// reset the initialization flags for the other modes
				m_disabledInitialized = false;
                m_teleopInitialized = false;
                m_testInitialized = false;
			}
			if (NextPeriodReady())
			{
				// TODO: HALNetworkCommunicationObserveUserProgramAutonomous();
				AutonomousPeriodic();
			}
		}
        else if (IsTest())
        {
            // call TestInit() if we are now just entering test mode from
            // either a different mode or from power-on
            if(!m_testInitialized)
            {
            	lw->SetEnabled(true);
                TestInit();
                m_testInitialized = true;
                // reset the initialization flags for the other modes
                m_disabledInitialized = false;
                m_autonomousInitialized = false;
                m_teleopInitialized = false;
            }
            if (NextPeriodReady())
            {
                // TODO: HALNetworkCommunicationObserveUserProgramTest();
                TestPeriodic();
            }
        }
		else
		{
			// call TeleopInit() if we are now just entering teleop mode from
			// either a different mode or from power-on
			if(!m_teleopInitialized)
			{
				lw->SetEnabled(false);
				TeleopInit();
				m_teleopInitialized = true;
				// reset the initialization flags for the other modes
				m_disabledInitialized = false;
                m_autonomousInitialized = false;
                m_testInitialized = false;
                Scheduler::GetInstance()->SetEnabled(true);
			}
			if (NextPeriodReady())
			{
				// TODO: HALNetworkCommunicationObserveUserProgramTeleop();
				TeleopPeriodic();
			}
		}
		// wait for driver station data so the loop doesn't hog the CPU
		m_ds.WaitForData();
	}
}
Beispiel #20
0
 /**
 * @brief This sets up this suite
 *
 * @return 0 success, otherwise failure
 */
 FCT_SETUP_BGN() {
     TestInit();
     memset(write_buffer, 0, WRITE_BUFFER_SIZE);
     attoHTTPInit();
 }