meson build system has the functionality of setting an executable wrapper to run cross-compiled binaries. The setting is called exe_wrapper and can be defined in the meson.cross file. With a valid exe_wrapper meson build system can test if the built binary is sane.
Another advantage of setting exe_wrapper setting is that we can run the tests defined in the meson build system. This way if this class is inherited not only are the default targets built, their tests will also run and have an opportunity to fail the the build at the recipe level if necessary. The user of this class should not inherit meson directly but leave it to this class. This class may later be merged into meson.bbclass itself. Signed-off-by: Paulo Neves <ptsne...@gmail.com> --- meta/classes/meson-with-tests.bbclass | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 meta/classes/meson-with-tests.bbclass diff --git a/meta/classes/meson-with-tests.bbclass b/meta/classes/meson-with-tests.bbclass new file mode 100644 index 0000000000..ddaeebc726 --- /dev/null +++ b/meta/classes/meson-with-tests.bbclass @@ -0,0 +1,26 @@ +inherit meson + +DEPENDS_append += "qemu-native" + +do_write_config_append() { + #You need to pass qemu with the sysroot path + #arguments, but internally meson uses Popen + #so we could try lists of arguments + #While passing a list directly in the exe_wrapper + #parameter passes the sanity test, it later on + #fails in the actual test run with: + #TypeError: expect bytes or str, not list + #So we create an in here wrapper. + cat > ${WORKDIR}/meson_exe_wrapper.sh << EOF +#!/bin/sh +qemu-${TARGET_ARCH} -L ${RECIPE_SYSROOT} \$@ +EOF + + chmod u+x ${WORKDIR}/meson_exe_wrapper.sh + + sed "/binaries/a\exe_wrapper = '${WORKDIR}/meson_exe_wrapper.sh'" -i ${WORKDIR}/meson.cross +} + +do_compile_append() { + ninja test +} -- 2.14.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core