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: 52542e7a80f2
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c2bfd56867d2
Choose a head ref
  • 2 commits
  • 13 files changed
  • 1 contributor

Commits on Nov 19, 2014

  1. [build] ensure we have core/target/test-classes and test/target/test-…

    …classes for some tests
    
    maven/jruby/src/it/extended and maven/jruby-complete/src/it/extended depend
    on test classes from core/ and test/ so running ```mvn -Pcomplete,test```
    or ```mvn -Pmain,test``` will ensure those extra test-classes and will trigger
    the test runs for those artifact
    
    Sponsored by Lookout Inc.
    mkristian committed Nov 19, 2014
    Copy the full SHA
    989edb8 View commit details
  2. added regular tests for jruby-complete and jruby-core/jruby-stdlib ar…

    …tifacts
    
    some tests are not working and get omitted - #2215
    and one test got a little workaround for #2216
    
    Sponsored by Lookout Inc.
    mkristian committed Nov 19, 2014
    Copy the full SHA
    c2bfd56 View commit details
12 changes: 3 additions & 9 deletions build.xml
Original file line number Diff line number Diff line change
@@ -465,9 +465,7 @@

<target name="jruby-jars" description="Create the jruby-jars GEM">
<exec executable="mvn" failonerror="true">
<arg line="-Pjruby-jars"/>
<arg line="-Dinvoker.skip=false"/>
<arg line="install"/>
<arg line="-Pjruby-jars,test"/>
</exec>
</target>

@@ -485,17 +483,13 @@

<target name="complete" description="Create the jruby-complete.jar">
<exec executable="mvn" failonerror="true">
<arg line="-Pcomplete"/>
<arg line="-Dinvoker.skip=false"/>
<arg line="install"/>
<arg line="-Pcomplete,test"/>
</exec>
</target>

<target name="main" description="Create the jruby maven artifacts">
<exec executable="mvn" failonerror="true">
<arg line="-Pmain"/>
<arg line="-Dinvoker.skip=false"/>
<arg line="install"/>
<arg line="-Pmain,test"/>
</exec>
</target>
</project>
3 changes: 3 additions & 0 deletions maven/jruby-complete/src/it/extended/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
invoker.goals = install
invoker.mavenOpts = -client

7 changes: 7 additions & 0 deletions maven/jruby-complete/src/it/extended/pom.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# jruby scripting container
jar 'org.jruby:jruby-complete', '@project.version@'

# unit tests
jar 'junit:junit', '4.8.2', :scope => :test

plugin :surefire, '2.15', :additionalClasspathElements => [ '${basedir}/../../../../../core/target/test-classes', '${basedir}/../../../../../test/target/test-classes' ]
36 changes: 36 additions & 0 deletions maven/jruby-complete/src/it/extended/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>no_group_id_given</groupId>
<artifactId>app</artifactId>
<version>0.0.0</version>
<name>app</name>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby</artifactId>
<version>1.7.17-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>../../../../../core/target/test-classes</additionalClasspathElement>
<additionalClasspathElement>../../../../../test/target/test-classes</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
51 changes: 51 additions & 0 deletions maven/jruby-complete/src/it/extended/pom.xml-
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>no_group_id_given</groupId>
<artifactId>app</artifactId>
<version>0.0.0</version>
<name>app</name>
<dependencies>
<dependency>
<groupId>de.saumya.mojo</groupId>
<artifactId>maven-tools</artifactId>
<version>0.34.2</version>
</dependency>
<dependency>
<groupId>org.rubygems</groupId>
<artifactId>zip</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby</artifactId>
<version>1.7.17-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/ruby</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>../../../../../core/target/test-classes</additionalClasspathElement>
<additionalClasspathElement>../../../../../test/target/test-classes</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package org.example;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.io.File;
import java.io.StringWriter;

import org.jruby.embed.LocalContextScope;
import org.jruby.embed.ScriptingContainer;

import org.junit.Before;
import org.junit.Test;

public class SimpleTest {

private final String basedir = "/home/christian/projects/active/maven/jruby17/";//new File( "../../../../../" ).getAbsolutePath();

private ScriptingContainer newScriptingContainer() {
ScriptingContainer container = new ScriptingContainer(LocalContextScope.SINGLETHREAD);
container.setCurrentDirectory(basedir);
container.getProvider().getRubyInstanceConfig().setJRubyHome("uri:classloader://META-INF/jruby.home");
container.getProvider().getRubyInstanceConfig().setLoadPaths(Arrays.asList(".", "test", "test/externals/ruby1.9", "test/externals/ruby1.9/ruby"));
container.runScriptlet("ENV['GEM_PATH']='lib/ruby/gems/shared'");
return container;
}

private void runTests(ScriptingContainer container) throws Exception {
container.getProvider().getRuntime().tearDown(true);
container.terminate();
}

private void collectTests(ScriptingContainer container, String index) throws Exception {
container.runScriptlet("File.open(File.join('test', '" + index + ".index')) do |f|\n" +
" f.each_line.each do |line|\n" +
" filename = \"test/#{line.chomp}.rb\"\n" +
" next unless File.exist? filename\n" +
" next if filename =~ /externals\\/ruby1.9\\/ruby\\/test_class/\n" +
" next if filename =~ /externals\\/ruby1.9\\/ruby\\/test_io/\n" +
" next if filename =~ /externals\\/ruby1.9\\/ruby\\/test_econv/\n" +
" next if filename =~ /externals\\/ruby1.9\\/test_open3/\n" +
// TODO file an issue or so
" next if filename =~ /test_load_compiled_ruby.rb/\n" +
// TODO remove the following after fix of #2215
" next if filename =~ /test_jar_on_load_path.rb/\n" +
" next if filename =~ /test_file.rb/\n" +
" filename.sub!( /.*\\/test\\//, 'test/' )\n" +
" puts filename\n" +
" require filename\n" +
" end\n" +
" end");
}

private void runIt(String index) throws Exception {
runIt(index, null);
}

private void runIt(String index, String script) throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
//Thread.currentThread().setContextClassLoader();
System.err.println("\n\nrunning --------- " + index + "\n");
ScriptingContainer container = newScriptingContainer();
if (script != null) container.runScriptlet( script );
if (index != null) collectTests(container, index);
runTests(container);
}
finally {
Thread.currentThread().setContextClassLoader(cl);
}
}

@Test
public void testObjectspace() throws Exception {
runIt("objectspace");
}

@Test
public void testSlow() throws Exception {
runIt("slow");
}

@Test
public void testMRI() throws Exception {
runIt("mri.1.9", "ENV['EXCLUDE_DIR']='test/externals/ruby1.9/excludes';require 'minitest/excludes'");
}

@Test
public void testRubicon() throws Exception {
runIt("rubicon.1.9");
}

@Test
public void testJRuby() throws Exception {
runIt("jruby.1.9");
}

// @Test
// public void test() throws Exception {
// runIt(null, "require 'test/test_load_compiled_ruby.rb'");
// }

}
3 changes: 3 additions & 0 deletions maven/jruby-jars/src/it/extended/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
invoker.goals = install
invoker.mavenOpts = -client

8 changes: 8 additions & 0 deletions maven/jruby-jars/src/it/extended/pom.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# jruby scripting container
jar 'org.jruby:jruby-core', '@project.version@'
jar 'org.jruby:jruby-stdlib', '@project.version@'

# unit tests
jar 'junit:junit', '4.8.2', :scope => :test

plugin :surefire, '2.15', :additionalClasspathElements => [ '${basedir}/../../../../../core/target/test-classes', '${basedir}/../../../../../test/target/test-classes' ]
36 changes: 36 additions & 0 deletions maven/jruby-jars/src/it/extended/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>no_group_id_given</groupId>
<artifactId>app</artifactId>
<version>0.0.0</version>
<name>app</name>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby</artifactId>
<version>1.7.17-SNAPSHOT</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>../../../../../core/target/test-classes</additionalClasspathElement>
<additionalClasspathElement>../../../../../test/target/test-classes</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package org.example;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.io.File;
import java.io.StringWriter;

import org.jruby.embed.LocalContextScope;
import org.jruby.embed.ScriptingContainer;

import org.junit.Before;
import org.junit.Test;

public class SimpleTest {

private final String basedir = "/home/christian/projects/active/maven/jruby17/";//new File( "../../../../../" ).getAbsolutePath();

private ScriptingContainer newScriptingContainer() {
ScriptingContainer container = new ScriptingContainer(LocalContextScope.SINGLETHREAD);
container.setCurrentDirectory(basedir);
container.getProvider().getRubyInstanceConfig().setJRubyHome("uri:classloader://META-INF/jruby.home");
container.getProvider().getRubyInstanceConfig().setLoadPaths(Arrays.asList(".", "test", "test/externals/ruby1.9", "test/externals/ruby1.9/ruby"));
container.runScriptlet("ENV['GEM_PATH']='lib/ruby/gems/shared'");
return container;
}

private void runTests(ScriptingContainer container) throws Exception {
container.getProvider().getRuntime().tearDown(true);
container.terminate();
}

private void collectTests(ScriptingContainer container, String index) throws Exception {
container.runScriptlet("File.open(File.join('test', '" + index + ".index')) do |f|\n" +
" f.each_line.each do |line|\n" +
" filename = \"test/#{line.chomp}.rb\"\n" +
" next unless File.exist? filename\n" +
" next if filename =~ /externals\\/ruby1.9\\/ruby\\/test_class/\n" +
" next if filename =~ /externals\\/ruby1.9\\/ruby\\/test_io/\n" +
" next if filename =~ /externals\\/ruby1.9\\/ruby\\/test_econv/\n" +
" next if filename =~ /externals\\/ruby1.9\\/test_open3/\n" +
// TODO file an issue or so
" next if filename =~ /test_load_compiled_ruby.rb/\n" +
// TODO remove the following after fix of #2215
" next if filename =~ /test_jar_on_load_path.rb/\n" +
" next if filename =~ /test_file.rb/\n" +
" filename.sub!( /.*\\/test\\//, 'test/' )\n" +
" puts filename\n" +
" require filename\n" +
" end\n" +
" end");
}

private void runIt(String index) throws Exception {
runIt(index, null);
}

private void runIt(String index, String script) throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
//Thread.currentThread().setContextClassLoader();
System.err.println("\n\nrunning --------- " + index + "\n");
ScriptingContainer container = newScriptingContainer();
if (script != null) container.runScriptlet( script );
if (index != null) collectTests(container, index);
runTests(container);
}
finally {
Thread.currentThread().setContextClassLoader(cl);
}
}

@Test
public void testObjectspace() throws Exception {
runIt("objectspace");
}

@Test
public void testSlow() throws Exception {
runIt("slow");
}

@Test
public void testMRI() throws Exception {
runIt("mri.1.9", "ENV['EXCLUDE_DIR']='test/externals/ruby1.9/excludes';require 'minitest/excludes'");
}

@Test
public void testRubicon() throws Exception {
runIt("rubicon.1.9");
}

@Test
public void testJRuby() throws Exception {
runIt("jruby.1.9");
}

// @Test
// public void test() throws Exception {
// runIt(null, "require 'test/test_load_compiled_ruby.rb'");
// }

}
2 changes: 2 additions & 0 deletions maven/jruby/src/it/extended/pom.rb
Original file line number Diff line number Diff line change
@@ -3,3 +3,5 @@

# unit tests
jar 'junit:junit', '4.8.2', :scope => :test

plugin :surefire, '2.15', :additionalClasspathElements => [ '${basedir}/../../../../../core/target/test-classes', '${basedir}/../../../../../test/target/test-classes' ]
Loading