Skip to content

Commit

Permalink
Make tests optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hexagonhill committed Sep 18, 2024
1 parent adb1de7 commit d1625d8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 51 deletions.
105 changes: 54 additions & 51 deletions lang/c++/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -88,57 +88,60 @@ precompile_exe = executable('precompile', 'test/precompile.cc',
dependencies: [boost_dep, snappy_dep, fmt_dep]
)

jsonschema_list = [
['empty_record','empty'],
['bigrecord','testgen'],
['bigrecord_r','testgen_r'],
['bigrecord2','testgen2'],
['tweet','testgen3'],
['union_array_union','uau'],
['union_map_union','umu'],
['union_conflict','uc'],
['union_empty_record','uer'],
['recursive','rec'],
['reuse','ru'],
['circulardep','cd'],
['tree1','tr1'],
['tree2','tr2'],
['crossref','cr'],
['primitivetypes','pt'],
['cpp_reserved_words','cppres'],
['cpp_reserved_words_union_typedef','cppres_union'],
['big_union','big_union'],
['union_redundant_types','redundant_types']
]

schema_headers = []
foreach jsonschema : jsonschema_list
schema_headers += custom_target(
jsonschema[0],
input : 'jsonschemas/'+jsonschema[0],
output : jsonschema[0]+'.hh',
command : [avrogencpp_exe,'-p','-','-o','@OUTPUT@','-i', '@INPUT0@', '-n', jsonschema[1]]
)
endforeach

# Add tests
test_list = [
'buffertest', 'unittest', 'SchemaTests', 'LargeSchemaTests',
'CodecTests', 'StreamTests', 'SpecificTests', 'DataFileTests',
'JsonTests', 'AvrogencppTests', 'CompilerTests', 'AvrogencppTestReservedWords',
'CommonsSchemasTests'
]

foreach test_name : test_list
test_exe = executable(test_name,
sources: schema_headers + ['test/@[email protected]'.format(test_name)],
include_directories: include_directories('include/avro'),
link_with: libavro,
dependencies: [boost_dep, snappy_dep,fmt_dep]
if get_option('tests')

jsonschema_list = [
['empty_record','empty'],
['bigrecord','testgen'],
['bigrecord_r','testgen_r'],
['bigrecord2','testgen2'],
['tweet','testgen3'],
['union_array_union','uau'],
['union_map_union','umu'],
['union_conflict','uc'],
['union_empty_record','uer'],
['recursive','rec'],
['reuse','ru'],
['circulardep','cd'],
['tree1','tr1'],
['tree2','tr2'],
['crossref','cr'],
['primitivetypes','pt'],
['cpp_reserved_words','cppres'],
['cpp_reserved_words_union_typedef','cppres_union'],
['big_union','big_union'],
['union_redundant_types','redundant_types']
]

schema_headers = []
foreach jsonschema : jsonschema_list
schema_headers += custom_target(
jsonschema[0],
input : 'jsonschemas/'+jsonschema[0],
output : jsonschema[0]+'.hh',
command : [avrogencpp_exe,'-p','-','-o','@OUTPUT@','-i', '@INPUT0@', '-n', jsonschema[1]]
)
test(test_name, test_exe)
endforeach
endforeach

# Add tests
test_list = [
'buffertest', 'unittest', 'SchemaTests', 'LargeSchemaTests',
'CodecTests', 'StreamTests', 'SpecificTests', 'DataFileTests',
'JsonTests', 'AvrogencppTests', 'CompilerTests', 'AvrogencppTestReservedWords',
'CommonsSchemasTests'
]

foreach test_name : test_list
test_exe = executable(test_name,
sources: schema_headers + ['test/@[email protected]'.format(test_name)],
include_directories: include_directories('include/avro'),
link_with: libavro,
dependencies: [boost_dep, snappy_dep,fmt_dep]
)
test(test_name, test_exe)
endforeach

endif

# Installation
#install_headers('include/avro', subdir: 'avro')

avro_dep = declare_dependency(include_directories: include_directories('include'), link_with: libavro)
1 change: 1 addition & 0 deletions lang/c++/meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('tests', type : 'boolean', value : false)

0 comments on commit d1625d8

Please sign in to comment.