Add sharness: Shell library to test your tools like Git does

Sharness is a portable shell library to write, run, and analyze
automated tests for Unix programs. Since all tests output the Test
Anything Protocol, they can be run with any TAP harness. Each test is
written as a shell script.
This commit is contained in:
schmonz 2024-02-19 20:50:43 +00:00
parent f90f76e4b5
commit 5d83216fc3
5 changed files with 90 additions and 0 deletions

4
devel/sharness/DESCR Normal file
View File

@ -0,0 +1,4 @@
Sharness is a portable shell library to write, run, and analyze
automated tests for Unix programs. Since all tests output the Test
Anything Protocol, they can be run with any TAP harness. Each test is
written as a shell script.

26
devel/sharness/Makefile Normal file
View File

@ -0,0 +1,26 @@
# $NetBSD: Makefile,v 1.1 2024/02/19 20:50:43 schmonz Exp $
DISTNAME= sharness-v1.2.0
PKGNAME= ${DISTNAME:S/-v/-/}
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=felipec/}
GITHUB_TAG= v${PKGVERSION_NOREV}
MAINTAINER= schmonz@NetBSD.org
HOMEPAGE= https://felipec.github.io/sharness/
COMMENT= Shell library to test your tools like Git does
LICENSE= gnu-gpl-v2
USE_LANGUAGES= # none
USE_TOOLS+= gmake perl
NO_BUILD= yes
REPLACE_SH= sharness.sh tools/aggregate-results.sh
REPLACE_SH+= test/sharness.sh test/aggregate-results.sh
REPLACE_SH+= lib-sharness/functions.sh
TEST_DIRS= test
TEST_TARGET= all
TEST_DEPENDS+= p5-IO-tty-[0-9]*:../../devel/p5-IO-Tty
.include "../../mk/bsd.pkg.mk"

11
devel/sharness/PLIST Normal file
View File

@ -0,0 +1,11 @@
@comment $NetBSD: PLIST,v 1.1 2024/02/19 20:50:43 schmonz Exp $
share/doc/sharness/API.md
share/doc/sharness/CHANGELOG.md
share/doc/sharness/COPYING
share/doc/sharness/README.git
share/doc/sharness/README.md
share/doc/sharness/example/Makefile
share/doc/sharness/example/simple.t
share/sharness/lib-sharness/functions.sh
share/sharness/sharness.sh
share/sharness/tools/aggregate-results.sh

6
devel/sharness/distinfo Normal file
View File

@ -0,0 +1,6 @@
$NetBSD: distinfo,v 1.1 2024/02/19 20:50:43 schmonz Exp $
BLAKE2s (sharness-v1.2.0.tar.gz) = d0cbec657c160e279125b3f189f3801a5c93e407bd83ac3c2e14edee34a3422d
SHA512 (sharness-v1.2.0.tar.gz) = b6b346b14bdbd387bc111b8caa83b03b77195f43e0f9c774f489de431d41a0cf258edf2bec136d78ddd49236ce1e71e4cddb33d163148d05600501c414e48fca
Size (sharness-v1.2.0.tar.gz) = 42532 bytes
SHA1 (patch-Makefile) = a17c1e8d71f5c8084a7cd62e4a352360c4848a55

View File

@ -0,0 +1,43 @@
$NetBSD: patch-Makefile,v 1.1 2024/02/19 20:50:43 schmonz Exp $
Use pkgsrc paths.
--- Makefile.orig 2024-02-19 20:42:16.814963277 +0000
+++ Makefile
@@ -1,6 +1,6 @@
-prefix = $(HOME)
+prefix = $(PREFIX)
-INSTALL_DIR = $(prefix)/share/sharness
+SHARNESS_DIR = $(prefix)/share/sharness
DOC_DIR = $(prefix)/share/doc/sharness
EXAMPLE_DIR = $(DOC_DIR)/example
VIM_DIR = $(prefix)/.vim/pack/filetypes/start/sharness
@@ -19,13 +19,13 @@ scripts = sharness.sh lib-sharness/funct
all:
install: all
- $(INSTALL) -d -m 755 $(D)$(INSTALL_DIR) $(D)$(INSTALL_DIR)/lib-sharness $(D)$(INSTALL_DIR)/tools $(D)$(DOC_DIR) $(D)$(EXAMPLE_DIR)
- $(INSTALL) -m 644 sharness.sh $(D)$(INSTALL_DIR)
- $(INSTALL) -m 644 lib-sharness/functions.sh $(D)$(INSTALL_DIR)/lib-sharness
- $(INSTALL) -m 644 tools/aggregate-results.sh $(D)$(INSTALL_DIR)/tools
+ $(INSTALL) -d -m 755 $(D)$(SHARNESS_DIR) $(D)$(SHARNESS_DIR)/lib-sharness $(D)$(SHARNESS_DIR)/tools $(D)$(DOC_DIR) $(D)$(EXAMPLE_DIR)
+ $(INSTALL) -m 644 sharness.sh $(D)$(SHARNESS_DIR)
+ $(INSTALL) -m 644 lib-sharness/functions.sh $(D)$(SHARNESS_DIR)/lib-sharness
+ $(INSTALL) -m 644 tools/aggregate-results.sh $(D)$(SHARNESS_DIR)/tools
$(INSTALL) -m 644 $(DOC_FILES) $(D)$(DOC_DIR)
$(INSTALL) -m 644 example/Makefile $(D)$(EXAMPLE_DIR)
- $(SED) -e "s!\. \./sharness.sh!\. $(INSTALL_DIR)/sharness.sh!" example/simple.t > $(D)$(EXAMPLE_DIR)/simple.t
+ $(SED) -e "s!\. \./sharness.sh!\. $(SHARNESS_DIR)/sharness.sh!" example/simple.t > $(D)$(EXAMPLE_DIR)/simple.t
chmod 755 $(D)$(EXAMPLE_DIR)/simple.t
install-test:
@@ -36,7 +36,7 @@ install-vim:
$(CP) -r vim/* $(D)$(VIM_DIR)
uninstall:
- $(RM) -r $(INSTALL_DIR) $(DOC_DIR) $(EXAMPLE_DIR)
+ $(RM) -r $(SHARNESS_DIR) $(DOC_DIR) $(EXAMPLE_DIR)
doc: all
{ printf "# Sharness API\n\n"; \