]> git.notmuchmail.org Git - notmuch/commit
test: say_color() in one write(2)
authorTomi Ollila <tomi.ollila@iki.fi>
Thu, 6 May 2021 14:12:32 +0000 (17:12 +0300)
committerDavid Bremner <david@tethera.net>
Sun, 23 May 2021 11:05:15 +0000 (08:05 -0300)
commitf2533b9e730c12276c32abe7126d7eabc7fcb8c6
treeee58ce7f30e0bc37a4b8a03eb44fae8eba32836d
parent69c2c930ecbcba0c7f0b340db478e58ca218bf87
test: say_color() in one write(2)

say_color() used to call (builtin) printf (and tput(1) to stdout)
several times, which caused attempts to write messages with color
to have partial content (e.g. escape sequences) often intermixed
with other tests when parallel tests were run.

Now, with all output collected, then written out using one
printf, all strings with color print out correctly
((at least short) write(2)'s appear to write out "atomically").

While at it, used only one tput(1) execution to determine whether
color output works, and made bold/colors/sgr0 to tput(1) their
values once per test.
test/test-lib.sh