Subject: | 308-simple.t fails on NFS filesystems |
I get the following error when installing Lucy-0.3.2 (excerpt from build log):
t/305-indexer.t ....................... ok
t/306-dynamic_schema.t ................ ok
cannot remove directory for lucy_test/test_index/seg_4: Directory not empty at
buildlib/Lucy/Test/TestUtils.pm line 84
cannot remove directory for lucy_test/test_index: Directory not empty at
buildlib/Lucy/Test/TestUtils.pm line 84
Can't clean up 'lucy_test/test_index' at buildlib/Lucy/Test/TestUtils.pm line 85.
# Looks like you planned 8 tests but ran 7.
# Looks like your test exited with 39 just after 7.
t/308-simple.t ........................
Dubious, test returned 39 (wstat 9984, 0x2700)
Failed 1/8 subtests
t/309-span.t .......................... ok
t/310-heat_map.t ...................... ok
All the other tests pass.
I digged down to find the cause. If I run 308-simple.t in isolation it does this:
friedmab@rescomp216:~/.cpanm/latest-build/Lucy-0.3.2> perl -Iblib/arch/auto/Lucy -
Iblib/lib t/308-simple.t
1..8
ok 1 - search warks right after add
ok 2 - search returns total hits
ok 3 - commit upon destroy
ok 4 - next
ok 5 - next
ok 6 - next
ok 7 - search uses correct PolyAnalyzer
cannot remove directory for lucy_test/test_index/seg_4: Directory not empty at
buildlib/Lucy/Test/TestUtils.pm line 85
cannot remove directory for lucy_test/test_index: Directory not empty at
buildlib/Lucy/Test/TestUtils.pm line 85
Can't clean up 'lucy_test/test_index' at buildlib/Lucy/Test/TestUtils.pm line 86.
# Looks like you planned 8 tests but ran 7.
# Looks like your test exited with 39 just after 7.
I added some debugging into the TestUtils::init_test_index_loc() function, and ran the rmtree
steps explicitly. It turns out that this is the problem:
rmdir lucy_test/test_index/locks
rmdir lucy_test/test_index/seq_3
rmdir lucy_test/test_index/seq_4
unlink lucy_test/test_index/seg_4/.nfs0000000000c46c0d0000a2e0
rmdir seg_4
rmdir lucy_test/test_index
$VAR1 = {
'error' => [
{
'lucy_test/test_index/seg_4/.nfs0000000000c46c0d0000a2e0' => 'cannot
unlink file: Device or resource busy'
},
{
'lucy_test/test_index/seg_4/.nfs0000000000c46c0d0000a2e0' => 'cannot
restore permissions to 0100644: Device or resource busy'
},
{
'lucy_test/test_index/seg_4' => 'cannot remove directory: Directory not
empty'
},
{
'lucy_test/test_index' => 'cannot remove directory: Directory not empty'
}
]
};
0 files deleted
Can't clean up 'lucy_test/test_index' at buildlib/Lucy/Test/TestUtils.pm line 108.
I believe that the problem is in 308-simple.t. Because the file handle is still open NFS creates
the .nfs file, which makes the rmtree fail. The solution is to close the filehandle by adding an
"undef $lucy" before the SKIP block. Then the test passes:
friedmab@rescomp216:~/.cpanm/latest-build/Lucy-0.3.2> perl -Iblib/arch/auto/Lucy -
Iblib/lib t/308-simple.t
1..8
ok 1 - search warks right after add
ok 2 - search returns total hits
ok 3 - commit upon destroy
ok 4 - next
ok 5 - next
ok 6 - next
ok 7 - search uses correct PolyAnalyzer
ok 8 - Simple finishes indexing during END block (apparently)