Esempio n. 1
0
static void *call_f(void *p, size_t s)
{
 void (**f)(void) = p;

#ifdef MMQA_DEFINED_mps_lib_assert_fail_install
 mps_lib_assert_fail_install(mmqa_lib_fail);
#endif

 (**f)(); 
 return NULL;
}
Esempio n. 2
0
int main(int argc, char *argv[])
{

  randomize(argc, argv);
  mps_lib_assert_fail_install(assert_die);

  printf("\nRunning test with no information about peak usage.\n");
  runArenaTest(smallArenaSize, FALSE, FALSE);
  /*
  printf("\nRunning test with useful information about peak usage.\n");
  runArenaTest(smallArenaSize, TRUE, TRUE);
  printf("\nRunning test with misleading information about peak usage.\n");
  runArenaTest(smallArenaSize, TRUE, FALSE);
  */

  return 0;
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
  mps_arena_t arena;

  randomize(argc, argv);
  mps_lib_assert_fail_install(assert_die);

  die(mps_arena_create(&arena, mps_arena_class_vmnz(), testArenaSIZE),
      "mps_arena_create");

  testInArena(arena);

  mps_arena_destroy(arena);

  printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
  return 0;
}
Esempio n. 4
0
/* main -- runs various test scripts
 *
 */
int main(int argc, char *argv[])
{

  randomize(argc, argv);
  mps_lib_assert_fail_install(assert_die);

  /* Scripts that should fail (uncomment to show failure is detected) */
  /*testscriptA("C.");*/
  /*testscriptA("b.");*/

  /* The most basic scripts */
  testscriptA(".");
  testscriptA("Cbe.");
  testscriptA("Cbe.Cbe.");

  /* Get messages, but not promptly */
  testscriptA(".Cbe.CbeCbeCbe.");

  /* Ungot messages at ArenaDestroy */
  testscriptA("Cbe");
  testscriptA("Cbe.CbeCbeCbe");

  /* Fail to call mps_message_discard */
  testscriptA("Cbe!");
  testscriptA("Cbe!CbeCbeCbe!");

  /* Simple finalization
   *
   * These tests rely on the particular order in which the "F" command 
   * nulls-out references.  Not every "F" makes an object finalizable.
   * See .keep-alive.
   */
  testscriptA("FFCbffe.");
  testscriptA("FFCbffe.FFCbffe.");
  testscriptA("FFCbffe.FCbe.F.Cbffe.FFCbfe.FF.Cbfffe.");
  
  /* Various other scripts */
  testscriptA("Cbe.FFCbffe.Cbe");

  /* Simulate low memory situations
   *
   * These scripts only work with a manually edited traceanc.c --
   * see TIMCA_remote() above.
   *
   * When TraceIdMessagesCreate is trying to pre-allocate GC messages, 
   * either "0" or "10" makes it fail -- "0" fails the trace start 
   * message alloc, whereas "10" fails the trace end message alloc. 
   * In either case TraceIdMessagesCreate promptly gives up, and 
   * neither start nor end message will be sent for the next trace.
   *
   * See <design/message-gc#lifecycle>.
   */
  if(0) {
    /* ArenaCreate unable to pre-allocate: THESE SHOULD FAIL */
    /* manually edit if(0) -> if(1) to test these */
    if(0) {
      TIMCA_setup("0"); testscriptA("Fail at create 1");
    }
    if(0) {
      TIMCA_setup("10"); testscriptA("Fail at create 2");
    }

    /* ArenaDestroy with no pre-allocated messages */
    TIMCA_setup("20"); testscriptA("Cbe.");
    TIMCA_setup("210"); testscriptA("Cbe.");

    /* Collect with no pre-allocated messages: drops messages, */
    /* hence "C." instead of "Cbe.".  Also, in diagnostic varieties, */
    /* these should produce a "droppedMessages" diagnostic at */
    /* ArenaDestroy. */
    TIMCA_setup("2022"); testscriptA("Cbe.C.Cbe.");
    TIMCA_setup("21022"); testscriptA("Cbe.C.Cbe.");

    /* 2 Collects and ArenaDestroy with no pre-allocated messages */
    TIMCA_setup("2000"); testscriptA("Cbe.C.C.");
    TIMCA_setup("201010"); testscriptA("Cbe.C.C.");
    
    TIMCA_setup("");  /* must reset it! */
  }

  printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
  return 0;
}