Skip to content

Commit a2bd7db

Browse files
author
Noah Gibbs
committed
Add example runner for 3.0 final benchmark
1 parent d0a0835 commit a2bd7db

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env ruby
2+
3+
# Simple example runner script, editable for different uses
4+
5+
RUBIES = [
6+
#"2.5.3",
7+
"2.6.6",
8+
"2.7.1",
9+
"ext-new_fake_2.8",
10+
]
11+
12+
TESTS = [
13+
"gem install bundler -v 1.17.3 && bundle _1.17.3_ && bundle _1.17.3_ exec ./start.rb -i 15000 -w 1000 -s 0 --no-warm-start -o data/",
14+
]
15+
16+
TIMES = 30
17+
18+
# Checked system - error if the command fails
19+
def csystem(cmd, err, opts = {})
20+
cmd = "bash -l -c \"#{cmd}\"" if opts[:bash] || opts["bash"]
21+
print "Running command: #{cmd.inspect}\n" if opts[:to_console] || opts["to_console"] || opts[:debug] || opts["debug"]
22+
if opts[:to_console] || opts["to_console"]
23+
system(cmd, out: $stdout, err: :out)
24+
else
25+
out = `#{cmd}`
26+
end
27+
unless $?.success? || opts[:fail_ok] || opts["fail_ok"]
28+
puts "Error running command:\n#{cmd.inspect}"
29+
puts "Output:\n#{out}\n=====" if out
30+
raise err
31+
end
32+
end
33+
34+
commands = []
35+
RUBIES.each do |ruby|
36+
TESTS.each_with_index do |test, test_index|
37+
invocation = "rvm use #{ruby} && export RUBY_RUNNER_TEST_INDEX=#{test_index} && #{test}"
38+
commands.concat([invocation] * TIMES)
39+
end
40+
end
41+
42+
rand_commands = commands.shuffle
43+
44+
rand_commands.each do |command|
45+
csystem(command, "Error running test!", bash: true, to_console: true)
46+
end
47+
48+
csystem("touch #{ENV["HOME"]}/run_finished.txt", "Error creating run-finished file!", bash: false, to_console: true)

0 commit comments

Comments
 (0)