Class: RubyMemcheck::TestTaskReporter
- Inherits:
-
Object
- Object
- RubyMemcheck::TestTaskReporter
- Defined in:
- lib/ruby_memcheck/test_task_reporter.rb
Constant Summary collapse
- VALGRIND_REPORT_MSG =
"Valgrind reported errors (e.g. memory leak or use-after-free)"
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ TestTaskReporter
constructor
A new instance of TestTaskReporter.
- #report_valgrind_errors ⇒ Object
- #run_ruby_with_valgrind(&block) ⇒ Object
- #setup ⇒ Object
Constructor Details
#initialize(configuration) ⇒ TestTaskReporter
Returns a new instance of TestTaskReporter.
10 11 12 13 |
# File 'lib/ruby_memcheck/test_task_reporter.rb', line 10 def initialize(configuration) @configuration = configuration @loaded_binaries = nil end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/ruby_memcheck/test_task_reporter.rb', line 7 def configuration @configuration end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/ruby_memcheck/test_task_reporter.rb', line 8 def errors @errors end |
Instance Method Details
#report_valgrind_errors ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/ruby_memcheck/test_task_reporter.rb', line 27 def report_valgrind_errors parse_valgrind_output remove_valgrind_xml_files unless errors.empty? output_valgrind_errors raise VALGRIND_REPORT_MSG end end |
#run_ruby_with_valgrind(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/ruby_memcheck/test_task_reporter.rb', line 15 def run_ruby_with_valgrind(&block) setup yield report_valgrind_errors end |
#setup ⇒ Object
21 22 23 24 25 |
# File 'lib/ruby_memcheck/test_task_reporter.rb', line 21 def setup ENV["RUBY_MEMCHECK_LOADED_FEATURES_FILE"] = File.(configuration.loaded_features_file) ENV["RUBY_MEMCHECK_RUNNING"] = "1" ENV["RUBY_FREE_AT_EXIT"] = "1" end |