Skip to content

Commit 11f8a86

Browse files
committed
[GR-15940] Clone the graal-enterprise version matching our Truffle import.
PullRequest: truffleruby/851
2 parents 5897590 + 25106e6 commit 11f8a86

File tree

7 files changed

+48
-54
lines changed

7 files changed

+48
-54
lines changed

ci.jsonnet

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ local part_definitions = {
138138
is_after+:: ["$.use.build"],
139139
setup+: [
140140
["cd", "../graal/compiler"],
141-
["mx", "sversions"],
142141
["mx", "build"],
143142
["cd", "../../main"],
144143
],
@@ -159,18 +158,20 @@ local part_definitions = {
159158
},
160159

161160
enterprise: {
162-
# Otherwise the TruffleRuby build will change the runtime Truffle version
163161
is_after+:: ["$.use.build"],
164-
setup+: [
165-
[
166-
"git",
167-
"clone",
168-
["mx", "urlrewrite", "https://github.com/graalvm/graal-enterprise.git"],
169-
"../graal-enterprise",
170-
],
162+
163+
clone::
164+
local url = ["mx", "urlrewrite", "https://github.com/graalvm/graal-enterprise.git"],
165+
repo = "../graal-enterprise",
166+
suite_file = "graal-enterprise/mx.graal-enterprise/suite.py",
167+
find_commit_importing_truffle = ["git", "-C", repo, "log", "--reverse", "--pretty=%H", "-m", "-S"] + jt(["truffle_version"]) + ["--grep=PullRequest:", suite_file, "|", "head", "-1"];
168+
[
169+
["git", "clone", url, repo],
170+
["git", "-C", repo, "checkout", find_commit_importing_truffle],
171+
],
172+
173+
setup+: self.clone + [
171174
["cd", "../graal-enterprise/graal-enterprise"],
172-
["mx", "sforceimports"],
173-
["mx", "sversions"],
174175
["mx", "build"],
175176
["cd", "../../main"],
176177
],
@@ -198,13 +199,6 @@ local part_definitions = {
198199

199200
svm_suite:: "/substratevm",
200201

201-
setup+: [
202-
["cd", "../graal/substratevm"],
203-
["mx", "sforceimports"],
204-
["mx", "sversions"],
205-
["cd", "../../main"],
206-
],
207-
208202
environment+: {
209203
HOST_VM_CONFIG: "graal-core",
210204
GRAAL_HOME: "$BUILD_DIR/graal/compiler",
@@ -213,23 +207,11 @@ local part_definitions = {
213207
},
214208

215209
enterprise: {
216-
# Otherwise the TruffleRuby build will change the runtime Truffle version
217210
is_after+:: ["$.use.build"],
218211

219212
svm_suite:: "/substratevm-enterprise",
220213

221-
setup+: [
222-
[
223-
"git",
224-
"clone",
225-
["mx", "urlrewrite", "https://github.com/graalvm/graal-enterprise.git"],
226-
"../graal-enterprise",
227-
],
228-
["cd", "../graal-enterprise/substratevm-enterprise"],
229-
["mx", "sforceimports"],
230-
["mx", "sversions"],
231-
["cd", "../../main"],
232-
],
214+
setup+: $.graal.enterprise.clone,
233215

234216
environment+: {
235217
HOST_VM_CONFIG: "graal-enterprise",

spec/ruby/library/socket/fixtures/classes.rb

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,11 @@ def self.each_ip_protocol
7272
end
7373

7474
def self.loop_with_timeout(timeout = TIME_TOLERANCE)
75-
require 'timeout'
76-
time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
75+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
7776

78-
loop do
79-
if Process.clock_gettime(Process::CLOCK_MONOTONIC) - time >= timeout
80-
raise TimeoutError, "Did not succeed within #{timeout} seconds"
81-
end
82-
83-
sleep 0.01 # necessary on OSX; don't know why
84-
yield
85-
end
86-
end
87-
88-
def self.wait_until_success(timeout = TIME_TOLERANCE)
89-
loop_with_timeout(timeout) do
90-
begin
91-
return yield
92-
rescue
77+
while yield == :retry
78+
if Process.clock_gettime(Process::CLOCK_MONOTONIC) - start >= timeout
79+
raise RuntimeError, "Did not succeed within #{timeout} seconds"
9380
end
9481
end
9582
end

spec/ruby/library/socket/socket/tcp_server_loop_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@
3131
end
3232
end
3333

34-
SocketSpecs.wait_until_success do
35-
@client.connect(Socket.sockaddr_in(@port, '127.0.0.1'))
34+
SocketSpecs.loop_with_timeout do
35+
begin
36+
@client.connect(Socket.sockaddr_in(@port, '127.0.0.1'))
37+
rescue SystemCallError
38+
sleep 0.01
39+
:retry
40+
end
3641
end
3742

3843
# At this point the connection has been set up but the thread may not yet

spec/ruby/library/socket/socket/udp_server_loop_spec.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,17 @@
3535
@client.connect(Socket.sockaddr_in(@port, '127.0.0.1'))
3636

3737
SocketSpecs.loop_with_timeout do
38-
SocketSpecs.wait_until_success { @client.write('hello') }
39-
40-
break if msg
38+
begin
39+
@client.write('hello')
40+
rescue SystemCallError
41+
sleep 0.01
42+
:retry
43+
else
44+
unless msg
45+
sleep 0.001
46+
:retry
47+
end
48+
end
4149
end
4250

4351
msg.should == 'hello'

spec/ruby/library/socket/socket/unix_server_loop_spec.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@
3939
end
4040
end
4141

42-
@client = SocketSpecs.wait_until_success { Socket.unix(@path) }
42+
SocketSpecs.loop_with_timeout do
43+
begin
44+
@client = Socket.unix(@path)
45+
rescue SystemCallError
46+
sleep 0.01
47+
:retry
48+
end
49+
end
4350

4451
thread.join(2)
4552

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
darwin(spurious):Socket.tcp_server_loop when a connection is available yields a Socket and an Addrinfo

tool/jt.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,10 @@ def help
622622
TXT
623623
end
624624

625+
def truffle_version
626+
puts super
627+
end
628+
625629
def mx(*args)
626630
super(*args)
627631
end

0 commit comments

Comments
 (0)