Added start and stop beef tasks to the rake tests

This commit is contained in:
Wade Alcorn
2012-01-12 19:03:44 +10:00
parent d103d2a9ee
commit 5a83e1f5ed

View File

@@ -30,7 +30,9 @@ end
desc "Run integration unit tests"
task :integration => ["install"] do
Rake::Task['beef_start'].invoke
sh "cd test/integration;ruby -W0 ts_integration.rb"
Rake::Task['beef_stop'].invoke
end
desc "Run integration unit tests"
@@ -50,6 +52,28 @@ task :install do
sh "bundle > /dev/null"
end
################################
# BeEF environment set up
@beef_process_id = nil;
task :beef_start => 'beef' do
printf "Starting BeEF (wait 10 seconds)..."
@beef_process_id = IO.popen("./beef -x 2> /dev/null", "w+")
delays = [2, 2, 1, 1, 1, 0.5, 0.5 , 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05]
delays.each do |i| # delay for 10 seconds
printf '.'
sleep (i) # increase the . display rate
end
puts '.'
end
task :beef_stop do
puts "\nShutting down BeEF...\n"
puts @beef_process_id.pid
Process.kill 'INT', -Process.getpgrp
end
################################
# MSF environment set up