comparison truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java @ 22104:cf19259edf87

TruffleVM.eval and Source.withMimeType
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Mon, 24 Aug 2015 08:46:21 +0200
parents 503529c65456
children dc83cc1f94f2 ffadd23c63c8 3aad794eec0e
comparison
equal deleted inserted replaced
22103:7646278cca8a 22104:cf19259edf87
54 import org.junit.runners.*; 54 import org.junit.runners.*;
55 import org.junit.runners.model.*; 55 import org.junit.runners.model.*;
56 56
57 import com.oracle.truffle.api.instrument.*; 57 import com.oracle.truffle.api.instrument.*;
58 import com.oracle.truffle.api.instrument.impl.*; 58 import com.oracle.truffle.api.instrument.impl.*;
59 import com.oracle.truffle.api.source.Source;
59 import com.oracle.truffle.api.vm.*; 60 import com.oracle.truffle.api.vm.*;
60 import com.oracle.truffle.sl.nodes.instrument.*; 61 import com.oracle.truffle.sl.nodes.instrument.*;
61 import com.oracle.truffle.sl.nodes.local.*; 62 import com.oracle.truffle.sl.nodes.local.*;
62 import com.oracle.truffle.sl.test.*; 63 import com.oracle.truffle.sl.test.*;
63 import com.oracle.truffle.sl.test.instrument.SLInstrumentTestRunner.InstrumentTestCase; 64 import com.oracle.truffle.sl.test.instrument.SLInstrumentTestRunner.InstrumentTestCase;
227 if (testCase.baseName.endsWith(ASSIGNMENT_VALUE_SUFFIX)) { 228 if (testCase.baseName.endsWith(ASSIGNMENT_VALUE_SUFFIX)) {
228 // Set up the execution context for Simple and register our two listeners 229 // Set up the execution context for Simple and register our two listeners
229 TruffleVM vm = TruffleVM.newVM().stdIn(new BufferedReader(new StringReader(testCase.testInput))).stdOut(printer).build(); 230 TruffleVM vm = TruffleVM.newVM().stdIn(new BufferedReader(new StringReader(testCase.testInput))).stdOut(printer).build();
230 231
231 final String src = readAllLines(testCase.path); 232 final String src = readAllLines(testCase.path);
232 vm.eval("application/x-sl", src); 233 vm.eval(Source.fromText(src, testCase.path.toString()).withMimeType("application/x-sl"));
233 234
234 // Attach an instrument to every probe tagged as an assignment 235 // Attach an instrument to every probe tagged as an assignment
235 for (Probe probe : Probe.findProbesTaggedAs(StandardSyntaxTag.ASSIGNMENT)) { 236 for (Probe probe : Probe.findProbesTaggedAs(StandardSyntaxTag.ASSIGNMENT)) {
236 SLPrintAssigmentValueListener slPrintAssigmentValueListener = new SLPrintAssigmentValueListener(printer); 237 SLPrintAssigmentValueListener slPrintAssigmentValueListener = new SLPrintAssigmentValueListener(printer);
237 probe.attach(Instrument.create(slPrintAssigmentValueListener, "SL print assignment value")); 238 probe.attach(Instrument.create(slPrintAssigmentValueListener, "SL print assignment value"));