package/bats-support: new package

This library provides support functions needed by the bats-assert and
bats-file libraries.

This library does not provide an installer. Manually install the files
under /usr/lib/bats/bats-support which is what the Arch Linux package
does[1]. This makes the library loadable using `bats_load_library`[2].

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/bats-support/-/blob/main/PKGBUILD?ref_type=heads
[2] https://bats-core.readthedocs.io/en/stable/writing-tests.html#bats-load-library-load-system-wide-libraries

There are going to be a few such helpers to be introduced later, so we
make them all appear as sub-options of the main package, bats-core.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
[yann.morin.1998@free.fr:
  - move as sub-option of bats-core
  - explain why in commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Brandon Maier 2024-05-03 01:59:57 +00:00 committed by Yann E. MORIN
parent 09bcfb5696
commit 38ba3d31a4
5 changed files with 37 additions and 0 deletions

View File

@ -540,6 +540,7 @@ F: package/ncdu/
N: Brandon Maier <brandon.maier@collins.com>
F: board/freescale/ls1046a-frwy/
F: configs/ls1046a-frwy_defconfig
F: package/bats-support/
F: package/python-pysensors/
F: package/qoriq-fm-ucode/
F: package/unifdef/

View File

@ -9,3 +9,9 @@ config BR2_PACKAGE_BATS_CORE
write behave as expected.
https://github.com/bats-core/bats-core
if BR2_PACKAGE_BATS_CORE
source "package/bats-support/Config.in"
endif

View File

@ -0,0 +1,7 @@
config BR2_PACKAGE_BATS_SUPPORT
bool "bats-support"
help
bats-support is a supporting library providing common
functions to test helper libraries written for Bats.
https://github.com/bats-core/bats-support

View File

@ -0,0 +1,5 @@
# Locally calculated
sha256 7815237aafeb42ddcc1b8c698fc5808026d33317d8701d5ec2396e9634e2918f bats-support-0.3.0.tar.gz
# License files
sha256 36ffd9dc085d529a7e60e1276d73ae5a030b020313e6c5408593a6ae2af39673 LICENSE

View File

@ -0,0 +1,18 @@
################################################################################
#
# bats-support
#
################################################################################
BATS_SUPPORT_VERSION = 0.3.0
BATS_SUPPORT_SITE = $(call github,bats-core,bats-support,v$(BATS_SUPPORT_VERSION))
BATS_SUPPORT_LICENSE = CC0-1.0
BATS_SUPPORT_LICENSE_FILES = LICENSE
define BATS_SUPPORT_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/lib/bats/bats-support/src
$(INSTALL) -m 0755 $(@D)/*.bash -t $(TARGET_DIR)/usr/lib/bats/bats-support
$(INSTALL) -m 0755 $(@D)/src/*.bash -t $(TARGET_DIR)/usr/lib/bats/bats-support/src
endef
$(eval $(generic-package))