comparison graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java @ 13455:69d2e4baa215

Truffle: new infrastructure related to instrumentation, and in particular debugging: support for managing Source objects; framework for generalized "instrumentation proxy nodes" (to be inserted into ASTs with no runtime cost when inactive), and "probes" (which can be attached to proxy nodes to receive event notification); a rudimentary interface and abstract implementation for a "debug manager" (mostly a placeholder at this point); and the beginning of a language-agnostic ExecutionContext interface.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 17 Dec 2013 20:22:45 -0800
parents fb3ed8e444ea
children
comparison
equal deleted inserted replaced
13306:dfb780080923 13455:69d2e4baa215
1 /* 1 /*
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
48 } 48 }
49 return result.toString(); 49 return result.toString();
50 } 50 }
51 51
52 protected static void executeSL(String[] input, String[] expectedOutput, boolean useConsole) { 52 protected static void executeSL(String[] input, String[] expectedOutput, boolean useConsole) {
53 InputStream in = new ByteArrayInputStream(concat(input).getBytes());
54
55 ByteArrayOutputStream out = new ByteArrayOutputStream(); 53 ByteArrayOutputStream out = new ByteArrayOutputStream();
56 PrintStream printer = new PrintStream(useConsole ? new SplitOutputStream(out, System.err) : out); 54 PrintStream printer = new PrintStream(useConsole ? new SplitOutputStream(out, System.err) : out);
57 PrintStream origErr = System.err; 55 PrintStream origErr = System.err;
58 System.setErr(printer); 56 System.setErr(printer);
59 57
60 SimpleLanguage.run(in, printer, REPEATS, false); 58 SimpleLanguage.run("(test)", concat(input), printer, REPEATS, false);
61 59
62 System.setErr(origErr); 60 System.setErr(origErr);
63 Assert.assertEquals(repeat(concat(expectedOutput), REPEATS), new String(out.toByteArray())); 61 Assert.assertEquals(repeat(concat(expectedOutput), REPEATS), new String(out.toByteArray()));
64 } 62 }
65
66 } 63 }