Opened 16 years ago

Closed 14 years ago

#243 closed defect (fixed)

common/fileutils.cc needs tests

Reported by: Richard Boulton Owned by: Olly Betts
Priority: normal Milestone: 1.2.3
Component: Test Suite Version: SVN trunk
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by Richard Boulton)

This file was added for use by the replication stuff, and handles parsing and some simple manipulation of paths. This is particularly tricky for windows paths, unfortunately, and needs proper testing.

Change History (11)

comment:1 by Richard Boulton, 16 years ago

Blocking: 160 added
Owner: changed from New Bugs to Richard Boulton

comment:2 by Richard Boulton, 16 years ago

Operating System: All
Status: newassigned

comment:4 by Richard Boulton, 16 years ago

Description: modified (diff)
Milestone: 1.1

comment:5 by Richard Boulton, 16 years ago

Blocking: 160 removed

comment:6 by Olly Betts, 15 years ago

Milestone: 1.1.01.1.1

Tests are good, but this isn't worth holding up 1.1.0 for.

comment:7 by Olly Betts, 15 years ago

Milestone: 1.1.11.1.7

Triaging milestone:1.1.1 bugs.

comment:8 by Olly Betts, 15 years ago

Milestone: 1.1.71.2.0

Not a blocker.

comment:9 by Olly Betts, 14 years ago

Milestone: 1.2.x1.2.3
Owner: changed from Richard Boulton to Olly Betts
Status: assignednew

Working on this,

comment:10 by Olly Betts, 14 years ago

Status: newassigned

As of r14838, there are now testcases in fileutils.cc. These aren't currently run (but you can build a little test program with:

g++ -DXAPIAN_UNIT_TEST -Icommon -I. -W -Wall -O2 -o test-fileutils common/fileutils.cc

It's also possible to define __WIN32__ to run those tests on Linux (and they pass too):

g++ -DXAPIAN_UNIT_TEST -D__WIN32__ -Icommon -I. -W -Wall -O2 -o test-fileutils common/fileutils.cc

I'm going to try to hook this up to the testsuite harness nicely next.

Adding these tests uncovered a few failures in the old routines which the new function fixes. The is (sadly) one case which you can't resolve reliably without knowing the current drive. Not sure if we care enough to be looking that up - the case is stub file /abs/o/lute referring to a database C:rel/a/tive which is either C:/abs/o/rel/a/tive (if C: is the current drive) or C:rel/a/tive (otherwise).

There's also no special handling for UNC paths (there wasn't before either) - \\SERVER\VOLUME should ideally be handled much like C: (at least you can't have a UNC path which is relative!) I'll commit a commented-out testcase which shows a problem with UNC paths in a moment (probably r14839).

comment:11 by Olly Betts, 14 years ago

OK, r14840 fixes UNC paths, at least for all the cases I can think of!

comment:12 by Olly Betts, 14 years ago

Resolution: fixed
Status: assignedclosed

Created new unittest program in r14842 which runs these tests.

Note: See TracTickets for help on using tickets.