Exemple #1
0
int main (int argc, char *argv[])
{
  OilFunctionClass *klass;
  OilFunctionImpl *impl;
  OilTest *test;
  double ave, std;
  int n;

  oil_init ();

  if (argc < 2) {
    printf("oil-test <class_name>\n");
    exit(0);
  }

  klass = oil_class_get (argv[1]);
  if (klass == NULL) {
    printf("class not found: %s\n", argv[1]);
    exit(0);
  }
  oil_class_optimize (klass);

  for (n = 0; n < 200; n+=1) {
    printf("%d", n);

    test = oil_test_new(klass);
    oil_test_set_iterations(test, 10);
    test->n = n;
    test->m = 10;

    impl = klass->reference_impl;
    ave = impl->profile_ave;
    std = impl->profile_std;
    oil_test_check_impl (test, impl);

    for (impl = klass->first_impl; impl; impl = impl->next) {
      if (oil_impl_is_usable (impl)) {
        oil_test_check_impl (test, impl);
        //printf(" %g %g", test->profile_ave, test->profile_std);
        printf(" %g", test->profile_ave);
      }
    }
    printf("\n");
  }

  return 0;
}
Exemple #2
0
int main (int argc, char *argv[])
{
  OilFunctionClass *klass;
  OilFunctionImpl *impl;
  OilTest *test;
  int i;
  int n;
  int j;
  int ret;
  unsigned int cpu_flags;
  //xmlfile = "stride";
  std_log(LOG_FILENAME_LINE, "Test Started testsuite_stride");

  if (argc > 1 && strcmp(argv[1],"-v") == 0) {
    verbose = 1;
  }
  oil_init ();

  cpu_flags = oil_cpu_get_flags ();
  n = oil_class_get_n_classes ();
  
  for (i=0;i<n; i++ )
  {
      klass = oil_class_get_by_index(i);
      std_log(LOG_FILENAME_LINE,"Class Name %s %d\n",klass->name, i);

      test = oil_test_new (klass);

      if (test == NULL) 
      {
          std_log(LOG_FILENAME_LINE,"class \"%s\" has  bad prototype\n", klass->name);
          assert_failed = fail = 1; 
          continue;
      }
      oil_test_set_iterations (test, 1);
      test->n = 1 + oil_rand_u8();
      test->m = 1 + oil_rand_u8();

      std_log(LOG_FILENAME_LINE, "ref impl %s",klass->reference_impl->name);
      oil_test_check_impl (test, klass->reference_impl);        //Testing whether an appropriate implementation is suitable or not
                                                                //Runs the testing procedure described by test on the implementation impl
      
      for(j=0;j<OIL_ARG_LAST;j++)
      {
          if (test->params[j].is_stride) 
          {
              test->params[j].value += oil_type_sizeof(test->params[j].type) *
              (oil_rand_u8()&0xf);
          }
      }
      test->inited = 0;

      for (impl = klass->first_impl; impl; impl = impl->next) 
      {
          std_log(LOG_FILENAME_LINE,"  %s\n", impl->name);
          if ((impl->flags & OIL_CPU_FLAG_MASK) & ~cpu_flags){
              std_log(LOG_FILENAME_LINE, "Not supported");
          } 
          else 
          {
              ret = oil_test_check_impl (test, impl);
              if (!ret) 
              {
                  assert_failed = fail = 1;
                  oil_test_free (test);
                  std_log(LOG_FILENAME_LINE, "Test Failed");
                  create_xml(1);
                  return fail;
              }
              
          }
          
      }

      oil_test_free (test);
  }
  
  if(assert_failed)
      std_log(LOG_FILENAME_LINE,"Test Fail");
  else
      std_log(LOG_FILENAME_LINE,"Test Successful");
  create_xml(0);
  return fail;
}