diff options
author | Dmitry Bogatov <KAction@debian.org> | 2019-05-14 11:56:46 +0000 |
---|---|---|
committer | Dmitry Bogatov <KAction@debian.org> | 2019-05-14 11:56:46 +0000 |
commit | ff2177c68252c80e75c2e0fbc4d40e8193d4cb36 (patch) | |
tree | fe5c4e7b5e8d8f9081c7438ee4c0e03415c6c14d | |
parent | 365f18bb70df268de5933176e55f4315295b62c7 (diff) |
Create package for test-related code.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | T.pm | 27 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | t/924903.t | 25 |
4 files changed, 30 insertions, 25 deletions
@@ -1,4 +1,4 @@ | |||
1 | all: | 1 | all: |
2 | check: | 2 | check: |
3 | prove | 3 | prove -I. |
4 | .PHONY: check | 4 | .PHONY: check |
@@ -0,0 +1,27 @@ | |||
1 | package T; | ||
2 | use strict; | ||
3 | use warnings; | ||
4 | use Cwd; | ||
5 | use Test::More; | ||
6 | use File::Copy::Recursive qw(dircopy); | ||
7 | use File::Path qw(remove_tree); | ||
8 | use Exporter; | ||
9 | our @ISA = qw(Exporter); | ||
10 | our @EXPORT = qw(system_ok); | ||
11 | |||
12 | my $root = Cwd::cwd; | ||
13 | $ENV{PATH} = "$root:$ENV{PATH}"; | ||
14 | $ENV{DH_AUTOSCRIPTDIR} = $root; | ||
15 | |||
16 | die '$0 does not match expected format' | ||
17 | unless ($0 =~ m#t/([0-9]+)\.t#); | ||
18 | my $number = $1; | ||
19 | my $srcdir = (-d "t/base/${number}") ? "t/base/${number}" : "t/base/default"; | ||
20 | my $testdir = "t/${number}"; | ||
21 | remove_tree($testdir); | ||
22 | dircopy($srcdir, $testdir); | ||
23 | chdir($testdir); | ||
24 | |||
25 | sub system_ok { ok(system(@_) == 0, "external command @_");} | ||
26 | |||
27 | 1; | ||
diff --git a/debian/changelog b/debian/changelog index 9cce49c..0147167 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -1,6 +1,7 @@ | |||
1 | dh-runit (2.8.11) UNRELEASED; urgency=medium | 1 | dh-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 | ||
@@ -2,31 +2,8 @@ | |||
2 | use strict; | 2 | use strict; |
3 | use warnings; | 3 | use warnings; |
4 | use Test::More tests => 3; | 4 | use Test::More tests => 3; |
5 | use File::Path qw(remove_tree); | ||
6 | use File::Copy::Recursive qw(dircopy); | ||
7 | use File::stat; | 5 | use File::stat; |
8 | use Cwd; | 6 | use T; |
9 | |||
10 | my $root = Cwd::cwd; | ||
11 | $ENV{PATH} = "$root:$ENV{PATH}"; | ||
12 | $ENV{DH_AUTOSCRIPTDIR} = $root; | ||
13 | |||
14 | sub 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 | |||
25 | sub system_ok { | ||
26 | ok(system(@_) == 0, "external command @_"); | ||
27 | } | ||
28 | |||
29 | prepare_source_package(); | ||
30 | 7 | ||
31 | system_ok('dh_runit', 'debian/test.runscript', 'name=test'); | 8 | system_ok('dh_runit', 'debian/test.runscript', 'name=test'); |
32 | my $path = 'debian/dh-runit-test/var/lib/runit/supervise/test'; | 9 | my $path = 'debian/dh-runit-test/var/lib/runit/supervise/test'; |