alcotest icon indicating copy to clipboard operation
alcotest copied to clipboard

GitLab compatibility

Open Pitometsu opened this issue 6 years ago • 9 comments

Hello, not sure, where to ask, so created an issue here.

So, I have such output from dune for runtest on local:

Screenshot from 2019-04-18 16-00-57

And here you can see lots of colors

But here what I see on GitLab CI from same command:

Screenshot from 2019-04-18 15-58-35

As you see, terminal in general able to show ascii colors, and I force it to have TERM=linux. However, alcotest doesn't render colors there, and didn't cleanup intermediate ... lines, just duplicate them on additional final test output.

What can be wrong here, and is it a known issue, and is there any workaround (e. g. like --no-buffer -j 1 for dune to let alcotest print colors).

Pitometsu avatar Apr 18 '19 13:04 Pitometsu

Looks like it fails because test -t 1 fails (device is NOT a TTY). So is there a way to force Alcotest use colors here?

Pitometsu avatar Apr 18 '19 15:04 Pitometsu

To test, try to dune runtest | less -r (almost same result).

Pitometsu avatar Apr 18 '19 15:04 Pitometsu

for me, dune runtest in an alcotest repository does not output any colours. when I run dune runtest --no-buffer, I get coloured output -- you could try to add --no-buffer in your opam.

hannesm avatar Apr 18 '19 16:04 hannesm

@hannesm so try dune --no-buffer runtest | less -r

Pitometsu avatar Apr 18 '19 16:04 Pitometsu

Yeah, great success!

I found a workaround:

TERM=linux unbuffer dune --no-buffer runtest | less -r

(the unbuffer from the expect package) BUT it still would be convenient to have such option in alcotest to force colors (ignore terminal check).

Pitometsu avatar Apr 18 '19 16:04 Pitometsu

At least because unbuffer is half-ass solution (it broke emoji in output for example).

Pitometsu avatar Apr 18 '19 16:04 Pitometsu

great success! when I manually execute a test _build/default/test/client/test_client.exe --help, there's a --color=always,auto,never command line argument -- thus alcotest already provides this, but I suspect you'll need to find a way to pass this in dune runtest

hannesm avatar Apr 18 '19 16:04 hannesm

a way to pass this in dune runtest

Exactly.

Pitometsu avatar Apr 18 '19 16:04 Pitometsu

And there's still line duplication in CI, not sure, what can cause it, can't reproduce locally:

Screenshot from 2019-04-18 19-28-21

Pitometsu avatar Apr 18 '19 16:04 Pitometsu