No, because that wouldn't print any diagnostics as to why the
connection/surface was invalid. I added those when debugging why the
frame_uniformity test was assert()ing :)
There might be an argument for having mir_assert_*_is_valid convenience
functions in the client library that do this, now that we've got client
library logging!
On Thu, Dec 18, 2014 at 11:46 PM, Alan Griffiths <email address hidden> output_ id_invalid} ; create_ surface_ sync(connection , mir_surface_ is_valid( surface) ); is_valid( surface) ) get_error_ message( surface) << std::endl; lient:: run(std: :string const& connect_string) sync(connect_ string. c_str() , uniformity- test"); mir_connection_ is_valid( connection) ); n_is_valid( connection) ) get_error_ message( connection) << std::endl;
wrote:
> 40 +#include <iostream>
> 41 #include <assert.h>
> 42
> 43 namespace mt = mir::test;
> 44 @@ -45,7 +46,11 @@
> 45 mir_display_
> 46
> 47 auto surface = mir_connection_
> &surface_params);
> 48 - assert(
> 49 + if (!mir_surface_
> 50 + {
> 51 + std::cerr << "Surface creation failed: " <<
> mir_surface_
> 52 + exit(1);
> 53 + }
> 54
> 55 return surface;
> 56 }
> 57 @@ -93,7 +98,11 @@
> 58 void TouchMeasuringC
> 59 {
> 60 auto connection = mir_connect_
> "frame-
> 61 - assert(
> 62 + if (!mir_connectio
> 63 + {
> 64 + std::cerr << "Connection to Mir failed: " <<
> mir_connection_
> 65 + exit(1);
> 66 + }
>
> wouldn't "#undef NDEBUG" before including <cassert> be simpler and
> clearer?
No, because that wouldn't print any diagnostics as to why the
connection/surface was invalid. I added those when debugging why the
frame_uniformity test was assert()ing :)
There might be an argument for having mir_assert_ *_is_valid convenience
functions in the client library that do this, now that we've got client
library logging!