Skip to content

Commit adc95e0

Browse files
committed
Merge branch 'master' into truffle-head
2 parents 4152b9b + f306391 commit adc95e0

File tree

13 files changed

+81
-20
lines changed

13 files changed

+81
-20
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ env:
4141
- PHASE='-Ptruffle-specs-language'
4242
- PHASE='-Ptruffle-specs-core'
4343
- PHASE='-Ptruffle-specs-library'
44+
- PHASE='-Ptruffle-mri-tests'
4445

4546
matrix:
4647
include:
@@ -73,7 +74,7 @@ matrix:
7374
fast_finish: true
7475
allow_failures:
7576
- env: COMMAND=test/truffle/run.sh
76-
- PHASE='-Ptruffle-mri-tests'
77+
- env: PHASE='-Ptruffle-mri-tests'
7778

7879

7980
branches:

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
<dependency>
106106
<groupId>com.github.jnr</groupId>
107107
<artifactId>jnr-posix</artifactId>
108-
<version>3.0.11</version>
108+
<version>3.0.12-SNAPSHOT</version>
109109
</dependency>
110110
<dependency>
111111
<groupId>com.github.jnr</groupId>

maven/jruby/src/it/runnable/Gemfile.lock

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,27 @@ GEM
1212
diff-lcs (1.2.5)
1313
equalizer (0.0.11)
1414
ice_nine (0.11.1)
15-
jar-dependencies (0.1.7)
15+
jar-dependencies (0.1.13)
1616
jbundler (0.7.1)
1717
bundler (~> 1.5)
1818
jar-dependencies (~> 0.1.7)
1919
maven-tools (~> 1.0.6)
2020
ruby-maven (>= 3.1.1.0.6, < 3.1.2)
2121
maven-tools (1.0.8)
2222
virtus (~> 1.0)
23-
rake (10.3.2)
23+
rake (10.4.2)
2424
rspec (2.99.0)
2525
rspec-core (~> 2.99.0)
2626
rspec-expectations (~> 2.99.0)
2727
rspec-mocks (~> 2.99.0)
2828
rspec-core (2.99.2)
2929
rspec-expectations (2.99.2)
3030
diff-lcs (>= 1.1.3, < 2.0)
31-
rspec-mocks (2.99.2)
31+
rspec-mocks (2.99.3)
3232
ruby-maven (3.1.1.0.11)
3333
maven-tools (~> 1.0.8)
3434
ruby-maven-libs (= 3.1.1)
3535
ruby-maven-libs (3.1.1)
36-
thread_safe (0.3.5)
3736
thread_safe (0.3.5-java)
3837
virtus (1.0.5)
3938
axiom-types (~> 0.1)
@@ -43,7 +42,6 @@ GEM
4342

4443
PLATFORMS
4544
java
46-
ruby
4745

4846
DEPENDENCIES
4947
jbundler (= 0.7.1)
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
fails:Dir#each yields each directory entry in succession
21
fails:Dir#each returns the directory which remains open
3-
fails:Dir#each returns an Enumerator if no block given
42
fails:Dir#each raises an IOError when called on a closed Dir instance

spec/truffle/tags/core/dir/foreach_tags.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

spec/truffle/tags/core/dir/home_tags.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

spec/truffle/tags/core/thread/backtrace/location/absolute_path_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/truffle/tags/core/thread/backtrace/location/lineno_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

spec/truffle/truffle.mspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class MSpecScript
1717
# Can't load these - so tags aren't enough to exclude them. The problem is
1818
# either fixtures or syntax. Some of them are probably easy fixes.
1919

20+
# This seems to hang sometimes on Travis
21+
"^spec/ruby/core/signal/list_spec.rb",
22+
2023
# require 'socket'
2124
"^spec/ruby/core/file/socket_spec.rb",
2225

truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public RubySymbol calleeName(VirtualFrame frame) {
297297
}
298298
}
299299

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

303303
public CallerLocationsNode(RubyContext context, SourceSection sourceSection) {

truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.oracle.truffle.api.source.Source;
2222
import com.oracle.truffle.api.source.SourceSection;
2323
import com.oracle.truffle.api.utilities.ConditionProfile;
24+
import jnr.posix.Passwd;
2425
import org.jcodings.Encoding;
2526
import org.jruby.runtime.Visibility;
2627
import org.jruby.truffle.nodes.RubyNode;
@@ -1800,6 +1801,27 @@ private RubyModule undefMethod(RubyModule module, String name) {
18001801

18011802
}
18021803

1804+
@CoreMethod(names = "get_user_home", needsSelf = false, required = 1)
1805+
public abstract static class GetUserHomeNode extends CoreMethodArrayArgumentsNode {
1806+
1807+
public GetUserHomeNode(RubyContext context, SourceSection sourceSection) {
1808+
super(context, sourceSection);
1809+
}
1810+
1811+
@Specialization
1812+
public RubyString userHome(RubyString uname) {
1813+
notDesignedForCompilation();
1814+
// TODO BJF 30-APR-2015 Review the more robust getHomeDirectoryPath implementation
1815+
final Passwd passwd = getContext().getPosix().getpwnam(uname.toString());
1816+
if (passwd == null) {
1817+
CompilerDirectives.transferToInterpreter();
1818+
throw new RaiseException(getContext().getCoreLibrary().argumentError("user " + uname.toString() + " does not exist", this));
1819+
}
1820+
return getContext().makeString(passwd.getHome());
1821+
}
1822+
1823+
}
1824+
18031825
@NodeChildren({ @NodeChild(value = "module"), @NodeChild(value = "names") })
18041826
public abstract static class SetVisibilityNode extends CoreMethodNode {
18051827

truffle/src/main/java/org/jruby/truffle/nodes/core/ThreadBacktraceLocationNodes.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,25 @@ public RubyString absolutePath(RubyBasicObject threadBacktraceLocation) {
8888

8989
}
9090

91+
@CoreMethod(names = "lineno")
92+
public abstract static class LinenoNode extends UnaryCoreMethodNode {
93+
94+
public LinenoNode(RubyContext context, SourceSection sourceSection) {
95+
super(context, sourceSection);
96+
}
97+
98+
@CompilerDirectives.TruffleBoundary
99+
@Specialization
100+
public int lineno(RubyBasicObject threadBacktraceLocation) {
101+
final Activation activation = getActivation(threadBacktraceLocation);
102+
103+
final SourceSection sourceSection = activation.getCallNode().getEncapsulatingSourceSection();
104+
105+
return sourceSection.getStartLine();
106+
}
107+
108+
}
109+
91110
@CoreMethod(names = {"to_s", "inspect"})
92111
public abstract static class ToSNode extends UnaryCoreMethodNode {
93112

truffle/src/main/ruby/core/rubinius/common/dir.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,22 @@ def self.mkdir(path, mode = 0777)
121121
error
122122
end
123123

124+
def self.foreach(path)
125+
return to_enum(:foreach, path) unless block_given?
126+
127+
open(path) do |dir|
128+
while s = dir.read
129+
yield s
130+
end
131+
end
132+
133+
nil
134+
end
135+
136+
def self.join_path(p1, p2, dirsep)
137+
"#{p1}#{dirsep ? '/' : ''}#{p2}"
138+
end
139+
124140
def self.chdir(path = ENV['HOME'])
125141
path = Rubinius::Type.coerce_to_path path
126142

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

176+
def each
177+
return to_enum unless block_given?
178+
179+
while s = read
180+
yield s
181+
end
182+
183+
self
184+
end
185+
160186
class << self
161187
alias_method :pwd, :getwd
162188
alias_method :delete, :rmdir
@@ -171,4 +197,8 @@ class << self
171197
alias_method :exists?, :exist?
172198
end
173199

200+
def self.home(user=nil)
201+
PrivateFile.expand_path("~#{user}")
202+
end
203+
174204
end

0 commit comments

Comments
 (0)