The advantages are that we save a few lines, and that we can override logging using environment variables in more test executables.
Place this new helpers in a new source file os-util.[ch], and move the existing and related call path_is_os_tree() to it as well.