Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it |
6 |
# under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation; either version 3 of the License, or |
8 |
# (at your option) any later version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but |
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# GNU General Public License for more details. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
18 |
use Modern::Perl; |
19 |
use Test::More tests => 1; |
20 |
|
21 |
my $pid = qx[ps ax | grep 'background_jobs_worker.pl --queue default' | grep -v grep | tail -n1 | awk '{print \$1}']; |
22 |
|
23 |
chomp $pid; |
24 |
|
25 |
SKIP: { |
26 |
skip "No background_jobs_worker.pl process running for the default queue", 1 |
27 |
unless $pid; |
28 |
my $memory_usage = qx[pmap -x $pid | tail -n 1 | awk '/[0-9]/{print \$3}']; |
29 |
chomp $memory_usage; |
30 |
if ( $memory_usage > 150000 ) { |
31 |
fail("background_jobs_worker.pl is consuming more than 150Mo in memory: $memory_usage"); |
32 |
} |
33 |
else { |
34 |
pass("background_jobs_worker.pl is consuming $memory_usage in memory"); |
35 |
} |
36 |
} |