use of com.oracle.truffle.tck.impl.TckInstrument in project graal by oracle.
the class TruffleTCK method testValueWithSource.
/**
* @since 0.22
*/
@Test
public void testValueWithSource() throws Exception {
String id = valueWithSource();
if (id == null) {
return;
}
PolyglotEngine.Value valueFunction = findGlobalSymbol(id);
SourceSection sourceLocation;
PolyglotRuntime.Instrument instr = vm().getRuntime().getInstruments().get(TckInstrument.ID);
instr.setEnabled(true);
try {
PolyglotEngine.Value value = valueFunction.execute();
TckInstrument tckInstrument = instr.lookup(TckInstrument.class);
assertNotNull(tckInstrument);
TruffleInstrument.Env env = tckInstrument.getEnvironment();
assertNotNull(env);
sourceLocation = value.getSourceLocation();
assertNotNull(sourceLocation);
List<SourceSection> lss = env.getInstrumenter().querySourceSections(SourceSectionFilter.ANY);
assertTrue("Source section not among loaded sections", lss.contains(sourceLocation));
} finally {
instr.setEnabled(false);
}
}
Aggregations