[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 05/14] golang/xenlight: Add tests host related functionality functions
George Dunlap writes ("Re: [Xen-devel] [PATCH v4 05/14] golang/xenlight: Add tests host related functionality functions"): > I had a chat with Ian Jackson, and we agreed that it would be better > to create a file, maybe "test-common.c", that would contain this > variable, as well as the three functions below. > > Then the header ("test-common.h") would contain *declarations* of the > variable (i.e., "extern xentoollog_logger_stdiostream *logger;") and > function prototypes. > > The test-common.c file is small now, but it may grow as additional > functionality is needed. Right. > The other thing you might consider, to further reduce the boilerplate > you have in each unit test file, is to also include a libxl_ctx > pointer in test-common; and have create_context() simply return an int > (0 for success, -1 for failure). This would be nice. You might also consider whether create_context would better simply exit the program if it fails. That avoids any possibility of error handling bugs. And maybe it should be called test_common_setup() ? (Names are a matter of taste, though.) Also: in C, main needs to return a value. I'm surprised your compiler isn't complaining. (Are the compiler warnings properly enabled?) I think I mentioned this one before... Your test main functions should probably end with something like return test_common_complete(); (which would be like destroy_context but would return 0.) Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |