Commit 829624eb authored by Michael Pyne's avatar Michael Pyne

Reboot a small test suite.

Run "prove -Imodules" from the kdesrc-build source directory base to
run.  You need Test::More, TAP::Harness, hopefully not much else.
parent 214add2c
To run tests, make sure you have TAP::Harness and Test::More installed, and run
prove -Imodules
from the kdesrc-build base directory. The -I flag adds kdesrc-build's own
internal modules to the search path by default.
This will run all tests under t/.
If you want to run specific tests then do
prove -Imodules t/*.t
Replace the last parameter with the tests you want.
use 5.014;
use strict;
use warnings;
# Test tag names based on time
use Test::More;
use ksb::Application;
my $app = ksb::Application->new(qw(--pretend --rc-file t/data/branch-time-based/kdesrc-buildrc));
my @moduleList = $app->generateModuleList();
is(scalar @moduleList, 3, 'Right number of modules');
for my $mod (@moduleList) {
my $scm = $mod->scm();
isa_ok($scm, 'ksb::Updater::Git');
my ($branch, $type) = $scm->_determinePreferredCheckoutSource();
is($branch, 'master@{3 weeks ago}', 'Right tag name');
is($type, 'tag', 'Result came back as a tag with detached HEAD');
}
done_testing();
global
source-dir /tmp
git-repository-base kde kde:
bisect-tag master@{3 weeks ago}
end global
module-set pim
repository kde
use-modules kdepim kdepim-runtime akonadi
revision ${bisect-tag}
end module-set
# Sample rc file just for testing purposes
global
source-dir /tmp
make-options -j4
git-repository-base fake git://localhost/git-set/
end global
module-set set1
repository fake
use-modules setmod1 setmod2 setmod3
branch fake-branch2
end module-set
module module2
repository git://localhost/git/module2.git
make-options -j2
tag fake-tag5
end module
options setmod2
tag tag-setmod2
end options
use 5.014;
use strict;
use warnings;
# Test basic option reading from rc-files
use Test::More;
use ksb::Application;
my $app = ksb::Application->new(qw(--pretend --rc-file t/data/sample-rc/kdesrc-buildrc));
my @moduleList = @{$app->{modules}};
is(scalar @moduleList, 4, 'Right number of modules');
is($moduleList[3]->name(), 'module2', 'Right module name');
my $scm = $moduleList[3]->scm();
isa_ok($scm, 'ksb::Updater::Git');
my ($branch, $type) = $scm->_determinePreferredCheckoutSource();
is($branch, 'refs/tags/fake-tag5', 'Right tag name');
is($type, 'tag', 'Result came back as a tag');
is($moduleList[1]->name(), 'setmod2', 'Right module name from module-set');
($branch, $type) = $moduleList[1]->scm()->_determinePreferredCheckoutSource();
is($branch, 'refs/tags/tag-setmod2', 'Right tag name (options block)');
is($type, 'tag', 'options block came back as tag');
done_testing();
use 5.014;
use strict;
use warnings;
# Test use of --set-module-option-value
use Test::More;
use ksb::Application;
my $app = ksb::Application->new(qw(
--pretend --rc-file t/data/sample-rc/kdesrc-buildrc
--set-module-option-value), 'module2,tag,fake-tag10',
'--set-module-option-value', 'setmod2,tag,tag-setmod10');
my @moduleList = @{$app->{modules}};
is(scalar @moduleList, 4, 'Right number of modules');
my $scm = $moduleList[3]->scm();
my ($branch, $type) = $scm->_determinePreferredCheckoutSource();
is($branch, 'refs/tags/fake-tag10', 'Right tag name');
is($type, 'tag', 'Result came back as a tag');
($branch, $type) = $moduleList[1]->scm()->_determinePreferredCheckoutSource();
is($branch, 'refs/tags/tag-setmod10', 'Right tag name (options block from cmdline)');
is($type, 'tag', 'cmdline options block came back as tag');
done_testing();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment