From 6a2698f5ecb392e4d5f66abb1148fb10cc46dedc Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 13 Aug 2012 20:41:35 +0200 Subject: [PATCH] Split single unit test directory into multiple ones The goal is to enable testing of application specific files, e.g. for mkvpropedit. --- .gitignore | 2 +- rake.d/gtest.rb | 25 +++++++++++++------- tests/unit/common/Rakefile | 9 +++++++ tests/unit/{ => common}/basic_timecode_c.cpp | 0 tests/unit/{all.cpp => common/common.cpp} | 0 5 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 tests/unit/common/Rakefile rename tests/unit/{ => common}/basic_timecode_c.cpp (100%) rename tests/unit/{all.cpp => common/common.cpp} (100%) diff --git a/.gitignore b/.gitignore index f057e55f8..7b294aecd 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,7 @@ /src/tools/ebml_validator /src/tools/vc1parser /tests/data -/tests/unit/all +/tests/unit/common/common BROWSE Makefile TAGS diff --git a/rake.d/gtest.rb b/rake.d/gtest.rb index 8d13ddca4..00ffebe37 100644 --- a/rake.d/gtest.rb +++ b/rake.d/gtest.rb @@ -1,9 +1,14 @@ #!/usr/bin/env ruby +gtest_apps = %w{common} +gtest_libs = { + 'common' => [], +} + namespace :tests do desc "Build and run the unit tests" - task :unit => [ 'tests/unit/all' ] do - run './tests/unit/all' + task :unit => gtest_apps.collect { |app| "tests/unit/#{app}/#{app}" } do + gtest_apps.each { |app| run "./tests/unit/#{app}/#{app}" } end end @@ -22,12 +27,14 @@ $build_system_modules[:gtest] = { sources([ 'lib/gtest/src' ], :type => :dir). create - Application. - new('tests/unit/all'). - description("Build the unit tests executable"). - aliases('unit_tests'). - sources([ 'tests/unit' ], :type => :dir). - libraries($common_libs, :gtest, :pthread). - create + 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). + libraries($common_libs, gtest_libs[app], :gtest, :pthread). + create + end end, } diff --git a/tests/unit/common/Rakefile b/tests/unit/common/Rakefile new file mode 100644 index 000000000..d2942860f --- /dev/null +++ b/tests/unit/common/Rakefile @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby + +$build_unit_tests = true + +import ['..', '../..', '../../..'].collect { |subdir| FileList[File.dirname(__FILE__) + "/#{subdir}/build-config.in"].to_a }.flatten.compact.first.gsub(/build-config.in/, 'Rakefile') + +# Local Variables: +# mode: ruby +# End: diff --git a/tests/unit/basic_timecode_c.cpp b/tests/unit/common/basic_timecode_c.cpp similarity index 100% rename from tests/unit/basic_timecode_c.cpp rename to tests/unit/common/basic_timecode_c.cpp diff --git a/tests/unit/all.cpp b/tests/unit/common/common.cpp similarity index 100% rename from tests/unit/all.cpp rename to tests/unit/common/common.cpp