void init_test_request_options(oss_request_options_t *options, int is_cname) { options->config = oss_config_create(options->pool); init_test_config(options->config, is_cname); options->ctl = aos_http_controller_create(options->pool, 0); }
int main(int argc, char *argv[]) { char configFile[1024], interface[25]; int createflag, unitflag, cleanflag; extern int logflag; int create_f, clean_f, log_f; createflag = unitflag = cleanflag = FALSE; create_f = clean_f, FLAG_NOT_SET; // Begin command line parsing *********************************************** if ( (checkForOption("--help", argc, argv) != FLAG_NOT_SET) || (checkForOption("-h", argc, argv) != FLAG_NOT_SET) || (checkForOption("-help", argc, argv) != FLAG_NOT_SET) ) { print_help(); } get_asf_share_dir_with_argv0(argv[0]); handle_license_and_version_args(argc, argv, ASF_NAME_STRING); // Check which options were provided create_f = checkForOption("-create", argc, argv); clean_f = checkForOption("-clean", argc, argv); log_f = checkForOption("-log", argc, argv); // We need to make sure the user specified the proper number of arguments int needed_args = 1 + REQUIRED_ARGS; // command & REQUIRED_ARGS int num_flags = 0; if (create_f != FLAG_NOT_SET) {needed_args += 1; num_flags++;} // option if (clean_f != FLAG_NOT_SET) {needed_args += 1; num_flags++;} // option if (log_f != FLAG_NOT_SET) {needed_args += 2; num_flags++;} // option & param // Make sure we have the right number of args if (argc != needed_args) { print_usage(); } // Make sure argument for each flag (that requires an arg) is not another // option flag & is not a required argument if (log_f != FLAG_NOT_SET) { if ((argv[log_f+1][0]=='-') || (log_f>=(argc-REQUIRED_ARGS))) { print_usage(); } } // Make sure all options occur before the config file name argument if (num_flags == 1 && (create_f > 1 || log_f > 1)) { print_usage(); } else if (num_flags > 1 && (create_f >= argc - REQUIRED_ARGS - 1 || log_f >= argc - REQUIRED_ARGS - 1)) { print_usage(); } // Do the actual flagging & such for each flag if (create_f != FLAG_NOT_SET) { createflag = TRUE; } if (clean_f != FLAG_NOT_SET) { cleanflag = TRUE; } if (log_f != FLAG_NOT_SET) { strcpy(logFile, argv[log_f+1]); logflag = TRUE; fLog = FOPEN(logFile, "w"); } // Fetch required arguments strcpy(interface, argv[argc-2]); strcpy(configFile, argv[argc-1]); // Report the command line asfSplashScreen(argc, argv); // End command line parsing ************************************************* // Get test information from configuration file test_config *cfg; char line[1024]; // Creating configuration files if (createflag && !fileExists(configFile)) { init_test_config(configFile); return(EXIT_SUCCESS); } else if (createflag && fileExists(configFile)) { cfg = read_test_config(configFile); check_return(write_test_config(configFile, cfg), "Could not update configuration file"); free_test_config(cfg); return(EXIT_SUCCESS); } else if (!fileExists(configFile)) asfPrintError("Could not find config file (%s)\n", configFile); // Unit tests or single configuration file? if (strcmp_case(interface, "basic") == 0 || strcmp_case(interface, "automated") == 0) unitflag = TRUE; if (unitflag) { extern int quietflag; quietflag = 2; if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); int test = FALSE; FILE *fpList = FOPEN(configFile, "r"); while(fgets(line, 1024, fpList)) { if (strcmp_case(trim_spaces(line), "uavsar_metadata") == 0) add_uavsar_metadata_tests(); if (strcmp_case(trim_spaces(line), "uavsar_geotiff") == 0) add_uavsar_geotiff_tests(); if (strcmp_case(trim_spaces(line), "rsat1_map_projections") == 0) add_rsat1_map_projections_tests(); if (strcmp_case(trim_spaces(line), "rsat1_geotiff") == 0) add_rsat1_geotiff_tests(); if (strcmp_case(trim_spaces(line), "alos_browse") == 0) add_alos_browse_tests(); if (strcmp_case(trim_spaces(line), "alos_leader") == 0) add_alos_leader_tests(); if (strcmp_case(trim_spaces(line), "rsat1_overlay") == 0) add_rsat1_overlay_tests(); if (strcmp_case(trim_spaces(line), "alos_calibration") == 0) add_alos_calibration_tests(); test = TRUE; } FCLOSE(fpList); if (test && strcmp_case(interface, "basic") == 0) { asfPrintStatus("Running tests in basic mode ...\n"); CU_basic_set_mode(CU_BRM_VERBOSE); if (CUE_SUCCESS != CU_basic_run_tests()) { CU_cleanup_registry(); return CU_get_error(); } } if (test && strcmp_case(interface, "automated") == 0) { asfPrintStatus("Running tests in automated mode ...\n\n"); CU_set_output_filename("asf_tools"); CU_automated_run_tests(); CU_list_tests_to_file(); } CU_cleanup_registry(); if (cleanflag) cleanup_test_results(configFile); } else { // Configuration file for manual mode cfg = read_test_config(configFile); asfPrintStatus("Running tests in manual mode ...\n\n"); // Run metadata tests if (strcmp_case(cfg->general->type, "metadata") == 0) manual_metadata(configFile); // Run geotiff tests else if (strcmp_case(cfg->general->type, "geotiff") == 0) manual_geotiff(configFile); // Run binary tests else if (strcmp_case(cfg->general->type, "binary") == 0) manual_binary(configFile); // Run library tests else if (strcmp_case(cfg->general->type, "library") == 0) manual_library(configFile); free_test_config(cfg); } return(EXIT_SUCCESS); }