Skip to content

Instantly share code, notes, and snippets.

@arturopie
Created October 3, 2011 19:44
Show Gist options
  • Save arturopie/1260030 to your computer and use it in GitHub Desktop.
Save arturopie/1260030 to your computer and use it in GitHub Desktop.
scripts to run sy2 and sy3 severak times and check if they pass
#!/usr/bin/ruby
require 'open3'
failed = false
for i in 1..20
puts i
stdin, stdout, stderr = Open3.popen3("sys161 kernel-ASST1 'sy2; q'")
if ((str = stderr.gets) =~ /sys161: Cannot/)
puts "There was an error"
puts "Output:"
puts str
return false
end
output = stdout.readlines.join(" ")
if output =~ /Test failed/ || output =~ /panic/
puts "A TEST FAILED!"
failed = true
puts "OUTPUT:"
puts output
break
end
end
puts "ALL TESTS PASSED!" unless failed
#!/usr/bin/ruby
require 'open3'
def test
for i in 1..5
puts "TEST #{i}"
stdin, stdout, stderr = Open3.popen3("sys161 kernel-ASST1 'sy3; q'")
if ((str = stderr.gets) =~ /sys161: Cannot/)
puts "There was an error"
puts "Output:"
puts str
return false
end
while (str = stdout.gets)
puts "Output: #{str}"
if str =~ /Test failed/ || str =~ /panic/
return false
end
if str =~ /Threads should print out in reverse order./
for i in 1..5
31.downto(0) do |j|
str = stdout.gets
unless str =~ /Thread #{j}/
puts "Output: #{str}"
return false
end
end
end
str = stdout.gets
unless str =~ /CV test done/
puts "Output: #{str}"
return false
end
end
end
end
return true
end
if test
puts "ALL TESTS PASSED!"
else
puts "SOME TESTS FAILED!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment