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

	testInit( &argc, argv );

	getExtensionEntries(  );

	palBombOnError(  );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	alSourcePlay( movingSource );

	shouldend = time( NULL );
	while( ( shouldend - start ) <= 10 ) {
		iterate(  );

		shouldend = time( NULL );
		if( ( shouldend - start ) > 10 ) {
			alSourceStop( movingSource );
		}
	}

	testExit();

	return EXIT_SUCCESS;
}
Beispiel #2
0
int CXXTest::doTests()
{
	LOG_INFO("Running CXX tests");

	if (testInit() != TEST_PASS) { FAIL("C++ init test failed"); }

	if (testCreate() != TEST_PASS) { FAIL("pthread_create test failed"); }

	if (testSelf() != TEST_PASS) { FAIL("pthread_self test failed"); }

	if (testExit() != TEST_PASS) { FAIL("pthread_exit test failed"); }

	return TEST_PASS;
}
Beispiel #3
0
int main( int argc, char *argv[] )
{
	ALCdevice *device;
	time_t shouldend;
	int attributeList[3];

	attributeList[0] = ALC_FREQUENCY;
	attributeList[1] = 22050;
	attributeList[2] = 0;

	device = alcOpenDevice( NULL );
	if( device == NULL ) {
		return EXIT_FAILURE;
	}

	fprintf( stderr, "CreateContext:\n" );
	cc = alcCreateContext( device, attributeList );
	sleep( 1 );
	fprintf( stderr, "Destroy:\n" );
	alcDestroyContext( cc );
	sleep( 1 );
	fprintf( stderr, "CreateContext\n" );
	cc = alcCreateContext( device, attributeList );
	sleep( 1 );

	alcMakeContextCurrent( cc );

	testInitWithoutContext( &argc, argv );
	
	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	alSourcei( movingSource, AL_LOOPING, AL_TRUE );
	alSourcePlay( movingSource );
	alSourceStop( movingSource );
	alSourcePlay( movingSource );

	shouldend = time( NULL );
	while( ( shouldend - start ) <= 10 ) {
		iterate(  );

		shouldend = time( NULL );
	}
	
	testExit();

	alcDestroyContext( cc );

	return EXIT_SUCCESS;
}
int main( int argc, char *argv[] )
{
	ALCdevice *device;
	time_t shouldend;
	int attributeList[] = { ALC_FREQUENCY, 22050,
		0
	};

	device = alcOpenDevice( NULL );
	if( device == NULL ) {
		return EXIT_FAILURE;
	}

	cc = alcCreateContext( device, attributeList );
	if( cc == NULL ) {
		alcCloseDevice( device );

		return EXIT_FAILURE;
	}

	alcMakeContextCurrent( cc );

	testInitWithoutContext( &argc, argv );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	alSourcef( movingSource, AL_PITCH, 1.15 );

	alSourcePlay( movingSource );

	shouldend = time( NULL );
	while( ( shouldend - start ) <= 20 ) {
		iterate(  );

		shouldend = time( NULL );
		if( ( shouldend - start ) > 20 ) {
			alSourceStop( movingSource );
		}
		sleep( 1 );
	}

	testExit();

	alcDestroyContext( cc );
	alcCloseDevice( device );

	return EXIT_SUCCESS;
}
int main( int argc, char *argv[] )
{
	testInit( &argc, argv );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	start(  );

	while( sourceIsPlaying( multis ) == AL_TRUE ) {
		microSleep( 1000000 );
		microSleep( 1000000 );
		microSleep( 1000000 );
		microSleep( 1000000 );
	}

	testExit();

	return EXIT_SUCCESS;
}
int main( int argc, char *argv[] )
{
	ALCdevice *device;
	int attributeList[] = { ALC_FREQUENCY, 22050, 0 };
	time_t start;
	time_t shouldend;

	start = time( NULL );
	shouldend = time( NULL );

	device = alcOpenDevice( NULL );
	if( device == NULL ) {
		return EXIT_FAILURE;
	}

	/* Initialize ALUT. */
	context = alcCreateContext( device, attributeList );
	if( context == NULL ) {
		alcCloseDevice( device );
		return EXIT_FAILURE;
	}

	alcMakeContextCurrent( context );

	testInitWithoutContext( &argc, argv );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	while( shouldend - start < 30 ) {
		shouldend = time( NULL );

		iterate(  );
	}

	testExit();

	alcDestroyContext( context );
	alcCloseDevice( device );

	return EXIT_SUCCESS;
}
int main( int argc, char *argv[] )
{
	time_t shouldend;

	/* Initialize ALUT. */
	testInit( &argc, argv );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	alSourcePlay( movingSource );
	while( 1 ) {
		shouldend = time( NULL );
		if( ( shouldend - start ) > 40 ) {
			break;
		}

		iterate(  );
	}

	testExit(  );

	return EXIT_SUCCESS;
}
Beispiel #8
0
int main( int argc, char *argv[] )
{
	ALCdevice *device;
	int attributeList[] = { ALC_FREQUENCY, 22050, 0 };

	time_t shouldend, start;
	ALint test = AL_FALSE;

	device = alcOpenDevice( NULL );
	if( device == NULL ) {
		return EXIT_FAILURE;
	}

	/* Initialize ALUT. */
	context = alcCreateContext( device, attributeList );
	if( context == NULL ) {
		alcCloseDevice( device );

		exit( EXIT_FAILURE );
	}

	alcMakeContextCurrent( context );

	testInitWithoutContext( &argc, argv );

	getExtensionEntries(  );

	palBombOnError(  );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	fprintf( stderr, "Loop for 4 seconds\n" );

	alSourcePlay( movingSource );

	shouldend = start = time( NULL );

	while( shouldend - start <= 4 ) {
		shouldend = time( NULL );

		microSleep( 1000000 );
	}
	alSourceStop( movingSource );

	test = -1;

	alGetSourceiv( movingSource, AL_LOOPING, &test );
	fprintf( stderr, "is looping?  getsi says %s\n",
		 ( test == AL_TRUE ) ? "AL_TRUE" : "AL_FALSE" );

	/* part the second */
	fprintf( stderr, "Play once\n" );
	microSleep( 1000000 );

	alSourcei( movingSource, AL_LOOPING, AL_FALSE );
	alSourcePlay( movingSource );

	do {
		microSleep( 1000000 );
	}
	while( sourceIsPlaying( movingSource ) );

	testExit();

	alcDestroyContext( context );
	alcCloseDevice( device );

	return EXIT_SUCCESS;
}
int main( int argc, char *argv[] )
{
	time_t shouldend;

	start = time( NULL );
	shouldend = time( NULL );

	testInit( &argc, argv );

	getExtensionEntries(  );

	init( ( const ALbyte * ) ( ( argc == 1 ) ? WAVEFILE : argv[1] ) );

	palBombOnError(  );

#if 0
	alSourceStop( multis[0] );
	fprintf( stderr, "Play a source\n" );
	alSourcePlay( multis[0] );
	fprintf( stderr, "Stop previous source\n" );
	alSourceStop( multis[0] );
	fprintf( stderr, "Stop a stopped source\n" );
	alSourceStop( multis[0] );
	fprintf( stderr, "Play a stopped source\n" );
	alSourcePlay( multis[0] );
	fprintf( stderr, "Play a playing source\n" );
	alSourcePlay( multis[0] );
	fprintf( stderr, "Delete a playing Source\n" );
	alDeleteSources( 1, multis );
	fprintf( stderr, "Play a deleted source\n" );
	alSourcePlay( multis[0] );
#endif

	alGetError(  );

	fprintf( stderr, "play\n" );
	alSourcePlay( multis[0] );
	sleep( 2 );
	fprintf( stderr, "delete\n" );
	alDeleteBuffers( 1, &boom );
	fprintf( stderr, "Checking deferred deletion (shouldn't be valid)\n" );
	if( alIsBuffer( boom ) ) {
		fprintf( stderr, "deleted buffer is valid buffer\n" );
	} else {
		fprintf( stderr, "deleted buffer is not valid buffer\n" );
	}
	sleep( 2 );
	fprintf( stderr, "stop\n" );
	alSourceStop( multis[0] );
	sleep( 2 );
	fprintf( stderr, "Checking after source stop (shouldn't be valid)\n" );
	if( alIsBuffer( boom ) ) {
		fprintf( stderr, "deleted buffer is valid buffer\n" );
	} else {
		fprintf( stderr, "deleted buffer is not valid buffer\n" );
	}
	fprintf( stderr, "play again: prepare to hose\n" );
	alSourcePlay( multis[0] );
	fprintf( stderr, "error: %s\n", alGetString( alGetError(  ) ) );
	sleep( 2 );

	testExit();

	return EXIT_SUCCESS;
}
Beispiel #10
0
int main()
{
    static const char         testFilename[] = "/sd/sdtst.bin";
    static const unsigned int testFileSize = 10 * 1024 * 1024;
    static Timer              timer;
    FILE*                     pFile = NULL;
    size_t                    bytesTransferred = 0;
    size_t                    i = 0;
    int                       seekResult = -1;
    static __attribute((section("AHBSRAM0"),aligned)) unsigned char buffer[16 * 1024];
    static __attribute((section("AHBSRAM1"),aligned)) char          cache[16 * 1024];


    // Remove the test file if it already exists.
    printf("Cleanup from previous test run.\n");
    remove(testFilename);
    checkSdLog(&g_sd);

    // Dump information about card that might make it easier to interpret performance data later.
    dumpCID(&g_sd);
    dumpOCR(&g_sd);
    dumpCSD(&g_sd);

    printf("Performing write test of %u bytes...\n", testFileSize);
    memset(buffer, 0x55, sizeof(buffer));
    pFile = fopen(testFilename, "w");
    checkSdLog(&g_sd);
    if (!pFile)
    {
        fprintf(stderr, "error: Failed to create %s - %d\n", testFilename, errno);
        testExit(&g_sd, -1);
    }
    setvbuf(pFile, cache, _IOFBF, sizeof(cache));

    timer.start();
    for (i = 0 ; i < testFileSize / sizeof(buffer) ; i++)
    {
        bytesTransferred = fwrite(buffer, 1, sizeof(buffer), pFile);
        checkSdLog(&g_sd);
        if (bytesTransferred != sizeof(buffer))
        {
            fprintf(stderr, "error: Failed to write to %s - %d\n", testFilename, errno);
            break;
        }
    }
    unsigned int totalTicks = (unsigned int)timer.read_ms();
    unsigned int totalBytes = ftell(pFile);
    fclose(pFile);
    checkSdLog(&g_sd);

    float writeRate = (totalBytes / (totalTicks / 1000.0f)) / (1000.0f * 1000.0f);
    printf("    %.2f MB/second.\n", writeRate);


    printf("Performing read test of %u bytes...\n", testFileSize);
    pFile = fopen(testFilename, "r");
    checkSdLog(&g_sd);
    if (!pFile)
    {
        fprintf(stderr, "error: Failed to open %s - %d\n", testFilename, errno);
        testExit(&g_sd, -1);
    }
    setvbuf(pFile, cache, _IOFBF, sizeof(cache));

    timer.reset();
    for (;;)
    {
        bytesTransferred = fread(buffer, 1, sizeof(buffer), pFile);
        checkSdLog(&g_sd);
        if (bytesTransferred != sizeof(buffer))
        {
            if (ferror(pFile))
            {
                fprintf(stderr, "error: Failed to read from %s - %d\n", testFilename, errno);
                testExit(&g_sd, -1);
            }
            else
            {
                break;
            }
        }
    }
    totalTicks = (unsigned int)timer.read_ms();
    totalBytes = ftell(pFile);

    float readRate = (totalBytes / (totalTicks / 1000.0f)) / (1000.0f * 1000.0f);
    printf("    %.2f MB/second.\n", readRate);


    printf("Validating data on disk.\n");
    seekResult = fseek(pFile, 0, SEEK_SET);
    checkSdLog(&g_sd);
    if (seekResult)
    {
        fprintf(stderr, "error: Failed to seek to beginning of file - %d\n", errno);
        testExit(&g_sd, -1);
    }

    for (;;)
    {
        unsigned int   j;
        unsigned char* pCurr;

        memset(buffer, 0xaa, sizeof(buffer));
        bytesTransferred = fread(buffer, 1, sizeof(buffer), pFile);
        checkSdLog(&g_sd);
        if (bytesTransferred != sizeof(buffer) && ferror(pFile))
        {
            fprintf(stderr, "error: Failed to read from %s - %d\n", testFilename, errno);
            testExit(&g_sd, -1);
        }

        for (j = 0, pCurr = buffer ; j < bytesTransferred ; j++)
        {
            unsigned char byte = *pCurr++;
            if (byte != 0x55)
            {
                fprintf(stderr, "error: Unexpected read byte (0x%02X) encountered.\n", byte);
                testExit(&g_sd, -1);
            }
        }

        if (bytesTransferred != sizeof(buffer))
            break;
    }
    totalBytes = ftell(pFile);
    printf("Validated %u bytes.\n", totalBytes);
    fclose(pFile);

    printf("Removing test file.\n");
    int removeResult = remove(testFilename);
    checkSdLog(&g_sd);
    if (removeResult)
    {
        fprintf(stderr, "error: remove() failed - %d\n", errno);
        testExit(&g_sd, -1);
    }


    dumpSdCounters(&g_sd);
    printf("Test Completed!\n");

    return 0;
}