Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make bin/vspec output unbuffered in order to make it possible to create shell wrappers #34

Open
glts opened this issue Feb 8, 2014 · 5 comments

Comments

@glts
Copy link
Contributor

glts commented Feb 8, 2014

In the solution for #15 a final filter sed 's/\r$//' was added in bin/vspec.

Unfortunately, by default sed buffers its output, so it is no longer possible to add another filter and see the output live.

vspec . t/test.vim | grep '# TODO'
# have to wait until whole test is finished!

Making sed output unbuffered (sed -u) or line-buffered (sed -l) fixes the problem. Unfortunately there are many different sed flavours and not all of them have these flags.

The reason this is a problem for me is that I use a small benchmark wrapper around vspec, and the benchmark tests I run with it can take quite long. For one benchmark, for example, I have to wait 20 seconds until the whole thing is finished and I can see the benchmark results.

@kana
Copy link
Owner

kana commented Feb 9, 2014

Thank you for the report. I've confirmed the problem.

By the way, I use prove

@kana
Copy link
Owner

kana commented Feb 9, 2014

Oops, I accidentally posted halfway.

By the way, I use prove to run a bunch of test script. I think it does the same job as your vbench, because both are wrappers around bin/vspec. But prove gives me filtered output from bin/vspec at realtime, while bin/vspec ... | grep foo doesn't behave so. Therefore, there might be a workaround or a proper method to resolve this problem at the side of wrappers.

@glts
Copy link
Contributor Author

glts commented Feb 9, 2014

This looks very promising. I will look inside Test::Harness when I get the chance.

@glts
Copy link
Contributor Author

glts commented Mar 27, 2014

Today I tried prove, but I do not see any real-time output. It's the same as with any command-line filter. How did you do it? I did it like this:

prove -v -e 'vspec path/to/vspec path/to/myplugin' t/bench.vim

I searched around a bit for a solution. The answers I found all say that it isn't easily possible to unbuffer existing programs. The only way is to make the wrapper pretend to be a terminal.

I'm not sure if this problem is the responsibility of vspec or of the wrapper.

Interesting resources:

@kana
Copy link
Owner

kana commented Apr 3, 2014

Ah... I'm sorry. I compared results of wrong commands. I ran

prove --exec 'vspec ...' -ext '.vim' | grep foo

rather than

prove --exec 'vspec ...' t/foo.vim | grep foo

to compare with vspec ... | grep foo. The former filters result from test scripts in t/, while the latter filters result from a single test script.
So I misunderstood that prove gave me a real-time output. But prove does not output in real time for each test script, as you wrote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants