Exemplo n.º 1
0
static void run_single_test(char *argv[])
{
    int32_t rtrn = 0;

    if(strncmp(argv[1], "runtime", 7) == 0)
    {
        rtrn = exec_test(test_paths[RUNTIME_TEST]);
        if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            return;
        }
    }
    else if(strncmp(argv[1], "genetic", 7) == 0)
    {
        rtrn = exec_test(test_paths[GENETIC_TEST]);
        if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            return;
        }
    }
    else if(strncmp(argv[1], "syscall", 7) == 0)
    {
        rtrn = exec_test(test_paths[SYSCALL_TEST]);
        if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            return;
        }
    }
    else if(strncmp(argv[1], "resource", 8) == 0)
    {
        rtrn = exec_test(test_paths[RESOURCE_TEST]);
        if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            return;
        }
    }
    else if(strncmp(argv[1], "memory", 6) == 0)
    {
        rtrn = exec_test(test_paths[MEMORY_TEST]);
        if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            return;
        }
    }

    return;
}
Exemplo n.º 2
0
static int		create_pth(t_env *env, char *arg, char *bins)
{
	char	*pth;
	char	*tmp;
	int		ret;

	tmp = NULL;
	if (!bins)
	{
		if (*arg == '.' && !(bins = getcwd(NULL, 0)))
			return (RESET_PUT("getcwd error", NULL));
		if (*arg == '~')
		{
			if (cd_pth(env, ENV_HOME_EQ, &tmp) != EXIT_SUCCESS)
				return (EXIT_FAILURE);
			bins = tmp;
		}
	}
	pth = ft_strdup3(bins, "/", arg);
	if (tmp)
		ft_strdel(&tmp);
	if (!pth)
		return (RESET_PUT("strdup3 error", NULL));
	ret = exec_test(env, &pth);
	ft_strdel(&pth);
	return (ret);
}
Exemplo n.º 3
0
int				exec_bin(t_env *env)
{
	char	**bins;
	int		i;
	int		ret;

	i = 0;
	if ((*E_ARG[0] == '.' || *E_ARG[0] == '~'))
		return (ft_reset(env, create_pth(env, E_ARG[0], NULL)));
	else if (*E_ARG[0] == '/'
			&& exec_test(env, &E_CUR) == EXIT_SUCCESS)
		return (ft_reset(env, EXIT_SUCCESS));
	else if ((i = get_arg_env(env, ENV_PATH_EQ)) >= 0)
	{
		if (!(bins = ft_strsplit(E_ENV[i] + ft_strlen(ENV_PATH_EQ), ':')))
			return (RESET_PUT("strsplit error", NULL));
		ret = 0;
		i = 0;
		while (bins[i] && (ret = create_pth(env, E_ARG[0], bins[i]) < 0))
			i++;
		ft_freechar2(&bins);
		if (ret == EXIT_SUCCESS)
			return (ft_reset(env, ret));
	}
	return (RESET_PUT("command not found: ", E_ARG[0]));
}
Exemplo n.º 4
0
int main() {
  // Init buffer
  uint8_t test1[] = {0xff, 0xff, 0x01, 0x03, 0x01, 0x01, 0xf9};
  uint8_t test2[] = {0xff, 0xff, 0x01, 0x04, 0x02, 0x2b, 0x01, 0xcc};
  uint8_t test3[] = {0xff, 0xff, 0x01, 0x04, 0x02, 0x2b, 0x01, 0xcc};
  uint8_t test4[] = {0xff, 0xff, 0x01, 0x03, 0x00, 0x20, 0xdb};
  uint8_t test5[] = {0xff, 0xff, 0x01, 0x04, 0x03, 0x03, 0x01, 0xf3};// Fallo ID
  uint8_t test6[] = {0xff, 0xff, 0x01, 0x04, 0x03, 0x03, 0x01, 0xf3};

  uint8_t* tests[] = {test1, test2, test3, test4, test5, test6};
  uint8_t lengths[] = {7,8,8,7,8,8};
  uint8_t results[] = {1,1,1,1,1,1};

  init_buffer();
  int i;
  for(i=0; i<6; ++i)
  {
    printf("TEST %i: ", i);
    exec_test(tests[i], lengths[i]);
    if (msgFinish_ == results[i])
    {
      printf("[OK]\n");
    }
    else
    {
      printf("[FAILED]\n");
      print_buffer(lengths[i]);
    }
    reset();
    init_buffer();
  }
  return(0);
}
Exemplo n.º 5
0
 * 该函数为调试主程序,想调用哪个测试例程,就在这里调用它吧 :-)
 */
void debug(void)
{
//	set_fs_test();
//	d_delay(100000);

	creat_lseek_read_write_open_close_file_test();
	produce_files_test();
Exemplo n.º 6
0
int main(int argc, char *argv[])
{
    uint32_t i = 0;
    int32_t rtrn = 0;

    /* Create the stats object. */
    test_stat = create_stats_obj();
    if(test_stat == NULL)
    {
        output(ERROR, "Can't create stats object\n");
        return (-1);
    }

    /* Set stats members to zero. */
    test_stat->fails = 0;
    test_stat->test_ran = 0;
    test_stat->successes = 0;
    test_stat->asserts_ran = 0;

    if(argc == 1)
    {
        output(STD, "Starting nextgen's test suite\n");
    }
    else
    {
        run_single_test(argv);
        return (0);
    }

    /* Loop and execute each test in the test array. */
    for(i = 0; i < number_of_test; i++)
    {
        /* Execute the unit test. */
    	rtrn = exec_test(test_paths[i]); 
    	if(rtrn < 0)
        {
            output(ERROR, "Can't exec unit test\n");
            /* Continue executing the test suite. */
    	    continue;
        }
    }

    /* Output results. */
    output(STD, "[%d] %ld successful assertions, %ld tests passed, and %ld tests failed.\n", \
          (100 * test_stat->successes) / test_stat->test_ran, test_stat->asserts_ran, test_stat->successes, test_stat->fails);

	return (0);
}
Exemplo n.º 7
0
HARNESS_EXPORT
int main( int argc, char * argv[] ) {
    MinThread = 3000;
    ParseCommandLine( argc, argv );
    if( MinThread <= 0 ) {
        tbb::task_scheduler_init init( 2 ); // even number required for an error
    } else {
        for(int i = 0; i<MinThread; i++) {
            if(exec_test(argv[0])) {
                REPORT("ERROR: execution fails at %d-th iteration!\n", i);
                exit(1);
            }
        }
        REPORT("done\n");
    }
}
Exemplo n.º 8
0
/*-----------------------------------------------------------------------------
*	If g_run_test defined, run test in a subprocess
*	If g_run_test is NULL, run test callback only if test name matches
*	Set g_test_result to 1 if test did not return 0
*----------------------------------------------------------------------------*/
void run_test_(int expect_result, char *test_name, test_cb test_func)
{
	int result = 0;

	if (g_run_test == NULL) {	/* no command line arguments, run all tests */
		result = exec_test(expect_result, test_name);
		g_nr_tests_run++;
	}
	else if (strcmp(g_run_test, test_name) == 0) {	/* test name in command line, 
													   call test_func if test matches */
		result = test_func();
		g_nr_tests_run++;
	}
	else {
		;						/* test does not match, skipped */
	}

	if (result != 0) {
		g_test_result = 1;
	}
}
Exemplo n.º 9
0
void
piglit_init(int argc, char **argv)
{
    struct test_info *info;
    enum piglit_result result = PIGLIT_PASS;
    int sample_count;
    int max_samples;

    if (argc != 2)
        usage(argc, argv);

    sample_count = atoi(argv[1]);
    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
    if (sample_count > max_samples) {
        printf("Sample count of %d not supported.\n", sample_count);
        piglit_report_result(PIGLIT_SKIP);
    }

    for (info = tests; info->name; info++)
        piglit_report_subtest_result(exec_test(info, sample_count), info->name);

    piglit_report_result(result);
}
Exemplo n.º 10
0
BOOL CALLBACK PluginsCfg(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
    char path_buffer[_MAX_PATH];
    int index;
                          
    switch(Message)
    {
        case WM_CLOSE:
              EndDialog(hwnd, IDOK);  
        break;
        case WM_INITDIALOG:
            rewind_plugin();           
            while(get_plugin_type() != -1) {
                switch (get_plugin_type())
                {
                case PLUGIN_TYPE_GFX:
                    SendDlgItemMessage(hwnd, IDC_COMBO_GFX, CB_ADDSTRING, 0, (LPARAM)next_plugin());
                    break;
                case PLUGIN_TYPE_CONTROLLER:
                    SendDlgItemMessage(hwnd, IDC_COMBO_INPUT, CB_ADDSTRING, 0, (LPARAM)next_plugin());
                    break;
                case PLUGIN_TYPE_AUDIO:
                    SendDlgItemMessage(hwnd, IDC_COMBO_SOUND, CB_ADDSTRING, 0, (LPARAM)next_plugin());
                    break;
                case PLUGIN_TYPE_RSP:
                    SendDlgItemMessage(hwnd, IDC_COMBO_RSP, CB_ADDSTRING, 0, (LPARAM)next_plugin());
                    break;                                
                default:
                    next_plugin();
                }
             }   
            // Set gfx plugin
            index = SendDlgItemMessage(hwnd, IDC_COMBO_GFX, CB_FINDSTRINGEXACT, 0, (LPARAM)gfx_name);
            if (index!=CB_ERR) {
                SendDlgItemMessage(hwnd, IDC_COMBO_GFX, CB_SETCURSEL, index, 0);
            }
            else   {
                SendDlgItemMessage(hwnd, IDC_COMBO_GFX, CB_SETCURSEL, 0, 0);
                SendDlgItemMessage(hwnd, IDC_COMBO_GFX, CB_GETLBTEXT, 0, (LPARAM)gfx_name);
                }
            // Set input plugin
            index = SendDlgItemMessage(hwnd, IDC_COMBO_INPUT, CB_FINDSTRINGEXACT, 0, (LPARAM)input_name);
            if (index!=CB_ERR) {
                 SendDlgItemMessage(hwnd, IDC_COMBO_INPUT, CB_SETCURSEL, index, 0);
            }
            else    {
                 SendDlgItemMessage(hwnd, IDC_COMBO_INPUT, CB_SETCURSEL, 0, 0);
                 SendDlgItemMessage(hwnd, IDC_COMBO_INPUT, CB_GETLBTEXT, 0, (LPARAM)input_name);
                }   
            // Set sound plugin
            index = SendDlgItemMessage(hwnd, IDC_COMBO_SOUND, CB_FINDSTRINGEXACT, 0, (LPARAM)sound_name);
            if (index!=CB_ERR) {
            SendDlgItemMessage(hwnd, IDC_COMBO_SOUND, CB_SETCURSEL, index, 0);
            }
            else    {
                  SendDlgItemMessage(hwnd, IDC_COMBO_SOUND, CB_SETCURSEL, 0, 0);
                  SendDlgItemMessage(hwnd, IDC_COMBO_SOUND, CB_GETLBTEXT, 0, (LPARAM)sound_name);
                }
            // Set RSP plugin
            index = SendDlgItemMessage(hwnd, IDC_COMBO_RSP, CB_FINDSTRINGEXACT, 0, (LPARAM)rsp_name);
            if (index!=CB_ERR) {
            SendDlgItemMessage(hwnd, IDC_COMBO_RSP, CB_SETCURSEL, index, 0);
            }
            else    {
                  SendDlgItemMessage(hwnd, IDC_COMBO_RSP, CB_SETCURSEL, 0, 0);
                  SendDlgItemMessage(hwnd, IDC_COMBO_RSP, CB_GETLBTEXT, 0, (LPARAM)rsp_name);
                }
                
                        
            TranslateConfigDialog(hwnd);
            if(emu_launched) {
                EnableWindow( GetDlgItem(hwnd,IDC_COMBO_GFX), FALSE );
                EnableWindow( GetDlgItem(hwnd,IDC_COMBO_INPUT), FALSE );
                EnableWindow( GetDlgItem(hwnd,IDC_COMBO_SOUND), FALSE );
                EnableWindow( GetDlgItem(hwnd,IDC_COMBO_RSP), FALSE );   
            }
            
            //Show the images
            SendDlgItemMessage(hwnd, IDB_DISPLAY, STM_SETIMAGE, IMAGE_BITMAP, 
                (LPARAM)LoadImage (GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_DISPLAY), 
                IMAGE_BITMAP, 0, 0, 0));
            SendDlgItemMessage(hwnd, IDB_CONTROL, STM_SETIMAGE, IMAGE_BITMAP, 
                (LPARAM)LoadImage (GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_CONTROL), 
                IMAGE_BITMAP, 0, 0, 0));
             SendDlgItemMessage(hwnd, IDB_SOUND, STM_SETIMAGE, IMAGE_BITMAP, 
                (LPARAM)LoadImage (GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_SOUND), 
                IMAGE_BITMAP, 0, 0, 0));
             SendDlgItemMessage(hwnd, IDB_RSP, STM_SETIMAGE, IMAGE_BITMAP, 
                (LPARAM)LoadImage (GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_RSP), 
                IMAGE_BITMAP, 0, 0, 0));
             return TRUE;
        case WM_COMMAND:
            switch(LOWORD(wParam))
            {
                case IDGFXCONFIG:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_GFX, path_buffer);
                     exec_config(path_buffer);
                     break;
                case IDGFXTEST:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_GFX, path_buffer);
                     exec_test(path_buffer);
                     break;
                case IDGFXABOUT:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_GFX, path_buffer);
                     exec_about(path_buffer);
                     break;
                case IDINPUTCONFIG:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_INPUT, path_buffer);
                     exec_config(path_buffer);
                     break;
                case IDINPUTTEST:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_INPUT, path_buffer);
                     exec_test(path_buffer);
                     break;
                case IDINPUTABOUT:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_INPUT, path_buffer);
                     exec_about(path_buffer);
                     break;
                case IDSOUNDCONFIG:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_SOUND, path_buffer);
                     exec_config(path_buffer);
                     break;
                case IDSOUNDTEST:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_SOUND, path_buffer);
                     exec_test(path_buffer);
                     break;
                case IDSOUNDABOUT:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_SOUND, path_buffer);
                     exec_about(path_buffer);
                     break;
                case IDRSPCONFIG:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_RSP, path_buffer);
                     exec_config(path_buffer);
                     break;
                case IDRSPTEST:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_RSP, path_buffer);
                     exec_test(path_buffer);
                     break;
                case IDRSPABOUT:
                     hwnd_plug = hwnd;
                     ReadComboBoxValue( hwnd, IDC_COMBO_RSP, path_buffer);
                     exec_about(path_buffer);
                     break;    
            }
            break;
        case WM_NOTIFY:
		             if (((NMHDR FAR *) lParam)->code == PSN_APPLY) {
		                 
                         ReadComboBoxValue( hwnd, IDC_COMBO_GFX, gfx_name);
                         WriteCfgString("Plugins","Graphics",gfx_name);
                         
                         ReadComboBoxValue( hwnd, IDC_COMBO_INPUT, input_name);
                         WriteCfgString("Plugins","Input",input_name);
                         
                         ReadComboBoxValue( hwnd, IDC_COMBO_SOUND, sound_name);
                         WriteCfgString("Plugins","Sound",sound_name);
                         
                         ReadComboBoxValue( hwnd, IDC_COMBO_RSP, rsp_name);
                         WriteCfgString("Plugins","RSP",rsp_name);
                     }
                     break;
        default:
            return FALSE;
    }
    return TRUE;
}