[Spice-devel] [PATCH spice-server 2/3] meson: Use dictionaries addition feature

Eduardo Lima (Etrunko) etrunko at redhat.com
Wed Jan 30 13:34:22 UTC 2019


On 1/30/19 11:25 AM, Frediano Ziglio wrote:
>>
>> Since meson 0.48 it is possible to 'add' to dictionaries as well. Make
>> use of this feature in our build.
>>
>> http://mesonbuild.com/Release-notes-for-0-48-0.html#dictionary-addition
>>
>> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
>> ---
>>  meson.build              |  2 +-
>>  server/tests/meson.build | 54 +++++++++++++++++++---------------------
>>  2 files changed, 26 insertions(+), 30 deletions(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 811099c6..29af6b04 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -4,7 +4,7 @@
>>  project('spice', 'c',
>>          version : run_command('build-aux/git-version-gen',
>>          '${MESON_SOURCE_ROOT}/.tarball-version', check :
>>          true).stdout().strip(),
>>          license : 'LGPLv2.1',
>> -        meson_version : '>= 0.47.2')
>> +        meson_version : '>= 0.48.0')
>>  
>>  message('Updating submodules')
>>  run_command('build-aux/meson/check-spice-common', check : true)
>> diff --git a/server/tests/meson.build b/server/tests/meson.build
>> index b79b1108..37c94120 100644
>> --- a/server/tests/meson.build
>> +++ b/server/tests/meson.build
>> @@ -31,45 +31,41 @@ foreach lib, params : stat_test_libs
>>                                install : false)
>>  endforeach
>>  
>> -tests = [
>> -  ['test-codecs-parsing', true],
>> -  ['test-options', true],
>> -  ['test-stat', true],
>> -  ['test-stream', true],
>> -  ['test-agent-msg-filter', true],
>> -  ['test-loop', true],
>> -  ['test-qxl-parsing', true],
>> -  ['test-stat-file', true],
>> -  ['test-leaks', true],
>> -  ['test-vdagent', true],
>> -  ['test-fail-on-null-core-interface', true],
>> -  ['test-empty-success', true],
>> -  ['test-channel', true],
>> -  ['test-stream-device', true],
>> -  ['test-listen', true],
>> -  ['test-record', true],
>> -  ['test-display-no-ssl', false],
>> -  ['test-display-streaming', false],
>> -  ['test-playback', false],
>> -  ['test-display-resolution-changes', false],
>> -  ['test-two-servers', false],
>> -  ['test-display-width-stride', false],
>> -]
>> +tests = {'test-codecs-parsing' : true,
>> +         'test-options' : true,
>> +         'test-stat' : true,
>> +         'test-stream' : true,
>> +         'test-agent-msg-filter' : true,
>> +         'test-loop' : true,
>> +         'test-qxl-parsing' : true,
>> +         'test-stat-file' : true,
>> +         'test-leaks' : true,
>> +         'test-vdagent' : true,
>> +         'test-fail-on-null-core-interface' : true,
>> +         'test-empty-success' : true,
>> +         'test-channel' : true,
>> +         'test-stream-device' : true,
>> +         'test-listen' : true,
>> +         'test-record' : true,
>> +         'test-display-no-ssl' : false,
>> +         'test-display-streaming' : false,
>> +         'test-playback' : false,
>> +         'test-display-resolution-changes' : false,
>> +         'test-two-servers' : false,
>> +         'test-display-width-stride' : false}
>>  
> 
> About indentation.
> Why 2 spaces instead of 4 like all other code?
> Why not using this indentation:
> 
> tests = {
>   'test-codecs-parsing' : true,
>   'test-options' : true,
>   ...
> }

Fixed.

> 
>>  if spice_server_has_sasl
>> -  tests += [['test-sasl', true]]
>> +  tests += {'test-sasl': true}
>>  endif
>>  
>>  if spice_server_has_gstreamer
>> -  tests += [['test-gst', false]]
>> +  tests += {'test-gst' : false}
>>    if get_option('extra-checks')
>>      test('video-encoders', files('video-encoders'))
>>    endif
>>  endif
>>  
>> -foreach t : tests
>> -  test_name = t[0]
>> -  is_test = t[1]
>> +foreach test_name, is_test : tests
>>    exe = executable(test_name,
>>                     sources : '@0 at .c'.format(test_name),
>>                     link_with : test_libs,
> 
> 
> A problem with hash is that the order of the items is not important
> while on array it is so is possible that the order of generation
> could change based on Meson versions or implementation/optimization.
> Is something you have considered?
> I would prefer to see test executed in a specific defined order.
> 

Hm, I did not consider the out-of-order nature of dictionaries, and
there is no way to ensure the tests will always be executed in the same
order.


-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com


More information about the Spice-devel mailing list