Fail rake spec if untested payloads

MSP-11145

Add action to spec task that will cause spec to exit(1) if
log/untested-payloads.log exists.  The untested payloads are then
printed with instructions of which spec to update.
bug/bundler_fix
Luke Imhoff 2014-10-21 13:46:39 -05:00
parent 003d8547c4
commit da450f49a4
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
1 changed files with 17 additions and 0 deletions

View File

@ -9,3 +9,20 @@ require 'metasploit/framework/require'
Metasploit::Framework::Require.optionally_active_record_railtie Metasploit::Framework::Require.optionally_active_record_railtie
Metasploit::Framework::Application.load_tasks Metasploit::Framework::Application.load_tasks
# append action to run after normal spec action
task :spec do
untested_payloads_pathname = Pathname.new 'log/untested-payloads.log'
if untested_payloads_pathname.exist?
$stderr.puts "Untested payload detected. Add tests to spec/modules/payload_spec.rb for payloads classes composed of the following payload modules:"
untested_payloads_pathname.open do |f|
f.each_line do |line|
$stderr.write " #{line}"
end
end
exit 1
end
end