hughsie/colord

tests: colord-daemon/client{import} sometimes fails

RAOF opened this issue · 7 comments

RAOF commented

I'm in the process of trying to get the installed tests running in the Ubuntu & Debian test infrastructure, and I can't seem to get the environment set up correctly for this test.

As far as I can tell, it calls cd_import_profile which ends up copying the profile into the user's ICC directory and then waiting for the daemon to pick Up the new profile. However, when running in the test infrastructure the daemon doesn't pick up the new file (nor can I see what code is actually watching the user directories - the daemon only seems to be monitoring system-wide locations)

What am I (or colord) missing here?

colord needs something running in the session to import the profile, either gnome-settings-daemon or xiccd should do the trick. I'd be open to a patch that disables this test if there's no gnome-settings-daemon in the process list, if that helps.

RAOF commented

Skipping the test if the session component isn't there sounds reasonable, and I might look into doing that, but this also seems like exactly the sort of full-system-integration test that would be most valuable to do.

Sadly, doing the obvious thing doesn't work - I've got the tests running under xvfb with a DBus session bus and a running instance of gsd-color --verbose, but they almost always fail with

(gsd-color:8442): libcolord-DEBUG: 05:20:21.808: Incorrect content type for /home/ubuntu/.local/share/icc/ibm-t61.icc, got text/plain

which is rather frustrating, because they sometimes pass (and file, gio info and the like all identify that file as a colour profile). There would appear to be a race somewhere that's only exposed in this rather artificial environment.

If gio info says the right content type that's tricky. Could it be done kind of mime cache that needs invalidating?

RAOF commented

Hm, maybe? I'll try running a more standard GNOME session and see if the problem remains.

RAOF commented

Hah! Excellent! This appears to have caught a real bug. Running a more standard GNOME session in the test environment makes the test mostly pass, but it still sometimes fails.

Just running gnome-desktop-testing-runnercolord/colord-daemon.test in a loop in my regular desktop session passes a lot, but eventually fails with

libcolord:ERROR:../lib/colord/cd-test-daemon.c:1516:colord_client_import_func: assertion failed (error == NULL): The profile was not added in time (cd_client_error, 0)

I guess this might actually be a gsd-color bug? I'll try and check that it prints the same debug output in a real session.

RAOF commented

Of course, passing --verbose to gsd-color causes the bug to go away in my session. Bah.

I've just run into this problem on Fedora 33 (colord v1.4.5) again. Trying to import the profile with colormgr import-profile my_profile.icc results in "The profile was not added in time".

Appears to be a long-standing bug: https://bugs.freedesktop.org/show_bug.cgi?id=82770 and https://bugzilla.redhat.com/show_bug.cgi?id=1372046

The file is copied to ~/.local/share/icc/ but it's not applied and it doesn't show up in gnome-settings color settings.