Created
January 31, 2019 15:48
-
-
Save Azhng/3de61892e4755421056a44eba2d3ef15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
HOME = ENV['HOME'] | |
repeat = ARGV[0].to_i | |
assignment = ARGV[1] | |
cmd = ARGV[2] | |
verbose = ARGV[3] | |
Dir.chdir("#{HOME}/cs350-os161/os161-1.99/kern/conf") { | |
output = `./config ASST#{assignment}` | |
puts output | |
} | |
Dir.chdir("#{HOME}/cs350-os161/os161-1.99/kern/compile/ASST#{assignment}") { | |
output = `bmake depend` | |
puts output | |
output = `bmake` | |
puts output | |
output = `bmake install` | |
puts output | |
} | |
err_counter = 0 | |
threads = [] | |
repeat.times do |i| | |
threads << Thread.new do | |
Dir.chdir("#{HOME}/cs350-os161/root") { | |
puts "Running instance: #{i}" | |
IO.popen("sys161 kernel '#{cmd}'") do |io| | |
while (line = io.gets) do | |
puts line if verbose == 'true' | |
if line.include? 'panic' | |
err_counter = err_counter + 1 | |
end | |
end | |
end | |
} | |
end | |
end | |
puts "All executors launched" | |
threads.each { |t| t.join} | |
puts "Done" | |
if err_counter > 0 | |
puts "Shit gone wrong" | |
exit(1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment