Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add valgrind test targets #15

Closed
lilith opened this issue Feb 20, 2016 · 3 comments
Closed

Add valgrind test targets #15

lilith opened this issue Feb 20, 2016 · 3 comments

Comments

@lilith
Copy link
Member

lilith commented Feb 20, 2016

No description provided.

@lilith lilith added the ! label Feb 20, 2016
@lilith lilith modified the milestone: alpha 0.1 Feb 20, 2016
@lilith
Copy link
Member Author

lilith commented Feb 24, 2016

Fix warnings from png encoding

@lilith
Copy link
Member Author

lilith commented Mar 31, 2016

What we used to do:


desc "run with valgrind"
valgrind_task("--leak-check=full --show-leak-kinds=all", :valgrind => PROFILING_PROGRAM)

desc "run with callgrind"
valgrind_task("--tool=callgrind --dump-instr=yes --cache-sim=yes --branch-sim=yes", :callgrind => PROFILING_PROGRAM)

desc "run with cachegrind"
task :cachegrind => PROFILING_PROGRAM do |t|
  cachegrind_out_file = "/tmp/cachegrind-out-file"
  with_ld_library_path('.') do
    sh "valgrind #{VALGRIND_OPTS} --tool=cachegrind --branch-sim=yes --cachegrind-out-file=#{cachegrind_out_file} ./#{t.prerequisites.first}"
  end
  sh "cg_annotate #{cachegrind_out_file}"
end

desc "build the test program"
file TEST_PROGRAM => TEST_OBJECTS + LIB_OBJECTS do |t|
  sh "#{CXX} -Werror #{t.prerequisites.join(" ")} -o #{t.name}"
end

desc "build the theft_test program"
file "theft_test" => THEFT_TEST_OBJECTS + LIB_OBJECTS do |t|
  sh "#{CXX} -Werror #{t.prerequisites.join(" ")} -ltheft -o #{t.name}"
end

task :test => TEST_PROGRAM do
  sh "./#{TEST_PROGRAM} #{ENV['ARGS']}"
end

desc "Run the test program with valgrind"
valgrind_task("--leak-check=full --show-leak-kinds=all --error-exitcode=2", :test_with_valgrind => TEST_PROGRAM)

desc "Run theft_test with valgrind"
valgrind_task("--leak-check=full --show-leak-kinds=all", :theft_test_with_valgrind => "theft_test")

@lilith
Copy link
Member Author

lilith commented Sep 17, 2016

This is now part of build.sh for both C and Rust. CI fails if any leaks or undefined behaviors are detected.

@lilith lilith closed this as completed Sep 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant