So, the QML tests are already setting XDG_CACHE_HOME.
I was having some trouble with those tests failing locally while passing in Jenkins, which I think I have solved since you made your original comment. In my environment I had QT_QPA_PLATFORMTHEME=appmenu-qt5, which seemed to be initialising the D-Bus connection prior to me replacing it with libqtdbustest. This meant the test was running against the installed copy of thumbnailer-service.
With the updates in the branch, ctest will blank out this environment variable when running the test, which made those tests pass reliably for me.
So, the QML tests are already setting XDG_CACHE_HOME.
I was having some trouble with those tests failing locally while passing in Jenkins, which I think I have solved since you made your original comment. In my environment I had QT_QPA_ PLATFORMTHEME= appmenu- qt5, which seemed to be initialising the D-Bus connection prior to me replacing it with libqtdbustest. This meant the test was running against the installed copy of thumbnailer- service.
With the updates in the branch, ctest will blank out this environment variable when running the test, which made those tests pass reliably for me.