annotate truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java @ 22024:216e0683bbf1

made SLInstrumentTestRunner (maybe) find test classes when Truffle is not the primary suite
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Jul 2015 16:06:31 +0200
parents fee42ec8c59b
children 854e52a0869c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
1 /*
15891
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
4 *
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
8 *
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
14 *
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
18 *
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
21 * questions.
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
22 */
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
23 package com.oracle.truffle.sl.test;
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
24
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
25 import java.io.*;
22023
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
26 import java.net.*;
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
27 import java.nio.charset.*;
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
28 import java.nio.file.*;
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
29 import java.nio.file.attribute.*;
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
30 import java.util.*;
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
31
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
32 import org.junit.*;
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
33 import org.junit.internal.*;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
34 import org.junit.runner.*;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
35 import org.junit.runner.manipulation.*;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
36 import org.junit.runner.notification.*;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
37 import org.junit.runners.*;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
38 import org.junit.runners.model.*;
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
39
17006
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
40 import com.oracle.truffle.api.dsl.*;
21557
Doug Simon <doug.simon@oracle.com>
parents: 21554 21490
diff changeset
41 import com.oracle.truffle.api.vm.*;
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21469
diff changeset
42 import com.oracle.truffle.sl.*;
17006
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
43 import com.oracle.truffle.sl.builtins.*;
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
44 import com.oracle.truffle.sl.test.SLTestRunner.TestCase;
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
45
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
46 public final class SLTestRunner extends ParentRunner<TestCase> {
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
47
17007
004e3f0a0517 Truffle: added new infrastructure for graal truffle runtime tests using SL.
Christian Humer <christian.humer@gmail.com>
parents: 17006
diff changeset
48 private static int repeats = 1;
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
49
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
50 private static final String SOURCE_SUFFIX = ".sl";
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
51 private static final String INPUT_SUFFIX = ".input";
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
52 private static final String OUTPUT_SUFFIX = ".output";
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
53
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
54 private static final String LF = System.getProperty("line.separator");
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
55
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
56 static class TestCase {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
57 protected final Description name;
15891
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
58 protected final Path path;
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
59 protected final String sourceName;
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
60 protected final String testInput;
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
61 protected final String expectedOutput;
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
62 protected String actualOutput;
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
63
15891
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
64 protected TestCase(Class<?> testClass, String baseName, String sourceName, Path path, String testInput, String expectedOutput) {
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
65 this.name = Description.createTestDescription(testClass, baseName);
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
66 this.sourceName = sourceName;
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
67 this.path = path;
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
68 this.testInput = testInput;
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
69 this.expectedOutput = expectedOutput;
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
70 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
71 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
72
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
73 private final List<TestCase> testCases;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
74
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
75 public SLTestRunner(Class<?> runningClass) throws InitializationError {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
76 super(runningClass);
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
77 try {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
78 testCases = createTests(runningClass);
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
79 } catch (IOException e) {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
80 throw new InitializationError(e);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
81 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
82 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
83
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
84 @Override
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
85 protected Description describeChild(TestCase child) {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
86 return child.name;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
87 }
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
88
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
89 @Override
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
90 protected List<TestCase> getChildren() {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
91 return testCases;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
92 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
93
15891
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
94 protected static List<TestCase> createTests(final Class<?> c) throws IOException, InitializationError {
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
95 SLTestSuite suite = c.getAnnotation(SLTestSuite.class);
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
96 if (suite == null) {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
97 throw new InitializationError(String.format("@%s annotation required on class '%s' to run with '%s'.", SLTestSuite.class.getSimpleName(), c.getName(), SLTestRunner.class.getSimpleName()));
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
98 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
99
22023
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
100 String[] paths = suite.value();
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
101
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
102 Path root = getRootViaResourceURL(c, paths);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
103
22023
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
104 if (root == null) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
105 for (String path : paths) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
106 Path candidate = FileSystems.getDefault().getPath(path);
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
107 if (Files.exists(candidate)) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
108 root = candidate;
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
109 break;
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
110 }
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
111 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
112 }
22023
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
113 if (root == null && paths.length > 0) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
114 throw new FileNotFoundException(paths[0]);
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
115 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
116
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
117 final Path rootPath = root;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
118
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
119 final List<TestCase> foundCases = new ArrayList<>();
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
120 Files.walkFileTree(rootPath, new SimpleFileVisitor<Path>() {
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
121 @Override
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
122 public FileVisitResult visitFile(Path sourceFile, BasicFileAttributes attrs) throws IOException {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
123 String sourceName = sourceFile.getFileName().toString();
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
124 if (sourceName.endsWith(SOURCE_SUFFIX)) {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
125 String baseName = sourceName.substring(0, sourceName.length() - SOURCE_SUFFIX.length());
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
126
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
127 Path inputFile = sourceFile.resolveSibling(baseName + INPUT_SUFFIX);
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
128 String testInput = "";
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
129 if (Files.exists(inputFile)) {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
130 testInput = readAllLines(inputFile);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
131 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
132
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
133 Path outputFile = sourceFile.resolveSibling(baseName + OUTPUT_SUFFIX);
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
134 String expectedOutput = "";
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
135 if (Files.exists(outputFile)) {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
136 expectedOutput = readAllLines(outputFile);
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
137 }
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
138
15891
09ac9ac9c4fc Truffle: SourceManager renamed to SourceFactory
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 13961
diff changeset
139 foundCases.add(new TestCase(c, baseName, sourceName, sourceFile, testInput, expectedOutput));
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
140 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
141 return FileVisitResult.CONTINUE;
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
142 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
143 });
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
144 return foundCases;
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
145 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
146
22024
216e0683bbf1 made SLInstrumentTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 22023
diff changeset
147 public static Path getRootViaResourceURL(final Class<?> c, String[] paths) {
22023
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
148 URL url = c.getResource(c.getSimpleName() + ".class");
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
149 if (url != null) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
150 String externalForm = url.toExternalForm();
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
151 if (externalForm.startsWith("file:")) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
152 char sep = File.separatorChar;
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
153 String suffix = sep + "bin" + sep + c.getName().replace('.', sep) + ".class";
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
154 if (externalForm.endsWith(suffix)) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
155 String base = externalForm.substring("file:".length(), externalForm.length() - suffix.length());
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
156 for (String path : paths) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
157 String candidate = base + sep + path;
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
158 if (new File(candidate).exists()) {
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
159 return FileSystems.getDefault().getPath(candidate);
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
160 }
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
161 }
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
162 }
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
163 }
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
164 }
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
165 return null;
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
166 }
fee42ec8c59b made SLTestRunner (maybe) find test classes when Truffle is not the primary suite
Doug Simon <doug.simon@oracle.com>
parents: 21951
diff changeset
167
13821
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
168 private static String readAllLines(Path file) throws IOException {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
169 // fix line feeds for non unix os
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
170 StringBuilder outFile = new StringBuilder();
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
171 for (String line : Files.readAllLines(file, Charset.defaultCharset())) {
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
172 outFile.append(line).append(LF);
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
173 }
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
174 return outFile.toString();
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
175 }
b16ec83edc73 Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13809
diff changeset
176
17006
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
177 public static void setRepeats(int repeats) {
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
178 SLTestRunner.repeats = repeats;
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
179 }
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
180
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
181 private static final List<NodeFactory<? extends SLBuiltinNode>> builtins = new ArrayList<>();
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
182
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
183 public static void installBuiltin(NodeFactory<? extends SLBuiltinNode> builtin) {
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
184 builtins.add(builtin);
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
185 }
e9c119927199 SL: added internal APIs to SL for the Graal runtime tests.
Christian Humer <christian.humer@gmail.com>
parents: 16687
diff changeset
186
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
187 @Override
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
188 protected void runChild(TestCase testCase, RunNotifier notifier) {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
189 notifier.fireTestStarted(testCase.name);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
190
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
191 ByteArrayOutputStream out = new ByteArrayOutputStream();
21469
286aef83a9a7 Replacing PrintStream with PrintWriter in the simple language
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21468
diff changeset
192 PrintWriter printer = new PrintWriter(out);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
193 try {
21490
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21469
diff changeset
194 TruffleVM vm = TruffleVM.newVM().stdIn(new BufferedReader(new StringReader(repeat(testCase.testInput, repeats)))).stdOut(printer).build();
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21469
diff changeset
195
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21469
diff changeset
196 String script = readAllLines(testCase.path);
21890
894f82515e38 Truffle/APIs and Debugging: Evolutionary steps to integrating debugging and tool support with TruffleVM APIs
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21557
diff changeset
197 SLLanguage.run(vm, testCase.path.toUri(), null, printer, repeats, builtins);
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
198
21469
286aef83a9a7 Replacing PrintStream with PrintWriter in the simple language
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21468
diff changeset
199 printer.flush();
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
200 String actualOutput = new String(out.toByteArray());
21490
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21469
diff changeset
201 Assert.assertEquals(script, repeat(testCase.expectedOutput, repeats), actualOutput);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
202 } catch (Throwable ex) {
21490
3286fb5fea4a Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21469
diff changeset
203 notifier.fireTestFailure(new Failure(testCase.name, new IllegalStateException("Cannot run " + testCase.sourceName, ex)));
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
204 } finally {
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
205 notifier.fireTestFinished(testCase.name);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
206 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
207 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
208
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
209 private static String repeat(String s, int count) {
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
210 StringBuilder result = new StringBuilder(s.length() * count);
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
211 for (int i = 0; i < count; i++) {
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
212 result.append(s);
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
213 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
214 return result.toString();
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
215 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
216
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
217 public static void runInMain(Class<?> testClass, String[] args) throws InitializationError, NoTestsRemainException {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
218 JUnitCore core = new JUnitCore();
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
219 core.addListener(new TextListener(System.out));
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
220 SLTestRunner suite = new SLTestRunner(testClass);
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
221 if (args.length > 0) {
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
222 suite.filter(new NameFilter(args[0]));
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
223 }
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
224 Result r = core.run(suite);
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
225 if (!r.wasSuccessful()) {
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
226 System.exit(1);
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
227 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
228 }
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
229
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
230 private static final class NameFilter extends Filter {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
231 private final String pattern;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
232
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
233 private NameFilter(String pattern) {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
234 this.pattern = pattern.toLowerCase();
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
235 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
236
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
237 @Override
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
238 public boolean shouldRun(Description description) {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
239 return description.getMethodName().toLowerCase().contains(pattern);
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
240 }
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
241
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
242 @Override
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
243 public String describe() {
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
244 return "Filter contains " + pattern;
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
245 }
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
246 }
13809
030e75d4d7dc SL: added junit integration for external tests.
Christian Humer <christian.humer@gmail.com>
parents: 13764
diff changeset
247
13762
e34d5cca7496 Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
248 }