Commit c3f6fdd8 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

improvement on commands to runs tests

parent e4a5e005
...@@ -105,11 +105,11 @@ end ...@@ -105,11 +105,11 @@ end
desc "Run all tests." desc "Run all tests."
task :tests, :executable, :host, :port, :workers, :tests_tmp_dir do |t, args| task :tests, :executable, :host, :port, :workers, :tests_tmp_dir do |t, args|
ENV['NGINX_EXEC'] = args[:executable] || nil ENV['NGINX_EXEC'] ||= args[:executable] || nil
ENV['NGINX_HOST'] = args[:host] || nil ENV['NGINX_HOST'] ||= args[:host] || nil
ENV['NGINX_PORT'] = args[:port] || nil ENV['NGINX_PORT'] ||= args[:port] || nil
ENV['NGINX_WORKERS'] = args[:workers] || nil ENV['NGINX_WORKERS'] ||= args[:workers] || nil
ENV['NGINX_TESTS_TMP_DIR'] = args[:tests_tmp_dir] || nil ENV['NGINX_TESTS_TMP_DIR'] ||= args[:tests_tmp_dir] || nil
require 'test/unit' require 'test/unit'
......
...@@ -33,7 +33,15 @@ module BaseTestCase ...@@ -33,7 +33,15 @@ module BaseTestCase
end end
def nginx_executable def nginx_executable
return ENV['NGINX_EXEC'].nil? ? "/usr/local/nginx/sbin/nginx" : ENV['NGINX_EXEC'] if is_to_use_memory_check
return "valgrind --show-reachable=yes --trace-children=yes --time-stamp=yes --leak-check=full --log-file=mld_#{method_name_for_test}.log #{ENV['NGINX_EXEC'].nil? ? "/usr/local/nginx/sbin/nginx" : ENV['NGINX_EXEC']}"
else
return ENV['NGINX_EXEC'].nil? ? "/usr/local/nginx/sbin/nginx" : ENV['NGINX_EXEC']
end
end
def is_to_use_memory_check
!ENV['CHECK_MEMORY'].nil? and !`which valgrind`.empty?
end end
def nginx_address def nginx_address
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment