Subject: | make test fails for get/setpriority |
make test fails. Following is the complete output:
$ make test
PERL_DL_NONLAZY=1 /tdev/bin/perl5.8.1 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/getpriority....Use of uninitialized value in concatenation (.) or string at t/getpriority.t line 20.
Use of uninitialized value in pattern match (m//) at t/getpriority.t line 22.
Use of uninitialized value in concatenation (.) or string at t/getpriority.t line 27.
Use of uninitialized value in pattern match (m//) at t/getpriority.t line 29.
Use of uninitialized value in concatenation (.) or string at t/getpriority.t line 34.
Use of uninitialized value in pattern match (m//) at t/getpriority.t line 36.
FAILED tests 1-3
Failed 3/3 tests, 0.00% okay
t/getrlimit......ok
t/getrusage......ok
t/setpriority....Use of uninitialized value in concatenation (.) or string at t/setpriority.t line 13.
Use of uninitialized value in concatenation (.) or string at t/setpriority.t line 19.
Use of uninitialized value in concatenation (.) or string at t/setpriority.t line 28.
This happens only on SunOS 5.6
$ uname -a
SunOS ap555sun 5.6 Generic_105181-34 sun4u sparc SUNW,Ultra-80
The code works fine on the other 2 servers I tested - Linux 2.4.9-e.18 (RHAS 2.1) and Solaris 9 (SunOS 5.9).
The tests fail because getpriority() returns undef. In C code, it returns
-1 with errno set to 3 (ESRCH).
I wrote the following test program to check:
$ cat tst.c
#include <sys/resource.h>
#include <errno.h>
main(int argc, char *argv[])
{
int prio;
id_t process = (id_t) 0;
errno = 0;
prio = getpriority(PRIO_PROCESS, process);
printf("prio = %d, errno = %d\n", prio, errno);
if (errno)
perror("error: getpriority() ");
else
printf("getpriority() returned %d\n", prio);
}
$ rm -f tst && make tst && ./tst
cc -L/usr/local/lib -o tst tst.c
prio = -1, errno = 3
error: getpriority() : No such process
I've confirmed that the test program works on Solaris 9 (prio is returned as 0).
A truss shows the following:
truss -o t.out ./tst
$ cat t.out
execve("./tst", 0xEFFFF8F0, 0xEFFFF8F8) argc = 1
resolvepath("/usr/lib/ld.so.1", "/usr/lib/ld.so.1", 1023) = 16
open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/tdev/oracle/9.2.0.4/lib/libc.so.1", O_RDONLY) Err#2 ENOENT
open("/tdev/lib/libc.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libc.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libc.so.1", O_RDONLY) = 3
fstat(3, 0xEFFFEFD4) = 0
mmap(0x00000000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xEF7B0000
mmap(0x00000000, 712704, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xEF680000
mmap(0xEF724000, 30500, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, , 606208) = 0xEF724000
open("/dev/zero", O_RDONLY) = 4
mmap(0xEF72C000, 4408, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4 0) = 0xEF72C000
munmap(0xEF716000, 57344) = 0
mmap(0x00000000, 8192, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 4, 0) = 0xE7A0000
memcntl(0xEF680000, 101964, MC_ADVISE, 0x0003, 0, 0) = 0
close(3) = 0
open("/tdev/oracle/9.2.0.4/lib/libdl.so.1", O_RDONLY) Err#2 ENOENT
open("/tdev/lib/libdl.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libdl.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libdl.so.1", O_RDONLY) = 3
fstat(3, 0xEFFFEFD4) = 0
mmap(0xEF7B0000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xEFB0000
close(3) = 0
open("/usr/platform/SUNW,Ultra-80/lib/libc_psr.so.1", O_RDONLY) = 3
fstat(3, 0xEFFFEE34) = 0
mmap(0x00000000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xEF790000
mmap(0x00000000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xEF780000
close(3) = 0
close(4) = 0
munmap(0xEF790000, 8192) = 0
priocntlsys(1, 0xEFFFF70C, 0, 0xEFFFF804) = 4
priocntlsys(1, 0xEFFFF70C, 3, 0xEFFFF7E0) Err#3 ESRCH
priocntlsys(1, 0xEFFFF70C, 0, 0xEFFFF804) = 4
priocntlsys(1, 0xEFFFF70C, 3, 0xEFFFF7E0) Err#3 ESRCH
ioctl(1, TCGETA, 0xEFFFE974) = 0
write(1, " p r i o = - 1 , e".., 21) = 21
brk(0x00020990) = 0
brk(0x00022990) = 0
write(2, " e r r o r : g e t p r".., 21) = 21
write(2, " : ", 2) = 2
write(2, " N o s u c h p r o c".., 15) = 15
write(2, "\n", 1) = 1
llseek(0, 0, SEEK_CUR) = 8375
_exit(1)
----------------
I use perl5.8.1