[1/2] meson: don't check dependencies for tests if not required
Checks
Commit Message
Don't need to check dependencies if test apps will not be built anyway.
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
app/test/meson.build | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
Comments
On Wed, May 29, 2019 at 07:39:57PM +0300, Ilya Maximets wrote:
> Don't need to check dependencies if test apps will not be built anyway.
>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---
> app/test/meson.build | 38 +++++++++++++++++++-------------------
> 1 file changed, 19 insertions(+), 19 deletions(-)
>
Agree with the idea.
Would this work as a shorter alternative placed at the top of the file?
if not get_option('tests')
subdir_done()
endif
/Bruce
On 30.05.2019 14:55, Bruce Richardson wrote:
> On Wed, May 29, 2019 at 07:39:57PM +0300, Ilya Maximets wrote:
>> Don't need to check dependencies if test apps will not be built anyway.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>> ---
>> app/test/meson.build | 38 +++++++++++++++++++-------------------
>> 1 file changed, 19 insertions(+), 19 deletions(-)
>>
> Agree with the idea.
>
> Would this work as a shorter alternative placed at the top of the file?
>
> if not get_option('tests')
> subdir_done()
> endif
This looks good to me.
However, the resulted patch will be much larger because we'll have to
shift most of it to the left. If it's OK, I'll prepare v2 with this change.
What do you think?
Best regards, Ilya Maximets.
On Thu, May 30, 2019 at 03:06:17PM +0300, Ilya Maximets wrote:
> On 30.05.2019 14:55, Bruce Richardson wrote:
> > On Wed, May 29, 2019 at 07:39:57PM +0300, Ilya Maximets wrote:
> >> Don't need to check dependencies if test apps will not be built anyway.
> >>
> >> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> >> ---
> >> app/test/meson.build | 38 +++++++++++++++++++-------------------
> >> 1 file changed, 19 insertions(+), 19 deletions(-)
> >>
> > Agree with the idea.
> >
> > Would this work as a shorter alternative placed at the top of the file?
> >
> > if not get_option('tests')
> > subdir_done()
> > endif
>
> This looks good to me.
> However, the resulted patch will be much larger because we'll have to
> shift most of it to the left. If it's OK, I'll prepare v2 with this change.
> What do you think?
>
Yes, there will be some left-shifting, but it should just be a single block
from lines 338-419, which is probably ok. The end result is better, I
think.
@@ -313,29 +313,29 @@ endif
# specify -D_GNU_SOURCE unconditionally
cflags += '-D_GNU_SOURCE'
-test_dep_objs = []
-if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
- compress_test_dep = dependency('zlib', required: false)
- if compress_test_dep.found()
- test_dep_objs += compress_test_dep
- test_sources += 'test_compressdev.c'
- test_deps += 'compressdev'
- fast_non_parallel_test_names += 'compressdev_autotest'
+if get_option('tests')
+ test_dep_objs = []
+ if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
+ compress_test_dep = dependency('zlib', required: false)
+ if compress_test_dep.found()
+ test_dep_objs += compress_test_dep
+ test_sources += 'test_compressdev.c'
+ test_deps += 'compressdev'
+ fast_non_parallel_test_names += 'compressdev_autotest'
+ endif
endif
-endif
-foreach d:test_deps
- def_lib = get_option('default_library')
- test_dep_objs += get_variable(def_lib + '_rte_' + d)
-endforeach
-test_dep_objs += cc.find_library('execinfo', required: false)
+ foreach d:test_deps
+ def_lib = get_option('default_library')
+ test_dep_objs += get_variable(def_lib + '_rte_' + d)
+ endforeach
+ test_dep_objs += cc.find_library('execinfo', required: false)
-link_libs = []
-if get_option('default_library') == 'static'
- link_libs = dpdk_drivers
-endif
+ link_libs = []
+ if get_option('default_library') == 'static'
+ link_libs = dpdk_drivers
+ endif
-if get_option('tests')
dpdk_test = executable('dpdk-test',
test_sources,
link_whole: link_libs,