oktetlabs / test-environment

OKTET Labs Test Environment
Other
5 stars 9 forks source link

engine/tester: fix build on systems without color #44

Open okt-galaktionov opened 1 month ago

okt-galaktionov commented 1 month ago

Provide the necessary definitions and fix other compilation errors.

Testing done: fixed build issues on Linux distros where meson fails to find the curses library

okt-galaktionov commented 1 month ago

Sorry for the confusion. "Color" here means Tester's ability to use different colors in its output (named after the HAVE_COLOR macro). This ability is indeed provided by curses and there are indeed unlikely to be any relevant systems that don't provide it.

However, meson isn't always able to find it. Currently TE uses its find_library function to get the library directly, and it fails on some distributions due to some differences in packaging. Meson actually provides some of its own logic in its implementation of find_dependency('curses') that should allow it to find the library on pretty much any system, but it was added in meson 0.54.0, which may still be too new for people who live on Ubuntu 20.04, for example.

This patch just fixes the build on problematic systems, but Tester's output will be a little "boring". If it's deemed worth it, the minimal required version of meson can be bumped and curses detection can be updated.

ol-arteman commented 1 month ago

Sorry, I am not buying this so far. Would you mind providing an example of a system where this problem could arise?

okt-galaktionov commented 1 month ago

The distribution that I personally care about is Gentoo: https://bugs.gentoo.org/836696 I'm afraid I don't have all the details available to me right now but we have encountered this problem on some other system as well. If we didn't, this patch would have remained stashed on my hard drive.

ol-arteman commented 1 month ago

Still I think the right fix is to detect libncurses properly and also I don't think we need to bump the minimum required version Meson for that. I suppose that our build should instead try to link with libncurses instead of libcurses,

okt-galaktionov commented 1 month ago

Yes, I agree that looking for ncurses instead of curses should fix the detection problem.

At the same time, this patch fixes actual build errors that come up when curses isn't found. If you don't want to consider this case, then it may be best to remove the HAVE_COLOR macro altogether and have ncurses as a hard requirement.