Example #1
0
  void Environment::boot_vm() {
    state->initialize();
    state->boot();

    TaskProbe* probe = TaskProbe::create(state);
    state->probe.set(probe->parse_env(NULL) ? probe : nil<TaskProbe>());
  }
Example #2
0
  void test_disable_prim() {
    p->parse_env("all");

    TS_ASSERT(p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));

    p->disable(state, state->symbol("add_method"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));

    p->disable(state, state->symbol("start_method"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_START_METHOD));

    p->disable(state, state->symbol("lookup_failed"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));

    p->disable(state, state->symbol("execute_instruction"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_INSTRUCTION));

    p->disable(state, state->symbol("load_runtime"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOAD_RUNTIME));

    p->disable(state, state->symbol("execute_method"));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_METHOD));
  }
Example #3
0
  void test_parse_env_load_runtime() {
    TS_ASSERT(p->parse_env("load_runtime"));

    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
  }
Example #4
0
  void test_parse_env_execute_instruction() {
    TS_ASSERT(p->parse_env("execute_instruction"));

    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #5
0
  void test_parse_env_start_method() {
    TS_ASSERT(p->parse_env("start_method"));

    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT_EQUALS(false, p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #6
0
  void test_parse_env_every() {
    TS_ASSERT(p->parse_env("add_method,start_method,lookup_failed,execute_instruction,load_runtime"));

    TS_ASSERT(p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #7
0
  void test_parse_env_all() {
    TS_ASSERT(p->parse_env("all"));

    TS_ASSERT(p->enabled_p(PROBE_ADD_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_START_METHOD));
    TS_ASSERT(p->enabled_p(PROBE_LOOKUP_FAILED));
    TS_ASSERT(p->enabled_p(PROBE_EXECUTE_INSTRUCTION));
    TS_ASSERT(p->enabled_p(PROBE_LOAD_RUNTIME));
  }
Example #8
0
  void test_enabled_p_prim() {
    p->parse_env("all");

    TS_ASSERT(p->enabled_p(state, state->symbol("add_method")));
    TS_ASSERT(p->enabled_p(state, state->symbol("start_method")));
    TS_ASSERT(p->enabled_p(state, state->symbol("lookup_failed")));
    TS_ASSERT(p->enabled_p(state, state->symbol("execute_instruction")));
    TS_ASSERT(p->enabled_p(state, state->symbol("load_runtime")));
  }
Example #9
0
 void test_parse_env() {
   TS_ASSERT_EQUALS(false, p->parse_env("unrecognizable"));
 }
Example #10
0
 Environment::Environment() {
   state = new VM();
   TaskProbe* probe = TaskProbe::create(state);
   state->probe.set(probe->parse_env(NULL) ? probe : (TaskProbe*)Qnil);
 }