[WIP] CMake: Capture stderr when running tests.

A possible fix for #1301, based on @Islah's last comment there.
I looked into redirecting stderr for specific parts of the tests only, but as this [apparently cannot really be reverted](http://stackoverflow.com/questions/1908687/how-to-redirect-the-output-back-to-the-screen-after-freopenout-txt-a-stdo), that's not helpful..

```lua
-- redirect stderr
helpers.ffi.C.freopen("/dev/null", "w", helpers.ffi.C.stderr)

-- run test code that produces output to stderr
...

-- reset stderr
???
```