Example #1
0
constrainFunc findFunc(char *path, char *funcName, size_t length)
{
   constrainFunc func = noconstraints;
#if 0
   long int *version;

   libhandle = dlopen(path, RTLD_LAZY);
   if (libhandle == NULL) {
      fprintf(stderr, "Cannot find constrain module: %s\n", path);
   } else if (
      (version = (long int *)findName(libhandle, idstring, sizeof(idstring) - 1)
      ) == NULL
   ) {
      fprintf(stderr, "Cannot establish version of constrain module\n");
      closeLib();
   } else if (MAJORVER(*version) != MAJOR) {
      fprintf(stderr, "Constrain module is not designed for this program\n");
      closeLib();
   } else if (MINORVER(*version) < MINOR) {
      fprintf(stderr, "Constrain module is designed for an older version of this program\n");
      closeLib();
   } else if (
      (func = (constrainFunc) findName(libhandle, funcName, length)
      ) == NULL
   ) {
      fprintf(stderr, "Constrain module does not define constraints\n");
      func = noconstraints;
      closeLib();
   }
   if (func == noconstraints)
      fprintf(stderr, "Defaulting to no constraints\n");
#endif

   return func;
}
Example #2
0
//Basic test for create/attach and exit.
int pc_library_mutatee()
{
   int result;
   void *handlea, *handleb;
   syncloc msg;
	//fprintf(stderr, "Entering pc_library_mutatee\n");
   result = initProcControlTest(threadFunc, NULL);
	//fprintf(stderr, "Done with init, pc_library_mutatee\n");
   if (result != 0) {
      output->log(STDERR, "Initialization failed\n");
      return -1;
   }

   //fprintf(stderr, "Opening libtestA pc_library_mutatee\n");
   handlea = openLib(LIBTESTA);
   //fprintf(stderr, "Opening libtestB pc_library_mutatee\n");
   handleb = openLib(LIBTESTB);
   //fprintf(stderr, "Closing libtestB\n");
   closeLib(LIBTESTB, handleb);
   //fprintf(stderr, "Closing libtestB\n");
   closeLib(LIBTESTA, handlea);

   msg.code = SYNCLOC_CODE;
   result = send_message((unsigned char *) &msg, sizeof(syncloc));
   if (result == -1) {
      output->log(STDERR, "Failed to send sync message\n");
      return -1;
   }

   result = recv_message((unsigned char *) &msg, sizeof(syncloc));
   if (result == -1) {
      output->log(STDERR, "Failed to recv sync message\n");
      return -1;
   }
   if (msg.code != SYNCLOC_CODE) {
      output->log(STDERR, "Recieved unexpected sync message\n");
      return -1;
   }

   result = finiProcControlTest(0);
   if (result != 0) {
      output->log(STDERR, "Finalization failed\n");
      return -1;
   }

   test_passes(testname);
   return 0;
}
Example #3
0
int main() {
  errorReporter er = getErrorReporter();
  printf("er: %p\n", er);
  void *handle = lazyLoad("../exec/libaCorrect.so.1");
  printf("handle: %p\n", handle);
  void *tp = NULL;
  checkLoading(handle, tp, "grocery");
  closeLib(handle);
  return 0;
}
Example #4
0
constrainFunc loadConstrain(char *path)
{
   constrainFunc constraints = noconstraints;
#if 0
   closeLib();
   if (path != NULL)
      constraints = findFunc(path, constrainName, sizeof(constrainName) - 1);
   else {
      constraints = noconstraints;
      puts("Relaxing all constraints");
   }
#endif
   return constraints;
}