Subject: | t/35clean.t may depend on locale |
Some test cases in t/35clean.t may fail if the current locale does not use English error messages (problem seen on a Linux Mint 13 system with German locale). The attached patch fixes the problem by checking Errno constants first, and if this does not work then fallback to the old stringy error messages.
Regards,
Slaven
Subject: | 0001-check-does-not-depend-on-locale-anymore.patch |
From 4374bad1ba8861ffd04c7a8c21b79768daf054e5 Mon Sep 17 00:00:00 2001
From: Slaven Rezic <srezic@cpan.org>
Date: Thu, 5 Dec 2013 15:57:08 +0100
Subject: [PATCH] $! check does not depend on locale anymore
---
t/35clean.t | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/t/35clean.t b/t/35clean.t
index a402fed..8e7f749 100644
--- a/t/35clean.t
+++ b/t/35clean.t
@@ -7,6 +7,7 @@ BEGIN {
use strict;
use Carp;
+use Errno;
use IPC::Shareable;
use IPC::Shareable::SharedMem;
my $t = 1;
@@ -16,8 +17,11 @@ sub gonzo {
# --- shmread should barf if the segment has really been cleaned
my $id = shift;
my $data = '';
- eval { shmread($id, $data, 0, 6) or die "$!" };
- return scalar($@ =~ /Invalid/ or $@ =~ /removed/);
+ shmread($id, $data, 0, 6) and return 0;
+ return $!{EINVAL} || $!{EIDRM}; # expected errno errors
+ # fallback to string error messages, works only with English locale
+ # on some systems
+ return scalar($! =~ /Invalid/ or $! =~ /removed/);
}
# --- remove()
--
1.7.9.5