Rakefile: task for cleaning just the unit tests

This commit is contained in:
Moritz Bunkus 2013-07-04 21:04:29 +02:00
parent 5ee51ef6f5
commit 06c07a0906
3 changed files with 22 additions and 9 deletions

View File

@ -33,6 +33,7 @@ require_relative "rake.d/extensions"
$build_system_modules = {}
$have_gtest = Dir.exists? 'lib/gtest'
$gtest_apps = []
require_relative "rake.d/config"
require_relative "rake.d/helpers"
@ -544,12 +545,8 @@ task :clean do
po/*.mo doc/guide/**/*.hhk
}
patterns += $applications + $tools.collect { |name| "src/tools/#{name}" }
verbose = ENV['V'].to_bool
patterns.collect { |pattern| FileList[pattern].to_a }.flatten.uniq.select { |file_name| File.exists? file_name }.each do |file_name|
puts " rm #{file_name}" if verbose
File.unlink file_name
end
remove_files_by_patters patterns
if Dir.exists? $dependency_dir
puts " rm -rf #{$dependency_dir}" if verbose
@ -585,6 +582,13 @@ namespace :clean do
run "rm -f doc/man/*.html doc/man/*/*.html"
end
end
desc "Remove compiled objects and programs in the unit test suite"
task :unittests do
patterns = %w{tests/unit/*.o tests/unit/*/*.o tests/unit/*.a tests/unit/*/*.a}
patterns += $gtest_apps.collect { |app| "tests/unit/#{app}/#{app}" }
remove_files_by_patters patterns
end
end
# Tests

8
rake.d/gtest.rb Normal file → Executable file
View File

@ -1,14 +1,14 @@
#!/usr/bin/env ruby
gtest_apps = %w{common propedit}
$gtest_apps = %w{common propedit}
namespace :tests do
desc "Build the unit tests"
task :unit => gtest_apps.collect { |app| "tests/unit/#{app}/#{app}" }
task :unit => $gtest_apps.collect { |app| "tests/unit/#{app}/#{app}" }
desc "Build and run the unit tests"
task :run_unit => 'tests:unit' do
gtest_apps.each { |app| run "./tests/unit/#{app}/#{app}" }
$gtest_apps.each { |app| run "./tests/unit/#{app}/#{app}" }
end
end
@ -37,7 +37,7 @@ $build_system_modules[:gtest] = {
sources('tests/unit', :type => :dir).
create
gtest_apps.each do |app|
$gtest_apps.each do |app|
Application.
new("tests/unit/#{app}/#{app}").
description("Build the unit tests executable for '#{app}'").

View File

@ -180,3 +180,12 @@ def adjust_to_poedit_style(in_name, out_name)
File.unlink in_name
end
def remove_files_by_patters patterns
verbose = ENV['V'].to_bool
patterns.collect { |pattern| FileList[pattern].to_a }.flatten.uniq.select { |file_name| File.exists? file_name }.each do |file_name|
puts " rm #{file_name}" if verbose
File.unlink file_name
end
end