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,8 +33,16 @@ module BaseTestCase ...@@ -33,8 +33,16 @@ module BaseTestCase
end end
def nginx_executable def nginx_executable
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'] return ENV['NGINX_EXEC'].nil? ? "/usr/local/nginx/sbin/nginx" : ENV['NGINX_EXEC']
end end
end
def is_to_use_memory_check
!ENV['CHECK_MEMORY'].nil? and !`which valgrind`.empty?
end
def nginx_address def nginx_address
return "http://#{nginx_host}:#{nginx_port}" return "http://#{nginx_host}:#{nginx_port}"
......
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