Ejemplo n.º 1
0
int main (int argc, char *argv[])
{
  OilFunctionClass *klass;
  int i;
  int n;

  oil_init ();

  n = oil_class_get_n_classes ();
  for (i=0;i<n; i++ ){
    klass = oil_class_get_by_index(i);

    if(klass->prototype) {
      OilPrototype *proto;
      char *string;

      proto = oil_prototype_from_string (klass->prototype);
      if (proto == NULL) {
        printf ("ERROR bad prototype for %s\n", klass->name);
        continue;
      }

      string = oil_prototype_to_string (proto);

      printf("%s (%s)\n", klass->name, string);

      oil_prototype_free (proto);
      free(string);
    } else {
      printf("ERROR no prototype for %s\n", klass->name);
    }
  }

  return 0;
}
Ejemplo n.º 2
0
int main (int argc, char *argv[])
{
  OilFunctionClass *klass;
  int i;
  int n;

  oil_init_no_optimize ();

  print_header ();

  n = oil_class_get_n_classes ();
  for (i=0;i<n; i++ ){
#ifdef __CW32__
    klass = (OilFunctionClass*)oil_class_get_by_index (i);

    printf ("OIL_DECLARE_CLASS(%s);\n", klass->name);
#else
    klass = oil_class_get_by_index (i);

    printf ("OIL_DECLARE_CLASS(%s);\n", klass->name);
#endif
  }

  print_footer ();

  return 0;
}
Ejemplo n.º 3
0
static void
oil_print_all (void)
{
  int i;
  int n;

  n = oil_class_get_n_classes ();
  for (i = 0; i < n; i++){
    OilFunctionClass *klass = oil_class_get_by_index (i);
    oil_print_class (klass, 0);
  }
}
Ejemplo n.º 4
0
int main (int argc, char *argv[])
{
  OilFunctionClass *klass;
  OilPrototype *proto;
  int i;
  int n;
  char *string;

  oil_init_no_optimize ();

  print_header ();

  n = oil_class_get_n_classes ();
  for (i=0;i<n; i++ ){
    klass = oil_class_get_by_index (i);

    if(klass->prototype) {
      proto = oil_prototype_from_string (klass->prototype);
      if (proto) {
        string = oil_prototype_to_string (proto);
        if (strlen (string) == 0) {
          free (string);
          string = xstrdup("void");
        }

        printf ("OIL_EXPORT OilFunctionClass *oil_function_class_ptr_%s;\n",
            klass->name);
        printf ("typedef void (*_oil_type_%s)(%s);\n",klass->name,string);
        printf ("#define oil_%s ((_oil_type_%s)(*(void(**)(void))oil_function_class_ptr_%s))\n",
            klass->name, klass->name, klass->name);

        oil_prototype_free (proto);
        free (string);
      } else {
        printf("/* ERROR: could not parse %s(%s) */\n", klass->name, klass->prototype);
      }
    }
  }

  print_footer ();

  return 0;
}
Ejemplo n.º 5
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 = "test1";
  std_log(LOG_FILENAME_LINE, "Test Started testsuite_test1");
  
  oil_init ();

  cpu_flags = oil_cpu_get_flags ();     //Returns a bitmask containing the available CPU features
  n = oil_class_get_n_classes ();       
  for (i=0;i<n; i++ ){
    klass = oil_class_get_by_index(i);

    printf("%s\n", klass->name);
    std_log(LOG_FILENAME_LINE, "class name = %s\n",klass->name);

    test = oil_test_new (klass);        //Creates a new OilTest(structure describing how to test an OilFunctionImpl for an OilFunctionClass) for the OilFunctionClass represented by klass
    if (test == NULL) {
      std_log(LOG_FILENAME_LINE, "bad prototype");
      printf("  bad prototype\n");
      continue;
    }

    for (impl = klass->first_impl; impl; impl = impl->next) 
    {
        printf("  %s\n", impl->name);
        if ((impl->flags & OIL_CPU_FLAG_MASK) & ~cpu_flags) 
        {
            std_log(LOG_FILENAME_LINE, "not supported");
            printf("not supported\n");
        } 
        else 
        {
            test->n = 1600;
            ret = oil_test_check_impl (test, impl);     //Runs the testing procedure described by test on the implementation impl
            if (ret) 
            {
                #if 0
                printf("    %lu %g\n",test->prof.min,
                (double)test->prof.total/test->prof.n);
                for(j=0;j<test->prof.hist_n;j++){
                printf("    %lu %d\n",test->prof.hist_time[j],test->prof.hist_count[j]);
                }
                #endif
                printf("    ave=%g std=%g\n", impl->profile_ave, impl->profile_std);
                //hist(test);
            } 
            else 
            {
                printf("  not tested\n");
                oil_test_free (test);
                std_log(LOG_FILENAME_LINE, "Test Failed");
                create_xml(1);
                return 1;
            }
        }
    }//for loop

    oil_test_free (test);   //Frees memory associated with test(OilTest)
  }
  std_log(LOG_FILENAME_LINE, "Test Successful");
  create_xml(0);
  return 0;
}
Ejemplo n.º 6
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;
}