Skip to content
Snippets Groups Projects
Commit 1dd6fdb8 authored by Tomas Krizek's avatar Tomas Krizek
Browse files

Merge branch 'kres_gen_test-cross' into 'master'

daemon/lua/meson.build: disable kres_gen_test on cross

See merge request !1198
parents ef1407b6 be6f5981
No related branches found
No related tags found
1 merge request!1198daemon/lua/meson.build: disable kres_gen_test on cross
Pipeline #86532 failed
......@@ -56,32 +56,33 @@ run_target( # run manually to re-generate kres-gen.lua
# A simple config test: check that sizes of some structures match
# in C and pre-generated lua bindings.
# The point is that regeneration is quite expensive in time and dependencies,
# but this basic sanity check could be ran always.
if get_option('kres_gen_test')
# but this basic sanity check could be ran always, except for cross compilation,
# as we *run* luajit to find out the real sizes.
if get_option('kres_gen_test') and not meson.is_cross_build()
types_to_check = {
'time_t' : '#include <sys/time.h>',
'struct timeval' : '#include <sys/time.h>',
'zs_scanner_t' : '#include <libzscanner/scanner.h>',
'knot_pkt_t' : '#include <libknot/packet/pkt.h>',
'time_t' : '#include <sys/time.h>',
'struct timeval' : '#include <sys/time.h>',
'zs_scanner_t' : '#include <libzscanner/scanner.h>',
'knot_pkt_t' : '#include <libknot/packet/pkt.h>',
}
# Construct the lua tester as a meson string.
kres_gen_test_luastr = '''
dofile('@0@')
local ffi = require('ffi')
dofile('@0@')
local ffi = require('ffi')
'''.format(meson.current_source_dir() / kres_gen_fname)
foreach tname, tinclude: types_to_check
kres_gen_test_luastr += '''
assert(ffi.sizeof(ffi.typeof('@0@')) == @1@,
'Lua binding for C type ' .. '@0@' .. ' has incorrect size: '
.. ffi.sizeof(ffi.typeof('@0@'))
)
'''.format(tname, meson.get_compiler('c').sizeof(tname, prefix : tinclude))
kres_gen_test_luastr += '''
assert(ffi.sizeof(ffi.typeof('@0@')) == @1@,
'Lua binding for C type ' .. '@0@' .. ' has incorrect size: '
.. ffi.sizeof(ffi.typeof('@0@'))
)
'''.format(tname, meson.get_compiler('c').sizeof(tname, prefix : tinclude))
endforeach
# Now feed it directly into luajit.
kres_gen_test = run_command(find_program('luajit'), '-e', kres_gen_test_luastr)
if kres_gen_test.returncode() != 0
error('if you use released Knot* versions, please contact us: https://www.knot-resolver.cz/contact/\n'
+ kres_gen_test.stderr().strip())
error('if you use released Knot* versions, please contact us: https://www.knot-resolver.cz/contact/\n'
+ kres_gen_test.stderr().strip())
endif
endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment