Esempio n. 1
0
int
main (void)
{	static double src_ratios [] =
	{	1.0001, 0.099, 0.1, 0.33333333, 0.789, 1.9, 3.1, 9.9
	} ;

	int k ;

	puts ("") ;

	puts ("    Zero Order Hold interpolator :") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		simple_test (SRC_ZERO_ORDER_HOLD, src_ratios [k]) ;

	puts ("    Linear interpolator :") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		simple_test (SRC_LINEAR, src_ratios [k]) ;

	puts ("    Sinc interpolator :") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		simple_test (SRC_SINC_FASTEST, src_ratios [k]) ;

	puts ("") ;

	return 0 ;
} /* main */
int
main()
    {
    simple_test();
    thread_test();
    return boost::report_errors();
    }
Esempio n. 3
0
int main( int argc, char** argv){
  int num;
  if( argc != 2 ){
    fprintf( stderr, "Incorrect Arguments!\n");
    return 1;
  }
  num = atoi( argv[1]);
  simple_test();
  big_test( num);
  return 0;
}
Esempio n. 4
0
int main(int argc , char ** argv) {
  
  if (argc == 1) {
    simple_test();
    thread_test();
  } else
    ecl_test( argv[1] );

  
  
  exit(0);
}
Esempio n. 5
0
int test_jnxsignal() {

  JNXLOG(LDEBUG,"Testing signals and slots\n");	
  simple_test(); //one thread

  simple_threaded_test();

  dual_slot_test();

  cross_thread_slot_test();

  sleep(1);
  return 0;
}
int
main (void)
{
	puts ("\n    Zero Order Hold interpolator :") ;
	simple_test		(SRC_ZERO_ORDER_HOLD, 1, 45.0) ;
	process_test	(SRC_ZERO_ORDER_HOLD, 1, 45.0) ;
	callback_test	(SRC_ZERO_ORDER_HOLD, 1, 45.0) ;
	simple_test		(SRC_ZERO_ORDER_HOLD, 2, 44.0) ;
	process_test	(SRC_ZERO_ORDER_HOLD, 2, 44.0) ;
	callback_test	(SRC_ZERO_ORDER_HOLD, 2, 44.0) ;
	simple_test		(SRC_ZERO_ORDER_HOLD, 3, 44.0) ;
	process_test	(SRC_ZERO_ORDER_HOLD, 3, 44.0) ;
	callback_test	(SRC_ZERO_ORDER_HOLD, 3, 44.0) ;

	puts ("\n    Linear interpolator :") ;
	simple_test		(SRC_LINEAR, 1, 92.0) ;
	process_test	(SRC_LINEAR, 1, 92.0) ;
	callback_test	(SRC_LINEAR, 1, 92.0) ;
	simple_test		(SRC_LINEAR, 2, 90.0) ;
	process_test	(SRC_LINEAR, 2, 90.0) ;
	callback_test	(SRC_LINEAR, 2, 90.0) ;
	simple_test		(SRC_LINEAR, 3, 88.0) ;
	process_test	(SRC_LINEAR, 3, 88.0) ;
	callback_test	(SRC_LINEAR, 3, 88.0) ;

	puts ("\n    Sinc interpolator :") ;
	simple_test		(SRC_SINC_FASTEST, 1, 100.0) ;
	process_test	(SRC_SINC_FASTEST, 1, 100.0) ;
	callback_test	(SRC_SINC_FASTEST, 1, 100.0) ;
	simple_test		(SRC_SINC_FASTEST, 2, 100.0) ;
	process_test	(SRC_SINC_FASTEST, 2, 100.0) ;
	callback_test	(SRC_SINC_FASTEST, 2, 100.0) ;
	simple_test		(SRC_SINC_FASTEST, 3, 100.0) ;
	process_test	(SRC_SINC_FASTEST, 3, 100.0) ;
	callback_test	(SRC_SINC_FASTEST, 3, 100.0) ;

	puts ("") ;

	return 0 ;
} /* main */
Esempio n. 7
0
int main(int argc, char **argv){


  printf("test read filenames in dir\n");
  
  unsigned int nbfiles = 0;
  char **files = readfilenames(TESTDIR, &nbfiles);
  assert(nbfiles == 3);
  
  printf("test audio hash\n");
  test_audiohash();
  printf("simple test\n");
  simple_test();
  printf("io test\n");
  io_test();
  printf("done\n");

  return 0;
}
Esempio n. 8
0
int
main (void)
{	static double src_ratios [] =
	{	0.999900, 1.000100, 0.789012, 1.200000, 0.333333, 3.100000,
		0.125000, 8.000000, 0.099900, 9.990000, 0.100000, 10.00000
	} ;

	int k ;

	puts ("\n    Zero Order Hold interpolator:") ;

	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		init_term_test (SRC_ZERO_ORDER_HOLD, src_ratios [k]) ;
	puts ("") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		stream_test (SRC_ZERO_ORDER_HOLD, src_ratios [k]) ;


	puts ("\n    Linear interpolator:") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		init_term_test (SRC_LINEAR, src_ratios [k]) ;
	puts ("") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		stream_test (SRC_LINEAR, src_ratios [k]) ;


	puts ("\n    Sinc interpolator:") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		init_term_test (SRC_SINC_FASTEST, src_ratios [k]) ;
	puts ("") ;
	for (k = 0 ; k < ARRAY_LEN (src_ratios) ; k++)
		stream_test (SRC_SINC_FASTEST, src_ratios [k]) ;

	puts ("") ;

	simple_test (SRC_SINC_FASTEST) ;

	return 0 ;
} /* main */
Esempio n. 9
0
main(int argc, char *argv[])
{
	char	*opt;
	int		i, n;

	init_serial("/dev/ttyS0");
	init_lircd("/var/tmp/lircd");

	if (argc == 2 && strcmp(argv[1], "test") == 0) {
		simple_test();
		exit(0);
	}
	
	StopRobot(); /* turn it off to start with */

	n = 0;
	do {
		opt = get_irkey();
		if (opt) {
			syslog(LOG_INFO, "PalmBot - %s\n", opt);
			for (i = 0; command[i].key_name; i++)
				if (strcmp(command[i].key_name, opt) == 0) {
					n = i;
					break;
				}
		}
		if (command[n].key_name) {
			syslog(LOG_INFO, "Run command '%s'\n", command[n].key_name);
			(*command[n].func)();
		}
	} while (command[n].key_name);

	StopRobot(); /* turn it off to end with */

	exit(0);
}
Esempio n. 10
0
int main_internal(string_array cmd_line, int num_helper_threads, ilzham &lzham_dll)
{
   comp_options options;
   options.m_max_helper_threads = num_helper_threads;

#ifdef _XBOX
   options.m_dict_size_log2 = 21;
#endif

   if (!cmd_line.size())
   {
      print_usage();
      return simple_test(lzham_dll, options);
   }

   enum op_mode_t
   {
      OP_MODE_INVALID = -1,
      OP_MODE_COMPRESS = 0,
      OP_MODE_DECOMPRESS = 1,
      OP_MODE_ALL = 2
   };

   op_mode_t op_mode = OP_MODE_INVALID;

   for (int i = 0; i < (int)cmd_line.size(); i++)
   {
      const std::string &str = cmd_line[i];
      if (str[0] == '-')
      {
         if (str.size() < 2)
         {
            print_error("Invalid option: %s\n", str.c_str());
            return EXIT_FAILURE;
         }
         switch (tolower(str[1]))
         {
            case 'u':
            {
               options.m_unbuffered_decompression = true;
               break;
            }
            case 'd':
            {
               int dict_size = atoi(str.c_str() + 2);
               if ((dict_size < LZHAM_MIN_DICT_SIZE_LOG2) || (dict_size > LZHAMTEST_MAX_POSSIBLE_DICT_SIZE))
               {
                  print_error("Invalid dictionary size: %s\n", str.c_str());
                  return EXIT_FAILURE;
               }
               options.m_dict_size_log2 = dict_size;
               break;
            }
            case 'm':
            {
               int comp_level = atoi(str.c_str() + 2);
               if ((comp_level < 0) || (comp_level > (int)LZHAM_COMP_LEVEL_UBER))
               {
                  print_error("Invalid compression level: %s\n", str.c_str());
                  return EXIT_FAILURE;
               }
               options.m_comp_level = static_cast<lzham_compress_level>(comp_level);
               break;
            }
            case 't':
            {
               int num_threads = atoi(str.c_str() + 2);
               if ((num_threads < 0) || (num_threads > LZHAM_MAX_HELPER_THREADS))
               {
                  print_error("Invalid number of helper threads: %s\n", str.c_str());
                  return EXIT_FAILURE;
               }
               options.m_max_helper_threads = num_threads;
               break;
            }
            case 'c':
            {
               options.m_compute_adler32_during_decomp = false;
               break;
            }
            case 'v':
            {
               options.m_verify_compressed_data = true;
               break;
            }
            case 'r':
            {
               options.m_randomize_params = true;
               break;
            }
            case 'p':
            {
               options.m_force_polar_codes = true;
               break;
            }
            case 'x':
            {
               options.m_extreme_parsing = true;
               break;
            }
            case 'e':
            {
               options.m_deterministic_parsing = true;
               break;
            }
            case 's':
            {
               int seed = atoi(str.c_str() + 2);
               srand(seed);
               printf("Using random seed: %i\n", seed);
               break;
            }
            default:
            {
               print_error("Invalid option: %s\n", str.c_str());
               return EXIT_FAILURE;
            }
         }

         cmd_line.erase(cmd_line.begin() + i);
         i--;

         continue;
      }

      if (str.size() != 1)
      {
         print_error("Invalid mode: %s\n", str.c_str());
         return EXIT_FAILURE;
      }
      switch (tolower(str[0]))
      {
         case 'c':
         {
            op_mode = OP_MODE_COMPRESS;
            break;
         }
         case 'd':
         {
            op_mode = OP_MODE_DECOMPRESS;
            break;
         }
         case 'a':
         {
            op_mode = OP_MODE_ALL;
            break;
         }
         default:
         {
            print_error("Invalid mode: %s\n", str.c_str());
            return EXIT_FAILURE;
         }
      }
      cmd_line.erase(cmd_line.begin() + i);
      break;
   }

   if (op_mode == OP_MODE_INVALID)
   {
      print_error("No mode specified!\n");
      print_usage();
      return EXIT_FAILURE;
   }

   printf("Using options:\n");
   options.print();
   printf("\n");

   int exit_status = EXIT_FAILURE;

   switch (op_mode)
   {
      case OP_MODE_COMPRESS:
      {
         if (cmd_line.size() < 2)
         {
            print_error("Must specify input and output filenames!\n");
            return EXIT_FAILURE;
         }
         else if (cmd_line.size() > 2)
         {
            print_error("Too many filenames!\n");
            return EXIT_FAILURE;
         }

         const std::string &src_file = cmd_line[0];
         const std::string &cmp_file = cmd_line[1];

         bool comp_result = compress_streaming(lzham_dll, src_file.c_str(), cmp_file.c_str(), options);
         if (comp_result)
            exit_status = EXIT_SUCCESS;

         if ((comp_result) && (options.m_verify_compressed_data))
         {
            char decomp_file[256];

#ifdef _XBOX
            sprintf(decomp_file, "e:\\__decomp_temp_%u__.tmp", (uint)GetTickCount());
#else
            sprintf(decomp_file, "__decomp_temp_%u__.tmp", (uint)timer::get_ms());
#endif
            if (!decompress_file(lzham_dll, cmp_file.c_str(), decomp_file, options))
            {
               print_error("Failed decompressing file \"%s\" to \"%s\"\n", cmp_file.c_str(), decomp_file);
               return EXIT_FAILURE;
            }

            printf("Comparing file \"%s\" to \"%s\"\n", decomp_file, src_file.c_str());

            if (!compare_files(decomp_file, src_file.c_str()))
            {
               print_error("Failed comparing decompressed file data while compressing \"%s\" to \"%s\"\n", src_file.c_str(), cmp_file.c_str());
               return EXIT_FAILURE;
            }
            else
            {
               printf("Decompressed file compared OK to original file.\n");
            }

            remove(decomp_file);
         }

         break;
      }
      case OP_MODE_DECOMPRESS:
      {
         if (cmd_line.size() < 2)
         {
            print_error("Must specify input and output filenames!\n");
            return EXIT_FAILURE;
         }
         else if (cmd_line.size() > 2)
         {
            print_error("Too many filenames!\n");
            return EXIT_FAILURE;
         }
         if (decompress_file(lzham_dll, cmd_line[0].c_str(), cmd_line[1].c_str(), options))
            exit_status = EXIT_SUCCESS;
         break;
      }
      case OP_MODE_ALL:
      {
         if (!cmd_line.size())
         {
            print_error("No directory specified!\n");
            return EXIT_FAILURE;
         }
         else if (cmd_line.size() != 1)
         {
            print_error("Too many filenames!\n");
            return EXIT_FAILURE;
         }
         if (test_recursive(lzham_dll, cmd_line[0].c_str(), options))
            exit_status = EXIT_SUCCESS;
         break;
      }
      default:
      {
         print_error("No mode specified!\n");
         print_usage();
         return EXIT_FAILURE;
      }
   }

   return exit_status;
}
Esempio n. 11
0
int main(int argc, char** argv)
{
    func_args server_args;

    tcp_ready ready;
    THREAD_TYPE serverThread;

#ifdef HAVE_CAVIUM
        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
        if (ret != 0)
            err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

    StartTCP();

    server_args.argc = argc;
    server_args.argv = argv;

    CyaSSL_Init();
#if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND)
    CyaSSL_Debugging_ON();
#endif

    if (CurrentDir("testsuite") || CurrentDir("_build"))
        ChangeDirBack(1);
    else if (CurrentDir("Debug") || CurrentDir("Release"))
        ChangeDirBack(3);          /* Xcode->Preferences->Locations->Locations*/
                                   /* Derived Data Advanced -> Custom  */
                                   /* Relative to Workspace, Build/Products */
                                   /* Debug or Release */
    server_args.signal = &ready;
    InitTcpReady(&ready);

    /* CTaoCrypt test */
    ctaocrypt_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;
 
    /* Simple CyaSSL client server test */
    simple_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;

    /* Echo input yaSSL client server test */
    start_thread(echoserver_test, &server_args, &serverThread);
    wait_tcp_ready(&server_args);
    {
        func_args echo_args;
        char* myArgv[NUMARGS];

        char argc0[32];
        char argc1[32];
        char argc2[32];

        myArgv[0] = argc0;
        myArgv[1] = argc1;
        myArgv[2] = argc2;

        echo_args.argc = NUMARGS;
        echo_args.argv = myArgv;
   
        strcpy(echo_args.argv[0], "echoclient");
        strcpy(echo_args.argv[1], "input");
        strcpy(echo_args.argv[2], outputName);
        remove(outputName);

        /* Share the signal, it has the new port number in it. */
        echo_args.signal = server_args.signal;

        /* make sure OK */
        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;  

#ifdef CYASSL_DTLS
        wait_tcp_ready(&server_args);
#endif
        /* send quit to echoserver */
        echo_args.argc = 2;
        strcpy(echo_args.argv[1], "quit");

        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;
        join_thread(serverThread);
        if (server_args.return_code != 0) return server_args.return_code;
    }

    /* validate output equals input */
    {
        byte input[SHA256_DIGEST_SIZE];
        byte output[SHA256_DIGEST_SIZE];

        file_test("input",  input);
        file_test(outputName, output);
        if (memcmp(input, output, sizeof(input)) != 0)
            return EXIT_FAILURE;
    }

    CyaSSL_Cleanup();
    FreeTcpReady(&ready);

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif
    printf("\nAll tests passed!\n");
    return EXIT_SUCCESS;
}
Esempio n. 12
0
int testsuite_test(int argc, char** argv)
{
    func_args server_args;

    tcp_ready ready;
    THREAD_TYPE serverThread;

#ifndef USE_WINDOWS_API
    char tempName[] = "/tmp/output-XXXXXX";
    int len = 18;
    int num = 6;
#else
    char tempName[] = "fnXXXXXX";
    int len = 8;
    int num = 6;
#endif

#ifdef HAVE_CAVIUM
        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
        if (ret != 0)
            err_sys("Cavium OpenNitroxDevice failed");
#endif /* HAVE_CAVIUM */

#ifdef HAVE_WNR
        if (wc_InitNetRandom(wnrConfig, NULL, 5000) != 0) {
            err_sys("Whitewood netRandom global config failed");
            return -1237;
        }
#endif /* HAVE_WNR */

    StartTCP();

    server_args.argc = argc;
    server_args.argv = argv;

    wolfSSL_Init();
#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
    wolfSSL_Debugging_ON();
#endif

#if !defined(WOLFSSL_TIRTOS)
	ChangeToWolfRoot();
#endif

#ifdef WOLFSSL_TIRTOS
    fdOpenSession(Task_self());
#endif

    server_args.signal = &ready;
    InitTcpReady(&ready);

#ifndef NO_CRYPT_TEST
    /* wc_ test */
    wolfcrypt_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;
#endif

    /* Simple wolfSSL client server test */
    simple_test(&server_args);
    if (server_args.return_code != 0) return server_args.return_code;

    /* Echo input wolfSSL client server test */
    start_thread(echoserver_test, &server_args, &serverThread);
    wait_tcp_ready(&server_args);
    {
        func_args echo_args;
        char* myArgv[NUMARGS];

        char argc0[32];
        char argc1[32];
        char argc2[32];

        myArgv[0] = argc0;
        myArgv[1] = argc1;
        myArgv[2] = argc2;

        echo_args.argc = 3;
        echo_args.argv = myArgv;

        /* Create unique file name */
        outputName = mymktemp(tempName, len, num);
        if (outputName == NULL) {
            printf("Could not create unique file name");
            return EXIT_FAILURE;
        }

        strcpy(echo_args.argv[0], "echoclient");
        strcpy(echo_args.argv[1], "input");
        strcpy(echo_args.argv[2], outputName);

        /* Share the signal, it has the new port number in it. */
        echo_args.signal = server_args.signal;

        /* make sure OK */
        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;

#ifdef WOLFSSL_DTLS
        wait_tcp_ready(&server_args);
#endif
        /* send quit to echoserver */
        echo_args.argc = 2;
        strcpy(echo_args.argv[1], "quit");

        echoclient_test(&echo_args);
        if (echo_args.return_code != 0) return echo_args.return_code;
        join_thread(serverThread);
        if (server_args.return_code != 0) return server_args.return_code;
    }

    /* show ciphers */
    {
        char ciphers[1024];
        XMEMSET(ciphers, 0, sizeof(ciphers));
        wolfSSL_get_ciphers(ciphers, sizeof(ciphers)-1);
        printf("ciphers = %s\n", ciphers);
    }

    /* validate output equals input */
    {
        byte input[SHA256_DIGEST_SIZE];
        byte output[SHA256_DIGEST_SIZE];

        file_test("input",  input);
        file_test(outputName, output);
        remove(outputName);
        if (memcmp(input, output, sizeof(input)) != 0)
            return EXIT_FAILURE;
    }

    wolfSSL_Cleanup();
    FreeTcpReady(&ready);

#ifdef WOLFSSL_TIRTOS
    fdCloseSession(Task_self());
#endif

#ifdef HAVE_CAVIUM
        CspShutdown(CAVIUM_DEV_ID);
#endif

#ifdef HAVE_WNR
    if (wc_FreeNetRandom() < 0)
        err_sys("Failed to free netRandom context");
#endif /* HAVE_WNR */

    printf("\nAll tests passed!\n");
    return EXIT_SUCCESS;
}
Esempio n. 13
0
 *         Author:  Adriaan, 
 *        Company:  Uppsala IT
 *
 * =====================================================================================
 */

#include "open.h"
#include "unit.h"

int tests_run = 0;
int tests_set = 2;

TEST(getModule)
    MODDATA temp = Functions();
    CHECK("Did not get the functions module",temp.t == STRUCTURE);
DONE

TEST(getGettr)
    DATA temp = simple_test();
    CHECK("Did not get the boolean",temp.t == BOOLEAN);
    CHECK("Result is not true",temp.value == 1);
DONE

LIST
    RUN(getModule);
    RUN(getGettr);
DONE

INCLUDE_MAIN

int main() {
  simple_test();
  simple_delete_test();
  bulk_add_test();
  return 0;
}
Esempio n. 15
0
int main(int argc, char *argv[])
{
    simple_test();
    return 0;
}
Esempio n. 16
0
int main(int argc, char **argv)
{
  double r1, r2, r3;
  int i, do_simple_test, tcpsize;
  ibp_capset_t *caps_list, *base_caps;
  rid_t rid;
  int port;
  char buffer[1024];
  apr_time_t stime, dtime;
  double dt;
  char *ppath;
  phoebus_t pcc;
  char pstr[2048];

  base_caps = NULL;

  if (argc < 12) {
     printf("\n");
     printf("ibp_perf [-d|-dd] [-config ibp.cfg] [-phoebus gateway_list] [-tcpsize tcpbufsize]\n");
     printf("           [-duration duration] [-sync] [-alias]\n");
     printf("          n_depots depot1 port1 resource_id1 ... depotN portN ridN\n");
     printf("          nthreads ibp_timeout\n");
     printf("          alias_createremove_count createremove_count\n");
     printf("          readwrite_count readwrite_alloc_size rw_block_size read_mix_fraction\n");
     printf("          smallio_count small_min_size small_max_size small_read_fraction\n");
     printf("\n");
     printf("-d                  - Enable *minimal* debug output\n");
     printf("-dd                 - Enable *FULL* debug output\n");
     printf("-config ibp.cfg     - Use the IBP configuration defined in file ibp.cfg.\n");
     printf("                      nthreads overrides value in cfg file unless -1.\n");
     printf("-phoebus            - Use Phoebus protocol for data transfers.\n");
     printf("   gateway_list     - Comma separated List of phoebus hosts/ports, eg gateway1/1234,gateway2/4321\n");
     printf("-tcpsize tcpbufsize - Use this value, in KB, for the TCP send/recv buffer sizes\n");
     printf("-duration duration  - Allocation duration in sec.  Needs to be big enough to last the entire\n");
     printf("                      run.  The default duration is %d sec.\n", a_duration);
     printf("-sync               - Use synchronous protocol.  Default uses async.\n");
     printf("-alias              - Use alias allocations for all I/O operations\n");
     printf("n_depots            - Number of depot tuplets\n");
     printf("depot               - Depot hostname\n");
     printf("port                - IBP port on depot\n"); 
     printf("resource_id         - Resource ID to use on depot\n");
     printf("nthreads            - Max Number of simultaneous threads to use.  Use -1 for defaults or value in ibp.cfg\n");
     printf("ibp_timeout         - Timeout(sec) for each IBP copmmand\n");
     printf("alias_createremove_count* - Number of 0 byte files to create and remove using alias allocations\n");
     printf("createremove_count* - Number of 0 byte files to create and remove to test metadata performance\n");
     printf("readwrite_count*    - Number of files to write sequentially then read sequentially\n");
     printf("readwrite_alloc_size  - Size of each allocation in KB for sequential and random tests\n");
     printf("rw_block_size       - Size of each R/W operation in KB for sequential and random tests\n");
     printf("read_mix_fraction   - Fraction of Random I/O operations that are READS\n");
     printf("smallio_count*      - Number of random small I/O operations\n");
     printf("small_min_size      - Minimum size of each small I/O operation(kb)\n");
     printf("small_max_size      - Max size of each small I/O operation(kb)\n");
     printf("small_read_fraction - Fraction of small random I/O operations that are READS\n");
     printf("\n");
     printf("*If the variable is set to 0 then the test is skipped\n");
     printf("\n");

     return(-1);
  }

  ibp_init();  //** Initialize IBP

  i = 1;
  if (strcmp(argv[i], "-d") == 0) { //** Enable debugging
     set_log_level(5);
     i++;
  }
  if (strcmp(argv[i], "-dd") == 0) { //** Enable debugging
     set_log_level(20);
     i++;
  }

  if (strcmp(argv[i], "-config") == 0) { //** Read the config file
     i++;
     ibp_load_config(argv[i]);
     i++;
  }

  if (strcmp(argv[i], "-phoebus") == 0) { //** Check if we want Phoebus transfers
     cc = (ibp_connect_context_t *)malloc(sizeof(ibp_connect_context_t));
     cc->type = NS_TYPE_PHOEBUS;
     i++;

     ppath = argv[i];
     phoebus_path_set(&pcc, ppath);
     cc->data = &pcc;
     i++;
  }

  if (strcmp(argv[i], "-tcpsize") == 0) { //** Check if we want sync tests
     i++;
     tcpsize = atoi(argv[i]) * 1024;
     ibp_set_tcpsize(tcpsize);
     i++;
  }

  if (strcmp(argv[i], "-duration") == 0) { //** Check if we want sync tests
     i++;
     a_duration = atoi(argv[i]);
     i++;
  }

  sync_transfer = 0;
  if (strcmp(argv[i], "-sync") == 0) { //** Check if we want sync tests
     sync_transfer = 1;
     i++;
  }

  use_alias = 0;
  if (strcmp(argv[i], "-alias") == 0) { //** Check if we want to use alias allocation
     use_alias = 1;
     i++;
  }

  do_simple_test = 0;
  if (strcmp(argv[i], "-simpletest") == 0) { //** Just do the simple test
     do_simple_test = 1;
     i++;
  }

  n_depots = atoi(argv[i]);
  i++;

  depot_list = (ibp_depot_t *)malloc(sizeof(ibp_depot_t)*n_depots);
  int j;
  for (j=0; j<n_depots; j++) {
      port = atoi(argv[i+1]);
      rid = ibp_str2rid(argv[i+2]);
      set_ibp_depot(&(depot_list[j]), argv[i], port, rid);
      i = i + 3;
  }

  //*** Get thread count ***
  nthreads = atoi(argv[i]);
  if (nthreads <= 0) { 
     nthreads = ibp_get_max_depot_threads();
  } else {
     ibp_set_max_depot_threads(nthreads);
  }
  i++;

  ibp_timeout = atoi(argv[i]); i++;

   //****** Get the different Stream counts *****
  int aliascreateremove_count = atoi(argv[i]); i++;
  int createremove_count = atoi(argv[i]); i++;
  int readwrite_count = atoi(argv[i]); i++;
  int readwrite_size = atoi(argv[i])*1024; i++;
  int rw_block_size = atoi(argv[i])*1024; i++;
  double read_mix_fraction = atof(argv[i]); i++;

   //****** Get the different small I/O counts *****
  int smallio_count = atoi(argv[i]); i++;
  int small_min_size = atoi(argv[i])*1024; i++;
  int small_max_size = atoi(argv[i])*1024; i++;
  double small_read_fraction = atof(argv[i]); i++;

  //*** Print the ibp client version ***
  printf("\n");
  printf("================== IBP Client Version =================\n");
  printf("%s\n", ibp_client_version());

  //*** Print summary of options ***
  printf("\n");
  printf("======= Base options =======\n");
  printf("n_depots: %d\n", n_depots);
  for (i=0; i<n_depots; i++) {
     printf("depot %d: %s:%d rid:%s\n", i, depot_list[i].host, depot_list[i].port, ibp_rid2str(depot_list[i].rid, buffer));
  }
  printf("\n");
  printf("IBP timeout: %d\n", ibp_timeout);
  printf("Max Threads: %d\n", nthreads);
 if (sync_transfer == 1) {
     printf("Transfer_mode: SYNC\n");
  } else {
     printf("Transfer_mode: ASYNC\n");
  }
  printf("Use alias: %d\n", use_alias);

  if (cc != NULL) {
     switch (cc->type) {
       case NS_TYPE_SOCK:
          printf("Connection Type: SOCKET\n"); break;
       case NS_TYPE_PHOEBUS:
          phoebus_path_to_string(pstr, sizeof(pstr), &pcc); 
          printf("Connection Type: PHOEBUS (%s)\n", pstr); break;
       case NS_TYPE_1_SSL:
          printf("Connection Type: Single SSL\n"); break;
       case NS_TYPE_2_SSL:
          printf("Connection Type: Dual SSL\n"); break;
     }
  } else {
    printf("Connection Type: SOCKET\n");
  }
  printf("TCP buffer size: %dkb (0 defaults to OS)\n", ibp_get_tcpsize()/1024);
  printf("\n");

  printf("======= Bulk transfer options =======\n");
  printf("aliascreateremove_count: %d\n", aliascreateremove_count);
  printf("createremove_count: %d\n", createremove_count);
  printf("readwrite_count: %d\n", readwrite_count);
  printf("readwrite_alloc_size: %dkb\n", readwrite_size/1024);
  printf("rw_block_size: %dkb\n", rw_block_size/1024);
  printf("read_mix_fraction: %lf\n", read_mix_fraction);
  printf("\n");
  printf("======= Small Random I/O transfer options =======\n");
  printf("smallio_count: %d\n", smallio_count);
  printf("small_min_size: %dkb\n", small_min_size/1024);
  printf("small_max_size: %dkb\n", small_max_size/1024);
  printf("small_read_fraction: %lf\n", small_read_fraction);
  printf("\n");

  r1 =  1.0 * readwrite_size/1024.0/1024.0;
  r1 = readwrite_count * r1;
  printf("Approximate I/O for sequential tests: %lfMB\n", r1);
  printf("\n");

  if (do_simple_test == 1) { 
     simple_test(nthreads);
     return(0);
  }

  //**************** Create/Remove tests ***************************
  if (aliascreateremove_count > 0) {
     i = aliascreateremove_count/nthreads;
     printf("Starting Alias create test (total files: %d, approx per thread: %d)\n",aliascreateremove_count, i);
     base_caps = create_allocs(1, 1);
     stime = apr_time_now();
     caps_list = create_alias_allocs(aliascreateremove_count, base_caps, 1);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*aliascreateremove_count/dt;
     printf("Alias create : %lf creates/sec (%.2lf sec total) \n", r1, dt);

     stime = apr_time_now();
     alias_remove_allocs(caps_list, base_caps, aliascreateremove_count, 1);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*aliascreateremove_count/dt;
     printf("Alias remove : %lf removes/sec (%.2lf sec total) \n", r1, dt);
     printf("\n");

printf("-----------------------------\n"); fflush(stdout);

     remove_allocs(base_caps, 1);

     printf("\n");
  }

  if (createremove_count > 0) {
     i = createremove_count/nthreads;
     printf("Starting Create test (total files: %d, approx per thread: %d)\n",createremove_count, i);

     stime = apr_time_now();
     caps_list = create_allocs(createremove_count, 1);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*createremove_count/dt;
     printf("Create : %lf creates/sec (%.2lf sec total) \n", r1, dt);

     stime = apr_time_now();
     remove_allocs(caps_list, createremove_count);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*createremove_count/dt;
     printf("Remove : %lf removes/sec (%.2lf sec total) \n", r1, dt);
     printf("\n");
  }

  //**************** Read/Write tests ***************************
  if (readwrite_count > 0) {
     i = readwrite_count/nthreads;
     printf("Starting Bulk tests (total files: %d, approx per thread: %d", readwrite_count, i);
     r1 = 1.0*readwrite_count*readwrite_size/1024.0/1024.0;
     r2 = r1 / nthreads;
     printf(" -- total size: %lfMB, approx per thread: %lfMB\n", r1, r2);

     printf("Creating allocations...."); fflush(stdout);
     stime = apr_time_now();
     caps_list = create_allocs(readwrite_count, readwrite_size);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*readwrite_count/dt;
     printf(" %lf creates/sec (%.2lf sec total) \n", r1, dt);

     if (use_alias) {
        base_caps = caps_list;
        printf("Creating alias allocations...."); fflush(stdout);
        stime = apr_time_now();
        caps_list = create_alias_allocs(readwrite_count, base_caps, readwrite_count);
        dtime = apr_time_now() - stime;
        dt = dtime / (1.0 * APR_USEC_PER_SEC);
        r1 = 1.0*readwrite_count/dt;
        printf(" %lf creates/sec (%.2lf sec total) \n", r1, dt);
     }

     stime = apr_time_now();
     write_allocs(caps_list, readwrite_count, readwrite_size, rw_block_size);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*readwrite_count*readwrite_size/(dt*1024*1024);
     printf("Write: %lf MB/sec (%.2lf sec total) \n", r1, dt);

     stime = apr_time_now();
     read_allocs(caps_list, readwrite_count, readwrite_size, rw_block_size);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*readwrite_count*readwrite_size/(dt*1024*1024);
     printf("Read: %lf MB/sec (%.2lf sec total) \n", r1, dt);

     stime = apr_time_now();
     random_allocs(caps_list, readwrite_count, readwrite_size, rw_block_size, read_mix_fraction);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*readwrite_count*readwrite_size/(dt*1024*1024);
     printf("Random: %lf MB/sec (%.2lf sec total) \n", r1, dt);

     //**************** Small I/O tests ***************************
     if (smallio_count > 0) {
        if (small_min_size == 0) small_min_size = 1;
        if (small_max_size == 0) small_max_size = 1;

        printf("\n");
        printf("Starting Small Random I/O tests...\n");

        stime = apr_time_now();
        r1 = small_write_allocs(caps_list, readwrite_count, readwrite_size, smallio_count, small_min_size, small_max_size);
        dtime = apr_time_now() - stime;
        dt = dtime / (1.0 * APR_USEC_PER_SEC);
        r1 = r1/(1024.0*1024.0);
        r2 = r1/dt;
        r3 = smallio_count; r3 = r3 / dt;
        printf("Small Random Write: %lf MB/sec (%.2lf sec total using %lfMB or %.2lf ops/sec) \n", r2, dt, r1, r3);

        stime = apr_time_now();
        r1 = small_read_allocs(caps_list, readwrite_count, readwrite_size, smallio_count, small_min_size, small_max_size);
        dtime = apr_time_now() - stime;
        dt = dtime / (1.0 * APR_USEC_PER_SEC);
        r1 = r1/(1024.0*1024.0);
        r2 = r1/dt;
        r3 = smallio_count; r3 = r3 / dt;
        printf("Small Random Read: %lf MB/sec (%.2lf sec total using %lfMB or %.2lf ops/sec) \n", r2, dt, r1, r3);

        stime = apr_time_now();
        r1 = small_random_allocs(caps_list, readwrite_count, readwrite_size, small_read_fraction, smallio_count, small_min_size, small_max_size);
        dtime = apr_time_now() - stime;
        dt = dtime / (1.0 * APR_USEC_PER_SEC);
        r1 = r1/(1024.0*1024.0);
        r2 = r1/dt;
        r3 = smallio_count; r3 = r3 / dt;
        printf("Small Random R/W: %lf MB/sec (%.2lf sec total using %lfMB or %.2lf ops/sec) \n", r2, dt, r1, r3);
     }

     if (use_alias) {
        printf("Removing alias allocations...."); fflush(stdout);
        stime = apr_time_now();
        alias_remove_allocs(caps_list, base_caps, readwrite_count, readwrite_count);
        dtime = apr_time_now() - stime;
        dt = dtime / (1.0 * APR_USEC_PER_SEC);
        r1 = 1.0*readwrite_count/dt;
        printf(" %lf removes/sec (%.2lf sec total) \n", r1, dt);

        caps_list = base_caps;
     }

     printf("Removing allocations...."); fflush(stdout);
     stime = apr_time_now();
     remove_allocs(caps_list, readwrite_count);
     dtime = apr_time_now() - stime;
     dt = dtime / (1.0 * APR_USEC_PER_SEC);
     r1 = 1.0*readwrite_count/dt;
     printf(" %lf removes/sec (%.2lf sec total) \n", r1, dt);
     printf("\n");

  }  

  printf("Final network connection counter: %d\n", network_counter(NULL));

  ibp_finalize();  //** Shutdown IBP

  return(0);
}