Cmake url tests: Use try - catch mechanism while testing urls.

If a perl-submodule exits with 'die()', the process would stop
and the following urls would not be tested.
The bug detection and idea how to solve it: Scott Kostyshak.
This commit is contained in:
Kornel Benko 2014-01-08 13:36:30 +01:00
parent 0678254241
commit 037d474360

View File

@ -39,10 +39,12 @@ BEGIN {
}
use CheckURL;
use Try::Tiny;
use locale;
use POSIX qw(locale_h);
$ENV{LC_ALL} = "en_US.UTF-8";
$ENV{LANG} = "en_US.UTF-8";
$ENV{LANGUAGE} = "en_US.UTF-8";
setlocale(LC_CTYPE, "");
setlocale(LC_MESSAGES, "en_US.UTF-8");
my %URLS = ();
my %ignoredURLS = ();
@ -97,14 +99,22 @@ for my $u (@urls) {
}
next if ($checkSelectedOnly && ! defined($selectedURLS{$u}));
$URLScount++;
print "Checking '$u'";
my $res = &check_url($u);
if ($res) {
print ": Failed\n";
}
else {
print ": OK\n";
print "Checking '$u': ";
my ($res, $prnt);
try {
$res = &check_url($u);
if ($res) {
$prnt = "Failed";
}
else {
$prnt = "OK";
}
}
catch {
$prnt = "Failed, caught error: $_";
$res = 700;
};
print "$prnt\n";
my $printSourceFiles = 0;
my $err_txt = "Error url:";