summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc van der Wal <marc.vanderwal@afnic.fr>2022-09-05 07:45:07 +0200
committerMarc van der Wal <marc.vanderwal@afnic.fr>2022-09-05 07:45:07 +0200
commit65a7ce9e5d5faba1926b25bb2f173951b55fcd08 (patch)
tree42330e5e938693121ccbceae3eddf4c46a13c06d
parentdeec8e9cfa8abecceb1497d30c69b9ea0d4fde38 (diff)
Fix “bad CAA” unit tests on single-threaded Perl
Instantiation of a malformed CAA resource record is a guaranteed croak if and only if the Perl in use is compiled with support for interpreter threads (-DUSE_ITHREADS). If not, it won’t. So the unit test is modified to try to convert the bad CAA record back to presentation form, so that it does become a guaranteed croak.
-rw-r--r--t/rr.t7
1 files changed, 5 insertions, 2 deletions
diff --git a/t/rr.t b/t/rr.t
index f9f0403..f0850fd 100644
--- a/t/rr.t
+++ b/t/rr.t
@@ -228,8 +228,11 @@ subtest 'SPF' => sub {
subtest 'croak when given malformed CAA records' => sub {
my $will_croak = sub {
- Zonemaster::LDNS::RR->new(
- 'bad-caa.example. 3600 IN CAA \# 4 C0000202' )
+ # This will croak if LDNS.xs is compiled with -DUSE_ITHREADS
+ my $bad_caa = Zonemaster::LDNS::RR->new(
+ 'bad-caa.example. 3600 IN CAA \# 4 C0000202' );
+ # This will always croak
+ $bad_caa->string();
};
like( exception { $will_croak->() }, qr/^Failed to convert RR to string/ );
};