Skip to content

Add test to demonstrate inconsistency in path normalization

Adriaan de Groot requested to merge work/adridg/fix-unittest into master
  • KStandardDirs::saveLocation() goes through realPath() and returns a canonical representation, with symlinks expanded.
  • KStandardDirs::localxdgconfdir() does not call realPath().

For systems where /home is often a symlink (read: FreeBSD) this causes failures later in the test, where canonicalized and non-canonical paths are compared. That leads to, e.g.,

29: FAIL!  : KStandarddirsTest::testLocateLocal() Compared values are not the same
29:    Actual   (QString(configLocal))                   : "/usr/home/adridg/.kde-unit-test/xdg/config/ksomethingrc"
29:    Expected (QString(m_configHome + "/ksomethingrc")): "/home/adridg/.kde-unit-test/xdg/config/ksomethingrc"

Those are the same path, but with difference canonicalization states (/home is a symlink to /usr/home).

This test doesn't fix the issue (I'm not sure whether doing the canonicalization in the test, or in the implementation under test is the "right" fix, nor whether it's worth investing more time into this library) but at least makes it clear why there is a persistent test-case failure.

Merge request reports