aboutsummaryrefslogtreecommitdiff
path: root/lib/pluginloader/meson.build
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-26 23:14:53 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-27 15:58:31 +0200
commit0bf5450365934c39ed0bb480712adaab2fa54386 (patch)
tree15b90e626ca7f29c9fa219addf17e9cf618b6496 /lib/pluginloader/meson.build
parentMove compiler flags to meson.build from pkgbuild (diff)
downloadsmolbote-0bf5450365934c39ed0bb480712adaab2fa54386.tar.xz
pluginloader: add test for PluginLoader::verify
Diffstat (limited to 'lib/pluginloader/meson.build')
-rw-r--r--lib/pluginloader/meson.build27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/pluginloader/meson.build b/lib/pluginloader/meson.build
index cbca725..534f385 100644
--- a/lib/pluginloader/meson.build
+++ b/lib/pluginloader/meson.build
@@ -25,3 +25,30 @@ dep_pluginloader = declare_dependency(
dependencies: [dep_qt5, dependency('openssl', required: true)])
)
+openssl = find_program('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@' ]
+)
+# sign test file
+signedfile_sig = custom_target('signedfile.dat.sig',
+ input: signedfile_dat,
+ output: 'signedfile.dat.sig',
+ command: [ openssl, 'dgst', '-sha256', '-sign', private_pem, '-out', '@OUTPUT@', '@INPUT@' ]
+)
+
+signedfile_idep = declare_dependency(sources: [ signedfile_dat, signedfile_sig ])
+
+pluginloader_sigmatch = executable('pluginloader-sigmatch',
+ sources: [ 'test/pluginloader-sigmatch.cpp' ],
+ dependencies: [ dep_qt5, dep_gtest, dep_pluginloader, signedfile_idep ]
+)
+
+test('pluginloader: signature matching', pluginloader_sigmatch,
+ env: environment({ 'SIGNEDFILE' : 'signedfile.dat' }),
+ workdir: meson.current_build_dir()
+)
+