Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f5dfe4424e98
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf291e975588
Choose a head ref
  • 10 commits
  • 8 files changed
  • 1 contributor

Commits on Oct 19, 2016

  1. Copy the full SHA
    e28c0d8 View commit details
  2. [Truffle] Mx: add setup to compile Java tests.

    * Let mx generate Antlr sources directly in the antlr sources.
      It simplifies the setup quite a bit.
      Ignores those files as they are generated.
    eregon committed Oct 19, 2016
    Copy the full SHA
    a964461 View commit details
  3. 2
    Copy the full SHA
    8035d94 View commit details
  4. Copy the full SHA
    d1bec79 View commit details
  5. [Truffle] CI: use mx rubytck.

    eregon committed Oct 19, 2016
    Copy the full SHA
    77b199a View commit details
  6. Copy the full SHA
    d434b4a View commit details
  7. Copy the full SHA
    8b3784a View commit details
  8. Copy the full SHA
    051f2b2 View commit details
  9. Copy the full SHA
    cb770ca View commit details
  10. [Truffle] Travis: move custom command to install section.

    * It's used for setup not to run tests.
    eregon committed Oct 19, 2016
    Copy the full SHA
    cf291e9 View commit details
Showing with 116 additions and 25 deletions.
  1. +4 −0 .gitignore
  2. +8 −2 .travis.yml
  3. +1 −1 ci.hocon
  4. +35 −12 mx.jruby/mx_jruby.py
  5. +36 −6 mx.jruby/suite.py
  6. +1 −0 tool/jt.rb
  7. +15 −2 truffle/src/test/java/org/jruby/truffle/tck/RubyDebugTest.java
  8. +16 −2 truffle/src/test/java/org/jruby/truffle/tck/RubyTckTest.java
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -124,6 +124,10 @@ build.eclipse
/mxbuild
/mx.imports
/RUBY.dist
/RUBY-TEST.dist

# Antlr (when launched by mx)
/truffle/src/main/antlr4/**/*.java

# Truffle findbugs
truffle-findbugs-report.html
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ sudo: false
cache:
directories:
- $HOME/.m2
- $HOME/.mx/cache

before_script:
- unset GEM_PATH GEM_HOME IRBRC JRUBY_OPTS
@@ -21,7 +22,7 @@ matrix:
- env: JT='test integration'
- env: JT='test gems' COMMAND=test/truffle/gems/install-gems.sh
- env: JT='test ecosystem' JAVA_OPTS="$JAVA_OPTS -Xmx512m" HAS_REDIS=true COMMAND=test/truffle/ecosystem-travis-install.sh
- env: JT='test tck'
- env: JT='test tck' COMMAND='mx build' SKIP_BUILD=true
- env: JT='check_ambiguous_arguments' SKIP_BUILD=true V=1
- env: JT='test mri'
- env: JT='test bundle'
@@ -32,9 +33,14 @@ matrix:
- jdk: oraclejdk8

install:
- git clone https://github.com/graalvm/mx
- export PATH=$PWD/mx:$PATH
- echo MX_BINARY_SUITES=truffle >> mx.jruby/env
- ln -s mvnw mvn
- export PATH=$PWD:$PATH
- if [ -z "$SKIP_BUILD" ]; then V=1 tool/jt.rb build; fi
script:
- $COMMAND
script:
- tool/jt.rb $JT

notifications:
2 changes: 1 addition & 1 deletion ci.hocon
Original file line number Diff line number Diff line change
@@ -357,7 +357,7 @@ test-cexts: ${sulong} ${gem-test-pack} {

builds: [
{name: ruby-test-fast} ${common} ${gate-caps} {run: [${jt} [test, fast]]},
{name: ruby-test-tck} ${common} ${gate-caps} {run: [${jt} [test, tck]]},
{name: ruby-test-tck} ${common} ${gate-caps} {run: [[mx, rubytck]]},
{name: ruby-test-specs-command-line} ${common} ${gate-caps} {run: [${jt} [test, specs, ":command_line"]]},
{name: ruby-test-specs-language} ${common} ${gate-caps} {run: [${jt} [test, specs, ":language"]]},
{name: ruby-test-specs-core} ${common} ${gate-caps} {run: [${jt} [test, specs, -Gci, ":core"]]},
47 changes: 35 additions & 12 deletions mx.jruby/mx_jruby.py
Original file line number Diff line number Diff line change
@@ -20,10 +20,27 @@

import mx
import mx_benchmark
import mx_unittest

TimeStampFile = mx.TimeStampFile

_suite = mx.suite('jruby')

TimeStampFile = mx.TimeStampFile
rubyDists = [
'RUBY',
'RUBY-TEST'
]

def unittest_use_distribution_jars(config):
"""use the distribution jars instead of the class files"""
vmArgs, mainClass, mainClassArgs = config
cpIndex, _ = mx.find_classpath_arg(vmArgs)
junitCP = [mx.classpath("com.oracle.mxtool.junit")]
rubyCP = [mx.classpath(mx.distribution(distr)) for distr in rubyDists]
vmArgs[cpIndex] = ":".join(junitCP + rubyCP)
return (vmArgs, mainClass, mainClassArgs)

mx_unittest.add_config_participant(unittest_use_distribution_jars)

# Project and BuildTask classes

@@ -72,23 +89,23 @@ def needsBuild(self, newestInput):
return sup
newestOutput = self.newestOutput()
if not newestOutput:
return (True, "no class files yet")
return (True, "no java files yet")

src = join(_suite.dir, self.subject.sourceDir)
for root, _, files in os.walk(src):
for name in files:
file = TimeStampFile(join(root, name))
if file.isNewerThan(newestOutput):
return (True, file)
for grammar in self.subject.grammars:
if newestOutput.isOlderThan(join(src, grammar)):
return (True, "%s needs to be regenerated" % (grammar))

return (False, 'all files are up to date')

def newestOutput(self):
out = join(_suite.dir, self.subject.outputDir)
newest = None
for root, _, files in os.walk(out):
for name in files:
file = TimeStampFile(join(root, name))
if not newest or file.isNewerThan(newest):
newest = file
for grammar in self.subject.grammars:
parser = join(out, os.path.splitext(grammar)[0] + "Parser.java")
parser = TimeStampFile(parser)
if not newest or parser.isNewerThan(newest):
newest = parser
return newest

def build(self):
@@ -295,8 +312,14 @@ def ruby_command(args):
log(java + ' ' + ' '.join(map(pipes.quote, allArgs)))
return os.execve(java, [argv0] + allArgs, env)

def ruby_tck(args):
env = setup_jruby_home()
os.environ["JRUBY_HOME"] = env["JRUBY_HOME"]
mx_unittest.unittest(['--verbose', '--suite', 'jruby'])

mx.update_commands(_suite, {
'ruby' : [ruby_command, '[ruby args|@VM options]'],
'rubytck': [ruby_tck, ''],
})

# Utilities
42 changes: 36 additions & 6 deletions mx.jruby/suite.py
Original file line number Diff line number Diff line change
@@ -85,17 +85,14 @@ def mavenLib(mavenDep, sha1, sourceSha1):
"jruby-antlr": {
"class": "AntlrProject",
"sourceDir": "truffle/src/main/antlr4",
"outputDir": "truffle/target/generated-sources/antlr4",
"outputDir": "truffle/src/main/antlr4",
"grammars": [ "org/jruby/truffle/core/format/pack/Pack.g4" ],
"dependencies": [ "ANTLR4_RUNTIME" ],
},

"jruby-truffle": {
"dir": "truffle",
"sourceDirs": [
"src/main/java",
"target/generated-sources/antlr4",
],
"dir": "truffle/src/main",
"sourceDirs": ["java", "antlr4"],
"dependencies": [
"jruby-core",
"jruby-antlr",
@@ -115,6 +112,23 @@ def mavenLib(mavenDep, sha1, sourceSha1):
"prefix": "jruby-truffle",
},

"jruby-truffle-test": {
"dir": "truffle/src/test",
"sourceDirs": ["java"],
"dependencies": [
"jruby-truffle",
"truffle:TRUFFLE_TCK",
"mx:JUNIT",
],
"javaCompliance": "1.8",
},

"jruby-truffle-ruby-test": {
"class": "ArchiveProject",
"outputDir": "truffle/src/test/ruby",
"prefix": "src/test/ruby",
},

# Depends on jruby-core extracting jni libs in lib/jni
"jruby-lib-jni": {
"class": "ArchiveProject",
@@ -172,5 +186,21 @@ def mavenLib(mavenDep, sha1, sourceSha1):
"description": "JRuby+Truffle Native Libs",
"license": "EPL"
},

"RUBY-TEST": {
"dependencies": [
"jruby-truffle-test",
"jruby-truffle-ruby-test",
],
"exclude" : [
"mx:HAMCREST",
"mx:JUNIT"
],
"distDependencies": [
"RUBY",
"truffle:TRUFFLE_TCK"
],
"license" : "EPL",
},
},
}
1 change: 1 addition & 0 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -1051,6 +1051,7 @@ def test_specs(command, *args)
private :test_specs

def test_tck(*args)
exec 'mx', 'rubytck' if Utilities.mx?
env = {'JRUBY_BUILD_MORE_QUIET' => 'true'}
mvn env, *args, '-Ptck'
end
17 changes: 15 additions & 2 deletions truffle/src/test/java/org/jruby/truffle/tck/RubyDebugTest.java
Original file line number Diff line number Diff line change
@@ -30,6 +30,9 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.LinkedList;
import java.util.Objects;

@@ -49,6 +52,16 @@ public class RubyDebugTest {
private final ByteArrayOutputStream out = new ByteArrayOutputStream();
private final ByteArrayOutputStream err = new ByteArrayOutputStream();

private static Source getSource(String path) {
InputStream stream = ClassLoader.getSystemResourceAsStream(path);
Reader reader = new InputStreamReader(stream);
try {
return Source.newBuilder(reader).name(new File(path).getName()).mimeType(RubyLanguage.MIME_TYPE).build();
} catch (IOException e) {
throw new Error(e);
}
}

@Before
public void before() throws IOException {
suspendedEvent = null;
@@ -76,7 +89,7 @@ protected void on(SuspendedEvent event) {

}).build();

engine.eval(Source.newBuilder(new File("src/test/ruby/init.rb")).build());
engine.eval(getSource("src/test/ruby/init.rb"));

run.clear();
}
@@ -259,7 +272,7 @@ private void assertExecutedOK(String msg) throws Throwable {
}

private static Source createFactorial() throws IOException {
return Source.newBuilder(new File("src/test/ruby/factorial.rb")).build();
return getSource("src/test/ruby/factorial.rb");
}

private final String getErr() {
18 changes: 16 additions & 2 deletions truffle/src/test/java/org/jruby/truffle/tck/RubyTckTest.java
Original file line number Diff line number Diff line change
@@ -18,11 +18,25 @@
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

import static org.junit.Assert.*;

public class RubyTckTest extends TruffleTCK {

private static Source getSource(String path) {
InputStream stream = ClassLoader.getSystemResourceAsStream(path);
Reader reader = new InputStreamReader(stream);
try {
return Source.newBuilder(reader).name(new File(path).getName()).mimeType(RubyLanguage.MIME_TYPE).build();
} catch (IOException e) {
throw new Error(e);
}
}

private static PolyglotEngine engine;

@Test
@@ -35,7 +49,7 @@ public void checkVM() {
protected synchronized PolyglotEngine prepareVM() throws Exception {
if (engine == null) {
engine = PolyglotEngine.newBuilder().build();
engine.eval(Source.newBuilder(new File("src/test/ruby/tck.rb")).build());
engine.eval(getSource("src/test/ruby/tck.rb"));
}

return engine;
@@ -44,7 +58,7 @@ protected synchronized PolyglotEngine prepareVM() throws Exception {
@Override
protected PolyglotEngine prepareVM(PolyglotEngine.Builder preparedBuilder) throws Exception {
final PolyglotEngine engine = preparedBuilder.build();
engine.eval(Source.newBuilder(new File("src/test/ruby/tck.rb")).build());
engine.eval(getSource("src/test/ruby/tck.rb"));
return engine;
}