2012-08-07 20:48:28 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2012-08-15 07:16:52 +00:00
|
|
|
gtest_apps = %w{common propedit}
|
2012-08-13 18:41:35 +00:00
|
|
|
|
2012-08-07 20:48:28 +00:00
|
|
|
namespace :tests do
|
2012-08-26 10:36:14 +00:00
|
|
|
desc "Build the unit tests"
|
|
|
|
task :unit => gtest_apps.collect { |app| "tests/unit/#{app}/#{app}" }
|
|
|
|
|
2012-08-07 20:48:28 +00:00
|
|
|
desc "Build and run the unit tests"
|
2012-08-26 10:36:14 +00:00
|
|
|
task :run_unit => 'tests:unit' do
|
2012-08-13 18:41:35 +00:00
|
|
|
gtest_apps.each { |app| run "./tests/unit/#{app}/#{app}" }
|
2012-08-07 20:48:28 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
$build_system_modules[:gtest] = {
|
|
|
|
:setup => lambda do
|
|
|
|
$flags[:cxxflags] += " -Ilib/gtest -Ilib/gtest/include"
|
|
|
|
$flags[:ldflags] += " -Llib/gtest/src"
|
|
|
|
end,
|
|
|
|
|
|
|
|
:define_tasks => lambda do
|
2012-08-15 07:16:52 +00:00
|
|
|
gtest_libs = {
|
|
|
|
'common' => [],
|
|
|
|
'propedit' => [ :mtxpropedit ],
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:48:28 +00:00
|
|
|
#
|
|
|
|
# Google Test framework
|
|
|
|
#
|
|
|
|
Library.
|
|
|
|
new('lib/gtest/src/libgtest').
|
|
|
|
sources([ 'lib/gtest/src' ], :type => :dir).
|
|
|
|
create
|
|
|
|
|
2012-08-15 07:16:52 +00:00
|
|
|
Library.
|
|
|
|
new('tests/unit/libmtxunittest').
|
|
|
|
sources('tests/unit', :type => :dir).
|
|
|
|
create
|
|
|
|
|
2012-08-13 18:41:35 +00:00
|
|
|
gtest_apps.each do |app|
|
|
|
|
Application.
|
|
|
|
new("tests/unit/#{app}/#{app}").
|
|
|
|
description("Build the unit tests executable for '#{app}'").
|
|
|
|
aliases("unit_tests_#{app}").
|
|
|
|
sources([ "tests/unit/#{app}" ], :type => :dir).
|
2012-08-15 07:16:52 +00:00
|
|
|
libraries(gtest_libs[app], :mtxunittest, $common_libs, :gtest, :pthread).
|
2012-08-13 18:41:35 +00:00
|
|
|
create
|
|
|
|
end
|
2012-08-07 20:48:28 +00:00
|
|
|
end,
|
|
|
|
}
|