Don't build tests in release configuration
Fix setting selection/active line from automation scripts

The error handling function is under the results of the called function,
not at the top of the stack, so lua_pop was removing the wrong thing.
Fix crash when cancelling an automation script