Module: Reviser::Extensions::Valgrind

Includes:
Helpers::System
Defined in:
ext/valgrind.rb

Constant Summary collapse

VALGRIND_FILE =
"valgrind.txt"

Instance Method Summary collapse

Methods included from Helpers::System

#exec_with_timeout, #find_executable

Instance Method Details

#memleaksObject

Check memory leaks of the program The module uses execution value written in the config file of the project

Yann, execution_count shall be taken in count imo



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'ext/valgrind.rb', line 39

def memleaks
	executable = find_executable
	program = "#{Cfg[:program_prefix]}#{executable}"
	param = Cfg.has_key?(:execution_value) ? Cfg[:execution_value].first : ''
	cmd = "valgrind --leak-check=full --track-origins=yes --show-reachable=yes #{program} #{param}"
	out = exec_with_timeout cmd
	File.open(VALGRIND_FILE, 'w') { |f| f.write "$ #{cmd}\r#{out[:stdout]}\r#{out[:stderr]}" }
	
	result = File.join(FileUtils.pwd, VALGRIND_FILE)
	manufacture do |format|
		format.html { '<a href="' + result + '" target="_blank">' + result + '</a>' }
		format.csv { result }
		format.xls { result }
	end
end