This file is indexed.

/var/lib/pcp/testsuite/perl/test.pl is in pcp-testsuite 4.0.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
#
# Copyright (c) 2004 Silicon Graphics, Inc.  All Rights Reserved.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 

######################### We start with some black magic to print on failure.

BEGIN { $| = 1; print "1..4\n"; }
END {print "not ok 1\n" unless $loaded;}
use PCP::PMDA;
$loaded = 1;
print "ok 1\n";

######################### End of black magic.

use vars qw( $cvalue $perlvalue $failed $cases );

`LDLIBS=-lpcp make -f Makefile cvalue`;

# verify constants are defined and match their C counterparts
# - assuming here that the header file matches our PMDA.pm
# (d==define)
# 
$failed = 0;
$cases = 0;
open(TEST, './cvalue d |') || die "cannot run test program 'cvalue'";
while (<TEST>) {
    /^(\w+)=(.*)$/;
    $cvalue = $2;
    $perlvalue = &$1;
    unless ($perlvalue == $cvalue) {
	print "$1: $perlvalue != $cvalue\n";
	$failed++;
    }
    $cases++;
}
close TEST;
if ($failed != 0) { print "not ok 2 (failed $failed of $cases cases)\n"; }
else { print "ok 2\n"; }

######################### 

# test data initialisation via the pmda_pmid macro (i==id)
# 
$failed = 0;
$cases = 0;
open(TEST, './cvalue i |') || die "cannot run test program 'cvalue'";
while (<TEST>) {
    /^PMDA_PMID: (\d+),(\d+) = (.*)$/;
    $cvalue = $3;
    $perlvalue = pmda_pmid($1, $2);
    unless ($perlvalue == $cvalue) {
	print "$1,$2: $perlvalue != $cvalue\n";
	$failed++;
    }
    $cases++;
}
close TEST;
if ($failed != 0) { print "not ok 3 (failed $failed of $cases cases)\n"; }
else { print "ok 3\n"; }

# test data initialisation via the pmda_units macro (u==units)
# 
$failed=0;
$cases = 0;
open(TEST, './cvalue u |') || die "cannot run test program 'cvalue'";
while (<TEST>) {
    /^pmUnits: (\d+),(\d+),(\d+),(\d+),(\d+),(\d+) = (.*)$/;
    $cvalue = $7;
    $perlvalue = pmda_units($1, $2, $3, $4, $5, $6);
    unless ($perlvalue == $cvalue) {
	print "$1,$2,$3,$4,$5,$6: $perlvalue != $cvalue\n";
	$failed++;
    }
    $cases++;
}
close TEST;
if ($failed != 0) { print "not ok 4 (failed $failed of $cases cases)\n"; }
else { print "ok 4\n"; }


#########################