Skip to content

Commit

Permalink
Showing 13 changed files with 81 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ env:
- PHASE='-Ptruffle-specs-language'
- PHASE='-Ptruffle-specs-core'
- PHASE='-Ptruffle-specs-library'
- PHASE='-Ptruffle-mri-tests'

matrix:
include:
@@ -73,7 +74,7 @@ matrix:
fast_finish: true
allow_failures:
- env: COMMAND=test/truffle/run.sh
- PHASE='-Ptruffle-mri-tests'
- env: PHASE='-Ptruffle-mri-tests'


branches:
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.0.11</version>
<version>3.0.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
8 changes: 3 additions & 5 deletions maven/jruby/src/it/runnable/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -12,28 +12,27 @@ GEM
diff-lcs (1.2.5)
equalizer (0.0.11)
ice_nine (0.11.1)
jar-dependencies (0.1.7)
jar-dependencies (0.1.13)
jbundler (0.7.1)
bundler (~> 1.5)
jar-dependencies (~> 0.1.7)
maven-tools (~> 1.0.6)
ruby-maven (>= 3.1.1.0.6, < 3.1.2)
maven-tools (1.0.8)
virtus (~> 1.0)
rake (10.3.2)
rake (10.4.2)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.99.2)
rspec-mocks (2.99.3)
ruby-maven (3.1.1.0.11)
maven-tools (~> 1.0.8)
ruby-maven-libs (= 3.1.1)
ruby-maven-libs (3.1.1)
thread_safe (0.3.5)
thread_safe (0.3.5-java)
virtus (1.0.5)
axiom-types (~> 0.1)
@@ -43,7 +42,6 @@ GEM

PLATFORMS
java
ruby

DEPENDENCIES
jbundler (= 0.7.1)
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/dir/each_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
fails:Dir#each yields each directory entry in succession
fails:Dir#each returns the directory which remains open
fails:Dir#each returns an Enumerator if no block given
fails:Dir#each raises an IOError when called on a closed Dir instance
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/dir/foreach_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/dir/home_tags.txt

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 3 additions & 0 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@ class MSpecScript
# Can't load these - so tags aren't enough to exclude them. The problem is
# either fixtures or syntax. Some of them are probably easy fixes.

# This seems to hang sometimes on Travis
"^spec/ruby/core/signal/list_spec.rb",

# require 'socket'
"^spec/ruby/core/file/socket_spec.rb",

Original file line number Diff line number Diff line change
@@ -297,7 +297,7 @@ public RubySymbol calleeName(VirtualFrame frame) {
}
}

@CoreMethod(names = "caller_locations", isModuleFunction = true, optional = 2)
@CoreMethod(names = "caller_locations", isModuleFunction = true, optional = 2, lowerFixnumParameters = {0, 1})
public abstract static class CallerLocationsNode extends CoreMethodArrayArgumentsNode {

public CallerLocationsNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.ConditionProfile;
import jnr.posix.Passwd;
import org.jcodings.Encoding;
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.RubyNode;
@@ -1800,6 +1801,27 @@ private RubyModule undefMethod(RubyModule module, String name) {

}

@CoreMethod(names = "get_user_home", needsSelf = false, required = 1)
public abstract static class GetUserHomeNode extends CoreMethodArrayArgumentsNode {

public GetUserHomeNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization
public RubyString userHome(RubyString uname) {
notDesignedForCompilation();
// TODO BJF 30-APR-2015 Review the more robust getHomeDirectoryPath implementation
final Passwd passwd = getContext().getPosix().getpwnam(uname.toString());
if (passwd == null) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().argumentError("user " + uname.toString() + " does not exist", this));
}
return getContext().makeString(passwd.getHome());
}

}

@NodeChildren({ @NodeChild(value = "module"), @NodeChild(value = "names") })
public abstract static class SetVisibilityNode extends CoreMethodNode {

Original file line number Diff line number Diff line change
@@ -88,6 +88,25 @@ public RubyString absolutePath(RubyBasicObject threadBacktraceLocation) {

}

@CoreMethod(names = "lineno")
public abstract static class LinenoNode extends UnaryCoreMethodNode {

public LinenoNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@Specialization
public int lineno(RubyBasicObject threadBacktraceLocation) {
final Activation activation = getActivation(threadBacktraceLocation);

final SourceSection sourceSection = activation.getCallNode().getEncapsulatingSourceSection();

return sourceSection.getStartLine();
}

}

@CoreMethod(names = {"to_s", "inspect"})
public abstract static class ToSNode extends UnaryCoreMethodNode {

30 changes: 30 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/dir.rb
Original file line number Diff line number Diff line change
@@ -121,6 +121,22 @@ def self.mkdir(path, mode = 0777)
error
end

def self.foreach(path)
return to_enum(:foreach, path) unless block_given?

open(path) do |dir|
while s = dir.read
yield s
end
end

nil
end

def self.join_path(p1, p2, dirsep)
"#{p1}#{dirsep ? '/' : ''}#{p2}"
end

def self.chdir(path = ENV['HOME'])
path = Rubinius::Type.coerce_to_path path

@@ -157,6 +173,16 @@ def self.getwd
Rubinius::Type.external_string wd
end

def each
return to_enum unless block_given?

while s = read
yield s
end

self
end

class << self
alias_method :pwd, :getwd
alias_method :delete, :rmdir
@@ -171,4 +197,8 @@ class << self
alias_method :exists?, :exist?
end

def self.home(user=nil)
PrivateFile.expand_path("~#{user}")
end

end

0 comments on commit adc95e0

Please sign in to comment.