Subject: | Tests fail when run but the root user in Mac OS X |
If you run the test suite as the "root" user in Mac OS X, tests fail because root generally does
not have the same directories as regular users (e.g., no "Application Support" folder). It also
gets tripped up by the fact that root's home directory (/var/root) is below a symlink (/var is a
symlink to /private/var in Mac OS X.) Testing results are show below:
Show quoted text
cpan> look File::HomeDir
Running look for module 'File::HomeDir'
Trying to open a subshell in the build directory...
Working directory is /usr/local/src/CPAN/build/File-HomeDir-0.95-7hI8Xk
mymac [File-HomeDir-0.95-7hI8Xk]# id
uid=0(root) gid=0(wheel)
groups=0(wheel),101(com.apple.sharepoint.group.1),204(_developer),100(_lpoperator),98(_lp
admin),80(admin),61(localaccounts),29(certusers),20(staff),12(everyone),9(procmod),8(procvi
ew),5(operator),4(tty),3(sys),2(kmem),1(daemon),401(com.apple.access_screensharing),102(c
om.apple.sharepoint.group.2)
mymac [File-HomeDir-0.95-7hI8Xk]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for File::HomeDir
mymac [File-HomeDir-0.95-7hI8Xk]# make test
cp lib/File/HomeDir/Darwin.pm blib/lib/File/HomeDir/Darwin.pm
cp lib/File/HomeDir/Darwin/Cocoa.pm blib/lib/File/HomeDir/Darwin/Cocoa.pm
cp lib/File/HomeDir/Test.pm blib/lib/File/HomeDir/Test.pm
cp lib/File/HomeDir/MacOS9.pm blib/lib/File/HomeDir/MacOS9.pm
cp lib/File/HomeDir/Driver.pm blib/lib/File/HomeDir/Driver.pm
cp lib/File/HomeDir/Windows.pm blib/lib/File/HomeDir/Windows.pm
cp lib/File/HomeDir.pm blib/lib/File/HomeDir.pm
cp lib/File/HomeDir/Unix.pm blib/lib/File/HomeDir/Unix.pm
cp lib/File/HomeDir/FreeDesktop.pm blib/lib/File/HomeDir/FreeDesktop.pm
cp lib/File/HomeDir/Darwin/Carbon.pm blib/lib/File/HomeDir/Darwin/Carbon.pm
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0,
'inc', 'blib/lib', 'blib/arch')" t/*.t
t/01_compile.t ........ 1/11 # Implemented by: File::HomeDir::Darwin::Cocoa
t/01_compile.t ........ ok
t/02_main.t ........... 1/51
# Failed test 'Legacy %~ tied interface'
# at t/02_main.t line 256.
# got: '/private/var/root'
# expected: '/var/root'
# Looks like you failed 1 test of 51.
t/02_main.t ........... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/51 subtests
(less 21 skipped subtests: 29 okay)
t/10_test.t ........... ok
t/11_darwin.t ......... 1/6 Use of uninitialized value $this in pattern match (m//) at
t/11_darwin.t line 55.
# Failed test at t/11_darwin.t line 55.
# undef
# doesn't match '(?-xism:Application Support)'
# Looks like you failed 1 test of 6.
t/11_darwin.t ......... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/6 subtests
(less 4 skipped subtests: 1 okay)
t/12_darwin_carbon.t .. skipped: Not running on 32-bit Darwin
t/13_darwin_cocoa.t ... 1/6 Use of uninitialized value $this in pattern match (m//) at
t/13_darwin_cocoa.t line 60.
# Failed test at t/13_darwin_cocoa.t line 60.
# undef
# doesn't match '(?-xism:Application Support)'
# Looks like you failed 1 test of 6.
t/13_darwin_cocoa.t ... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/6 subtests
(less 4 skipped subtests: 1 okay)
Test Summary Report
-------------------
t/02_main.t (Wstat: 256 Tests: 51 Failed: 1)
Failed test: 28
Non-zero exit status: 1
t/11_darwin.t (Wstat: 256 Tests: 6 Failed: 1)
Failed test: 5
Non-zero exit status: 1
t/13_darwin_cocoa.t (Wstat: 256 Tests: 6 Failed: 1)
Failed test: 5
Non-zero exit status: 1
Files=6, Tests=104, 0 wallclock secs ( 0.04 usr 0.02 sys + 0.21 cusr 0.04 csys = 0.31 CPU)
Result: FAIL
Failed 3/6 test programs. 3/104 subtests failed.
make: *** [test_dynamic] Error 1
mymac [File-HomeDir-0.95-7hI8Xk]#