support/testing: add zbar runtime test
Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit 85f0941532
)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
fe189deeed
commit
1e70541c85
@ -1872,6 +1872,7 @@ F: support/testing/tests/package/test_weston/
|
||||
F: support/testing/tests/package/test_xz.py
|
||||
F: support/testing/tests/package/test_z3.py
|
||||
F: support/testing/tests/package/test_z3/
|
||||
F: support/testing/tests/package/test_zbar.py
|
||||
F: support/testing/tests/package/test_zchunk.py
|
||||
F: support/testing/tests/package/test_zstd.py
|
||||
|
||||
|
37
support/testing/tests/package/test_zbar.py
Normal file
37
support/testing/tests/package/test_zbar.py
Normal file
@ -0,0 +1,37 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestZbar(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_PACKAGE_IMAGEMAGICK=y
|
||||
BR2_PACKAGE_LIBQRENCODE=y
|
||||
BR2_PACKAGE_LIBQRENCODE_TOOLS=y
|
||||
BR2_PACKAGE_ZBAR=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||
self.emulator.boot(arch="armv5",
|
||||
kernel="builtin",
|
||||
options=["-initrd", cpio_file])
|
||||
self.emulator.login()
|
||||
|
||||
txt_msg = "Hello Buildroot!"
|
||||
qr_img = "qr.png"
|
||||
|
||||
# We check the program can execute.
|
||||
self.assertRunOk("zbarimg --version")
|
||||
|
||||
# We generate a QR code image containing a message.
|
||||
self.assertRunOk(f"qrencode -o '{qr_img}' '{txt_msg}'")
|
||||
|
||||
# We decode the QR code image and check the extracted message
|
||||
# is the expected one.
|
||||
out, ret = self.emulator.run(f"zbarimg -q --raw {qr_img}")
|
||||
self.assertEqual(ret, 0)
|
||||
self.assertEqual(out[0], txt_msg)
|
Loading…
Reference in New Issue
Block a user