summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@debian.org>2019-05-14 11:56:46 +0000
committerDmitry Bogatov <KAction@debian.org>2019-05-14 11:56:46 +0000
commitff2177c68252c80e75c2e0fbc4d40e8193d4cb36 (patch)
treefe5c4e7b5e8d8f9081c7438ee4c0e03415c6c14d
parent365f18bb70df268de5933176e55f4315295b62c7 (diff)
Create package for test-related code.
-rw-r--r--Makefile2
-rw-r--r--T.pm27
-rw-r--r--debian/changelog1
-rw-r--r--t/924903.t25
4 files changed, 30 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index e39c248..46acb19 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
1all: 1all:
2check: 2check:
3 prove 3 prove -I.
4.PHONY: check 4.PHONY: check
diff --git a/T.pm b/T.pm
new file mode 100644
index 0000000..4178fd8
--- /dev/null
+++ b/T.pm
@@ -0,0 +1,27 @@
1package T;
2use strict;
3use warnings;
4use Cwd;
5use Test::More;
6use File::Copy::Recursive qw(dircopy);
7use File::Path qw(remove_tree);
8use Exporter;
9our @ISA = qw(Exporter);
10our @EXPORT = qw(system_ok);
11
12my $root = Cwd::cwd;
13$ENV{PATH} = "$root:$ENV{PATH}";
14$ENV{DH_AUTOSCRIPTDIR} = $root;
15
16die '$0 does not match expected format'
17 unless ($0 =~ m#t/([0-9]+)\.t#);
18my $number = $1;
19my $srcdir = (-d "t/base/${number}") ? "t/base/${number}" : "t/base/default";
20my $testdir = "t/${number}";
21remove_tree($testdir);
22dircopy($srcdir, $testdir);
23chdir($testdir);
24
25sub system_ok { ok(system(@_) == 0, "external command @_");}
26
271;
diff --git a/debian/changelog b/debian/changelog
index 9cce49c..0147167 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
1dh-runit (2.8.11) UNRELEASED; urgency=medium 1dh-runit (2.8.11) UNRELEASED; urgency=medium
2 2
3 * Make build system respect `nocheck' option. 3 * Make build system respect `nocheck' option.
4 * Create package for test-related code.
4 5
5 -- Dmitry Bogatov <KAction@debian.org> Wed, 20 Mar 2019 13:22:22 +0000 6 -- Dmitry Bogatov <KAction@debian.org> Wed, 20 Mar 2019 13:22:22 +0000
6 7
diff --git a/t/924903.t b/t/924903.t
index fa70834..710ea39 100644
--- a/t/924903.t
+++ b/t/924903.t
@@ -2,31 +2,8 @@
2use strict; 2use strict;
3use warnings; 3use warnings;
4use Test::More tests => 3; 4use Test::More tests => 3;
5use File::Path qw(remove_tree);
6use File::Copy::Recursive qw(dircopy);
7use File::stat; 5use File::stat;
8use Cwd; 6use T;
9
10my $root = Cwd::cwd;
11$ENV{PATH} = "$root:$ENV{PATH}";
12$ENV{DH_AUTOSCRIPTDIR} = $root;
13
14sub prepare_source_package {
15 die '$0 does not match expected format'
16 unless ($0 =~ m#t/([0-9]+)\.t#);
17 my $number = $1;
18 my $srcdir = (-d "t/base/${number}") ? "t/base/${number}" : "t/base/default";
19 my $testdir = "t/${number}";
20 dircopy($srcdir, $testdir);
21 chdir($testdir);
22 return $testdir;
23}
24
25sub system_ok {
26 ok(system(@_) == 0, "external command @_");
27}
28
29prepare_source_package();
30 7
31system_ok('dh_runit', 'debian/test.runscript', 'name=test'); 8system_ok('dh_runit', 'debian/test.runscript', 'name=test');
32my $path = 'debian/dh-runit-test/var/lib/runit/supervise/test'; 9my $path = 'debian/dh-runit-test/var/lib/runit/supervise/test';