diff options
Diffstat (limited to 'lib/pluginloader/meson.build')
-rw-r--r-- | lib/pluginloader/meson.build | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/lib/pluginloader/meson.build b/lib/pluginloader/meson.build index acdd47e..5e7c39c 100644 --- a/lib/pluginloader/meson.build +++ b/lib/pluginloader/meson.build @@ -22,25 +22,22 @@ publicKey_h = custom_target('publicKey_h', '--output=@OUTPUT@', '--array-name=publicKey_pem'] ) -pluginloader_moc = mod_qt5.preprocess( - moc_headers: ['pluginloader.h'], - dependencies: dep_qt5 -) - dep_pluginloader = declare_dependency( include_directories: include_directories('.'), link_with: static_library('plugin', - ['pluginloader.cpp', pluginloader_moc, publicKey_h], + ['pluginloader.cpp', publicKey_h], include_directories: include_directories('.'), dependencies: [dep_qt5, dependency('openssl', required: true)]) ) # generate a test file that would be signed -signedfile_dat = custom_target('signedfile.dat', - input: 'write-random.py', - output: 'signedfile.dat', - command: [ python3, '@INPUT@', '--output=@OUTPUT@' ] -) +unsignedfile_dat = custom_target('unsignedfile.dat', input: 'write-random.py', output: 'unsignedfile.dat', command: [ python3, '@INPUT@', '--output=@OUTPUT@' ]) + +signedfile_dat = custom_target('signedfile.dat', input: 'write-random.py', output: 'signedfile.dat', command: [ python3, '@INPUT@', '--output=@OUTPUT@' ]) + +badsignedfile_dat = custom_target('badsignedfile.dat', input: 'write-random.py', output: 'badsignedfile.dat', command: [ python3, '@INPUT@', '--output=@OUTPUT@' ]) +badsignedfile_sig = custom_target('badsignedfile.dat.sig', input: 'write-random.py', output: 'badsignedfile.dat.sig', command: [ python3, '@INPUT@', '--output=@OUTPUT@' ]) + # sign test file signedfile_sig = custom_target('signedfile.dat.sig', input: signedfile_dat, @@ -48,15 +45,24 @@ signedfile_sig = custom_target('signedfile.dat.sig', command: [ openssl, 'dgst', '-sha256', '-sign', private_pem, '-out', '@OUTPUT@', '@INPUT@' ] ) -signedfile_idep = declare_dependency(sources: [ signedfile_dat, signedfile_sig ]) +signedfile_idep = declare_dependency(sources: [ unsignedfile_dat, signedfile_dat, signedfile_sig, badsignedfile_dat, badsignedfile_sig ]) pluginloader_sigmatch = executable('pluginloader-sigmatch', sources: [ 'test/pluginloader-sigmatch.cpp' ], - dependencies: [ dep_qt5, dep_gtest, dep_pluginloader, signedfile_idep ] + dependencies: [ dep_qt5, dep_catch, dep_pluginloader, signedfile_idep ] ) -test('pluginloader: signature matching', pluginloader_sigmatch, - env: environment({ 'SIGNEDFILE' : 'signedfile.dat' }), - workdir: meson.current_build_dir() +test('signature matching', pluginloader_sigmatch, suite: 'pluginloader', + env: { + 'SIGNEDFILE' : signedfile_dat.full_path(), + 'UNSIGNEDFILE': unsignedfile_dat.full_path(), + 'BADSIGNEDFILE': badsignedfile_dat.full_path() + }, ) +poi_plugin_loader = executable('poi-plugin-load', dependencies: [ dep_qt5, dep_spdlog, dep_pluginloader ], sources: 'test/pluginloader-load.cpp') + +# make sure this fails when no plugin or an invalid file is passed +test('load', poi_plugin_loader, suite: 'pluginloader', should_fail: true) +test('load', poi_plugin_loader, suite: 'pluginloader', args: files('meson.build'), should_fail: true) + |