Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
Conflicts:
	lib/pom.xml
  • Loading branch information
chrisseaton committed Feb 27, 2015
2 parents 40311ef + 3485ab6 commit 1929ec9
Show file tree
Hide file tree
Showing 96 changed files with 1,824 additions and 1,276 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -67,6 +67,7 @@ matrix:
fast_finish: true
allow_failures:
- env: PHASE='-Pcomplete'
- env: PHASE='-Pmain'
- env: PHASE='-Prake -Dtask=spec:jrubyc'
- env: PHASE='-Prake -Dtask=spec:profiler'

Expand Down
9 changes: 9 additions & 0 deletions BUILDING.md
Expand Up @@ -118,6 +118,15 @@ jruby <test file> -n <specific test method>
```
EXCLUDES=test/mri/excludes bin/jruby -r test/mri_test_env.rb test/mri/runner.rb -q -- <test file>
```
#### Run a single spec
```
bin/jruby spec/mspec/bin/mspec run spec/ruby/core/symbol/length_spec.rb
```

#### Run a single spec with remote debugging
```
bin/jruby spec/mspec/bin/mspec run -T-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 spec/ruby/core/symbol/length_spec.rb
```

Additional tests may be run through mspec.
```
Expand Down
1 change: 0 additions & 1 deletion core/pom.rb
Expand Up @@ -67,7 +67,6 @@
jar 'junit:junit', :scope => 'test'
jar 'org.apache.ant:ant:${ant.version}', :scope => 'provided'
jar 'org.osgi:org.osgi.core:5.0.0', :scope => 'provided'
jar 'org.yaml:snakeyaml:1.14'

# joda timezone must be before joda-time to be packed correctly
jar 'org.jruby:joda-timezones:${tzdata.version}', :scope => '${tzdata.scope}'
Expand Down
5 changes: 0 additions & 5 deletions core/pom.xml
Expand Up @@ -210,11 +210,6 @@
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>joda-timezones</artifactId>
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/Ruby.java
Expand Up @@ -1762,7 +1762,6 @@ private void initBuiltins() {

addLazyBuiltin("mathn/complex.jar", "mathn/complex", "org.jruby.ext.mathn.Complex");
addLazyBuiltin("mathn/rational.jar", "mathn/rational", "org.jruby.ext.mathn.Rational");
addLazyBuiltin("psych.jar", "psych", "org.jruby.ext.psych.PsychLibrary");
addLazyBuiltin("ripper.jar", "ripper", "org.jruby.ext.ripper.RipperLibrary");
addLazyBuiltin("coverage.jar", "coverage", "org.jruby.ext.coverage.CoverageLibrary");

Expand Down
18 changes: 15 additions & 3 deletions core/src/main/java/org/jruby/RubyGlobal.java
Expand Up @@ -64,6 +64,8 @@

import static org.jruby.internal.runtime.GlobalVariable.Scope.*;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.Channel;
Expand Down Expand Up @@ -192,11 +194,11 @@ public static void createGlobals(ThreadContext context, Ruby runtime) {
runtime.defineVariable(new BacktraceGlobalVariable(runtime, "$@"), THREAD);

IRubyObject stdin = RubyIO.prepStdio(
runtime, runtime.getIn(), prepareStdioChannel(runtime, STDIO.IN, ShellLauncher.unwrapFilterInputStream(runtime.getIn())), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
runtime, runtime.getIn(), prepareStdioChannel(runtime, STDIO.IN, runtime.getIn()), OpenFile.READABLE, runtime.getIO(), "<STDIN>");
IRubyObject stdout = RubyIO.prepStdio(
runtime, runtime.getOut(), prepareStdioChannel(runtime, STDIO.OUT, ShellLauncher.unwrapFilterOutputStream(runtime.getOut())), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
runtime, runtime.getOut(), prepareStdioChannel(runtime, STDIO.OUT, runtime.getOut()), OpenFile.WRITABLE, runtime.getIO(), "<STDOUT>");
IRubyObject stderr = RubyIO.prepStdio(
runtime, runtime.getErr(), prepareStdioChannel(runtime, STDIO.ERR, ShellLauncher.unwrapFilterOutputStream(runtime.getErr())), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");
runtime, runtime.getErr(), prepareStdioChannel(runtime, STDIO.ERR, runtime.getErr()), OpenFile.WRITABLE | OpenFile.SYNC, runtime.getIO(), "<STDERR>");

runtime.defineVariable(new InputGlobalVariable(runtime, "$stdin", stdin), GLOBAL);
runtime.defineVariable(new OutputGlobalVariable(runtime, "$stdout", stdout), GLOBAL);
Expand Down Expand Up @@ -283,9 +285,19 @@ private static Channel prepareStdioChannel(Ruby runtime, STDIO stdio, Object str
} else {
switch (stdio) {
case IN:
stream = ShellLauncher.unwrapFilterInputStream((InputStream)stream);
if (stream instanceof FileInputStream) {
return ((FileInputStream)stream).getChannel();
}

return Channels.newChannel((InputStream)stream);
case OUT:
case ERR:
stream = ShellLauncher.unwrapFilterOutputStream((OutputStream)stream);
if (stream instanceof FileOutputStream) {
return ((FileOutputStream)stream).getChannel();
}

return Channels.newChannel((OutputStream)stream);
default: throw new RuntimeException("invalid stdio: " + stdio);
}
Expand Down
14 changes: 14 additions & 0 deletions core/src/main/java/org/jruby/RubyIO.java
Expand Up @@ -182,6 +182,12 @@ public static RubyIO prepStdio(Ruby runtime, InputStream f, Channel c, int fmode
RubyIO io = prepIO(runtime, c, fmode | OpenFile.PREP | EncodingUtils.DEFAULT_TEXTMODE, klass, path);

fptr = io.getOpenFileChecked();

// Use standard stdio filenos if we're using System.in et al.
if (f == System.in) {
fptr.fd().realFileno = 0;
}

prepStdioEcflags(fptr, fmode);
fptr.stdio_file = f;

Expand All @@ -195,6 +201,14 @@ public static RubyIO prepStdio(Ruby runtime, OutputStream f, Channel c, int fmod
RubyIO io = prepIO(runtime, c, fmode | OpenFile.PREP | EncodingUtils.DEFAULT_TEXTMODE, klass, path);

fptr = io.getOpenFileChecked();

// Use standard stdio filenos if we're using System.in et al.
if (f == System.out) {
fptr.fd().realFileno = 1;
} else if (f == System.err) {
fptr.fd().realFileno = 2;
}

prepStdioEcflags(fptr, fmode);
fptr.stdio_file = f;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyInstanceConfig.java
Expand Up @@ -1836,7 +1836,7 @@ private static int initGlobalJavaVersion() {
return Opcodes.V1_5;
} else if (specVersion.equals("1.6")) {
return Opcodes.V1_6;
} else if (specVersion.equals("1.7") || specVersion.equals("1.8")) {
} else if (specVersion.equals("1.7") || specVersion.equals("1.8") || specVersion.equals("1.9")) {
return Opcodes.V1_7;
} else {
System.err.println("unsupported Java version \"" + specVersion + "\", defaulting to 1.5");
Expand Down

0 comments on commit 1929ec9

Please sign in to comment.