[PATCH weston v5 5/6] Converted the config parser test to the new framework.

Jon A. Cruz jonc at osg.samsung.com
Thu Jul 2 18:12:21 PDT 2015


On 06/25/2015 07:18 AM, Pekka Paalanen wrote:
> On Sat, 20 Jun 2015 15:47:47 -0700
> "Jon A. Cruz" <jonc at osg.samsung.com> wrote:
> 
>> > +static void *setup_test_config(void *data)
>> > +{
>> > +	struct weston_config *config = load_config(data, true);
>> > +
>> > +	if (zuc_has_failure())
>> > +		ZUC_MARK_FATAL("Fixture setup failed.");
>> >  
>> >  	return config;
>> >  }
>> >  
>> > -static const char t0[] =
>> > -	"# nothing in this file...\n";
>> > +static void *setup_test_config_failing(void *data)
>> > +{
>> > +	return load_config(data, false);
> What if this actually succeeds in loading the config?
> Do we need a clean-up?
> 

As long as the test doesn't crash outright, the object created in the
setup function will be freed in the tear-down/cleanup function:

>> > +}
>> > +
>> > +static void cleanup_test_config(void *data)
>> > +{
>> > +	struct weston_config *config = data;
>> > +	ZUC_ASSERT_TRUE(config != NULL);
>> > +	weston_config_destroy(config);
>> > +}


In general this is the paired approach commonly used for fixtures, and
should probably get a good high-level writeup. The expectation was that
as soon as the first patch lands people will actually start asking more
questions about it and the answers collected up for documentation
enhancement.


-- 
Jon A. Cruz - Senior Open Source Developer
Samsung Open Source Group
jonc at osg.samsung.com


More information about the wayland-devel mailing list