* [PR PATCH] common/tests: create
@ 2021-03-13 21:23 Chocimier
2022-05-08 2:12 ` github-actions
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Chocimier @ 2021-03-13 21:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
There is a new pull request by Chocimier against master on the void-packages repository
https://github.com/Chocimier/void-packages-org tests
https://github.com/void-linux/void-packages/pull/29448
common/tests: create
A patch file from https://github.com/void-linux/void-packages/pull/29448.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-tests-29448.patch --]
[-- Type: text/x-diff, Size: 7344 bytes --]
From 70c106127b8debfbf2a65e1b7b371af205b7fd75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Sat, 13 Mar 2021 22:16:17 +0100
Subject: [PATCH] common/tests: create
---
common/tests/00-target-pkg.bats | 7 +++
common/tests/10-jobs_number.bats | 45 +++++++++++++++++
common/tests/10-options-comptype.bats | 71 +++++++++++++++++++++++++++
common/tests/all.sh | 11 +++++
common/tests/lib/testfuncs.bash | 24 +++++++++
common/tests/templates/jobcounter | 26 ++++++++++
common/tests/templates/pkg | 9 ++++
7 files changed, 193 insertions(+)
create mode 100644 common/tests/00-target-pkg.bats
create mode 100644 common/tests/10-jobs_number.bats
create mode 100644 common/tests/10-options-comptype.bats
create mode 100755 common/tests/all.sh
create mode 100644 common/tests/lib/testfuncs.bash
create mode 100644 common/tests/templates/jobcounter
create mode 100644 common/tests/templates/pkg
diff --git a/common/tests/00-target-pkg.bats b/common/tests/00-target-pkg.bats
new file mode 100644
index 000000000000..02428e41d0c1
--- /dev/null
+++ b/common/tests/00-target-pkg.bats
@@ -0,0 +1,7 @@
+@test "Build simple pkg" {
+ load lib/testfuncs
+ prepare_pkg_test
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ cleanup_pkg_test
+}
diff --git a/common/tests/10-jobs_number.bats b/common/tests/10-jobs_number.bats
new file mode 100644
index 000000000000..d92a124d0a10
--- /dev/null
+++ b/common/tests/10-jobs_number.bats
@@ -0,0 +1,45 @@
+@test "by default, one job" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 1 = "$jobs"
+ cleanup_pkg_test
+}
+
+@test "-j 11" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" -j 11 pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 11 = "$jobs"
+ cleanup_pkg_test
+}
+
+@test "XBPS_MAKEJOBS=6" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ echo XBPS_MAKEJOBS=6 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 6 = "$jobs"
+ cleanup_pkg_test
+}
+
+@test "-j 2 XBPS_MAKEJOBS=5" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ echo XBPS_MAKEJOBS=5 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" -j 2 pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 2 = "$jobs"
+ cleanup_pkg_test
+}
diff --git a/common/tests/10-options-comptype.bats b/common/tests/10-options-comptype.bats
new file mode 100644
index 000000000000..f403bbd5d2c8
--- /dev/null
+++ b/common/tests/10-options-comptype.bats
@@ -0,0 +1,71 @@
+@test "XBPS_PKG_COMPTYPE=none" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=none > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-tar = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=gzip" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=gzip > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/gzip = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=bzip2" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=bzip2 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-bzip2 = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=xz" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=xz > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-xz = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=lz4" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=lz4 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-lz4 = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=zstd" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=zstd > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/zstd = "$mime"
+ cleanup_pkg_test
+}
diff --git a/common/tests/all.sh b/common/tests/all.sh
new file mode 100755
index 000000000000..fafdde8171a0
--- /dev/null
+++ b/common/tests/all.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+if ! command -v bats > /dev/null; then
+ echo Missing 'bats' command
+ exit 1
+fi
+
+for i in "$(dirname "$0")"/*.bats; do
+ echo $i
+ bats "$i"
+done
diff --git a/common/tests/lib/testfuncs.bash b/common/tests/lib/testfuncs.bash
new file mode 100644
index 000000000000..e7ba6a541599
--- /dev/null
+++ b/common/tests/lib/testfuncs.bash
@@ -0,0 +1,24 @@
+distdir="${BATS_TEST_DIRNAME}/../.."
+template=
+tmprepodir=
+tmprepo=
+tmpconf=
+
+prepare_pkg_test() {
+ template=${1:-pkg}
+ cd "${distdir}"
+ tmprepodir="$(mktemp -d -p ${PWD}/hostdir/binpkgs)"
+ tmprepo="$(basename ${tmprepodir})"
+ tmpconf="etc/conf.${tmprepo}"
+ pkgfile="${tmprepodir}/xbps-src-test-${template}-1_1.$(xbps-uhelper arch).xbps"
+ rm -fr srcpkgs/xbps-src-test-${template}
+ mkdir srcpkgs/xbps-src-test-${template}
+ cp "${BATS_TEST_DIRNAME}/templates/${template}" srcpkgs/xbps-src-test-${template}/template
+ echo XBPS_SUCMD=true > "${tmpconf}"
+}
+
+cleanup_pkg_test() {
+ rm -r srcpkgs/xbps-src-test-${template}
+ rm -r "${tmprepodir}"
+ rm "etc/conf.${tmprepo}"
+}
diff --git a/common/tests/templates/jobcounter b/common/tests/templates/jobcounter
new file mode 100644
index 000000000000..77a56bdd751e
--- /dev/null
+++ b/common/tests/templates/jobcounter
@@ -0,0 +1,26 @@
+# Template file for 'xbps-src-test-jobcounter'
+pkgname=xbps-src-test-jobcounter
+version=1
+revision=1
+build_style=gnu-makefile
+make_cmd="./make"
+make_use_env=yes
+short_desc="Dummy package"
+license="BSD-2-Clause"
+maintainer="Orphaned <orphan@voidlinux.org>"
+homepage="http://voidlinux.org"
+
+pre_build() {
+ mkdir -p ${DESTDIR}/etc
+ cat > ./make << EOF
+ #!/usr/bin/env bash
+ echo x "\$@"
+ while getopts "j:" opt; do
+ case "\$opt" in
+ j) echo \$OPTARG > ${DESTDIR}/etc/jobs; exit 0
+ esac
+ done
+EOF
+ cat make
+ chmod +x ./make
+}
diff --git a/common/tests/templates/pkg b/common/tests/templates/pkg
new file mode 100644
index 000000000000..68333f6fa80e
--- /dev/null
+++ b/common/tests/templates/pkg
@@ -0,0 +1,9 @@
+# Template file for 'xbps-src-test-pkg'
+pkgname=xbps-src-test-pkg
+version=1
+revision=1
+build_style=meta
+short_desc="Dummy package"
+license="BSD-2-Clause"
+maintainer="Orphaned <orphan@voidlinux.org>"
+homepage="http://voidlinux.org"
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: common/tests: create
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
@ 2022-05-08 2:12 ` github-actions
2022-08-09 2:13 ` github-actions
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: github-actions @ 2022-05-08 2:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
New comment by github-actions[bot] on void-packages repository
https://github.com/void-linux/void-packages/pull/29448#issuecomment-1120334402
Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: common/tests: create
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
2022-05-08 2:12 ` github-actions
@ 2022-08-09 2:13 ` github-actions
2022-08-24 2:14 ` [PR PATCH] [Closed]: " github-actions
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: github-actions @ 2022-08-09 2:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
New comment by github-actions[bot] on void-packages repository
https://github.com/void-linux/void-packages/pull/29448#issuecomment-1208832528
Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PR PATCH] [Closed]: common/tests: create
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
2022-05-08 2:12 ` github-actions
2022-08-09 2:13 ` github-actions
@ 2022-08-24 2:14 ` github-actions
2023-01-30 18:44 ` [PR PATCH] [Updated] " Chocimier
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: github-actions @ 2022-08-24 2:14 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
There's a closed pull request on the void-packages repository
common/tests: create
https://github.com/void-linux/void-packages/pull/29448
Description:
None
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PR PATCH] [Updated] common/tests: create
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
` (2 preceding siblings ...)
2022-08-24 2:14 ` [PR PATCH] [Closed]: " github-actions
@ 2023-01-30 18:44 ` Chocimier
2023-05-02 1:52 ` github-actions
2023-05-16 1:54 ` [PR PATCH] [Closed]: " github-actions
5 siblings, 0 replies; 7+ messages in thread
From: Chocimier @ 2023-01-30 18:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Chocimier/void-packages-org tests
https://github.com/void-linux/void-packages/pull/29448
common/tests: create
None
A patch file from https://github.com/void-linux/void-packages/pull/29448.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-tests-29448.patch --]
[-- Type: text/x-diff, Size: 12047 bytes --]
From 14c9ce2055f8a0865c084177e167115a2c00e02a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Sat, 13 Mar 2021 22:16:17 +0100
Subject: [PATCH 1/2] common/tests: create
---
common/tests/00-target-pkg.bats | 7 +++
common/tests/10-jobs_number.bats | 45 +++++++++++++++++
common/tests/10-options-comptype.bats | 71 +++++++++++++++++++++++++++
common/tests/all.sh | 11 +++++
common/tests/lib/testfuncs.bash | 24 +++++++++
common/tests/templates/jobcounter | 26 ++++++++++
common/tests/templates/pkg | 9 ++++
7 files changed, 193 insertions(+)
create mode 100644 common/tests/00-target-pkg.bats
create mode 100644 common/tests/10-jobs_number.bats
create mode 100644 common/tests/10-options-comptype.bats
create mode 100755 common/tests/all.sh
create mode 100644 common/tests/lib/testfuncs.bash
create mode 100644 common/tests/templates/jobcounter
create mode 100644 common/tests/templates/pkg
diff --git a/common/tests/00-target-pkg.bats b/common/tests/00-target-pkg.bats
new file mode 100644
index 000000000000..02428e41d0c1
--- /dev/null
+++ b/common/tests/00-target-pkg.bats
@@ -0,0 +1,7 @@
+@test "Build simple pkg" {
+ load lib/testfuncs
+ prepare_pkg_test
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ cleanup_pkg_test
+}
diff --git a/common/tests/10-jobs_number.bats b/common/tests/10-jobs_number.bats
new file mode 100644
index 000000000000..d92a124d0a10
--- /dev/null
+++ b/common/tests/10-jobs_number.bats
@@ -0,0 +1,45 @@
+@test "by default, one job" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 1 = "$jobs"
+ cleanup_pkg_test
+}
+
+@test "-j 11" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" -j 11 pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 11 = "$jobs"
+ cleanup_pkg_test
+}
+
+@test "XBPS_MAKEJOBS=6" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ echo XBPS_MAKEJOBS=6 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 6 = "$jobs"
+ cleanup_pkg_test
+}
+
+@test "-j 2 XBPS_MAKEJOBS=5" {
+ load lib/testfuncs
+ prepare_pkg_test jobcounter
+ echo XBPS_MAKEJOBS=5 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" -j 2 pkg xbps-src-test-jobcounter
+ test -f "${pkgfile}"
+ jobs=$(tar xOf ${pkgfile} ./etc/jobs)
+ echo "$jobs"
+ test 2 = "$jobs"
+ cleanup_pkg_test
+}
diff --git a/common/tests/10-options-comptype.bats b/common/tests/10-options-comptype.bats
new file mode 100644
index 000000000000..f403bbd5d2c8
--- /dev/null
+++ b/common/tests/10-options-comptype.bats
@@ -0,0 +1,71 @@
+@test "XBPS_PKG_COMPTYPE=none" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=none > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-tar = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=gzip" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=gzip > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/gzip = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=bzip2" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=bzip2 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-bzip2 = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=xz" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=xz > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-xz = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=lz4" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=lz4 > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/x-lz4 = "$mime"
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=zstd" {
+ load lib/testfuncs
+ prepare_pkg_test
+ echo XBPS_PKG_COMPTYPE=zstd > "${tmpconf}"
+ ./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
+ test -f "${pkgfile}"
+ mime=$(file -b --mime-type "${pkgfile}")
+ echo "$mime"
+ test application/zstd = "$mime"
+ cleanup_pkg_test
+}
diff --git a/common/tests/all.sh b/common/tests/all.sh
new file mode 100755
index 000000000000..fafdde8171a0
--- /dev/null
+++ b/common/tests/all.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+if ! command -v bats > /dev/null; then
+ echo Missing 'bats' command
+ exit 1
+fi
+
+for i in "$(dirname "$0")"/*.bats; do
+ echo $i
+ bats "$i"
+done
diff --git a/common/tests/lib/testfuncs.bash b/common/tests/lib/testfuncs.bash
new file mode 100644
index 000000000000..e7ba6a541599
--- /dev/null
+++ b/common/tests/lib/testfuncs.bash
@@ -0,0 +1,24 @@
+distdir="${BATS_TEST_DIRNAME}/../.."
+template=
+tmprepodir=
+tmprepo=
+tmpconf=
+
+prepare_pkg_test() {
+ template=${1:-pkg}
+ cd "${distdir}"
+ tmprepodir="$(mktemp -d -p ${PWD}/hostdir/binpkgs)"
+ tmprepo="$(basename ${tmprepodir})"
+ tmpconf="etc/conf.${tmprepo}"
+ pkgfile="${tmprepodir}/xbps-src-test-${template}-1_1.$(xbps-uhelper arch).xbps"
+ rm -fr srcpkgs/xbps-src-test-${template}
+ mkdir srcpkgs/xbps-src-test-${template}
+ cp "${BATS_TEST_DIRNAME}/templates/${template}" srcpkgs/xbps-src-test-${template}/template
+ echo XBPS_SUCMD=true > "${tmpconf}"
+}
+
+cleanup_pkg_test() {
+ rm -r srcpkgs/xbps-src-test-${template}
+ rm -r "${tmprepodir}"
+ rm "etc/conf.${tmprepo}"
+}
diff --git a/common/tests/templates/jobcounter b/common/tests/templates/jobcounter
new file mode 100644
index 000000000000..77a56bdd751e
--- /dev/null
+++ b/common/tests/templates/jobcounter
@@ -0,0 +1,26 @@
+# Template file for 'xbps-src-test-jobcounter'
+pkgname=xbps-src-test-jobcounter
+version=1
+revision=1
+build_style=gnu-makefile
+make_cmd="./make"
+make_use_env=yes
+short_desc="Dummy package"
+license="BSD-2-Clause"
+maintainer="Orphaned <orphan@voidlinux.org>"
+homepage="http://voidlinux.org"
+
+pre_build() {
+ mkdir -p ${DESTDIR}/etc
+ cat > ./make << EOF
+ #!/usr/bin/env bash
+ echo x "\$@"
+ while getopts "j:" opt; do
+ case "\$opt" in
+ j) echo \$OPTARG > ${DESTDIR}/etc/jobs; exit 0
+ esac
+ done
+EOF
+ cat make
+ chmod +x ./make
+}
diff --git a/common/tests/templates/pkg b/common/tests/templates/pkg
new file mode 100644
index 000000000000..68333f6fa80e
--- /dev/null
+++ b/common/tests/templates/pkg
@@ -0,0 +1,9 @@
+# Template file for 'xbps-src-test-pkg'
+pkgname=xbps-src-test-pkg
+version=1
+revision=1
+build_style=meta
+short_desc="Dummy package"
+license="BSD-2-Clause"
+maintainer="Orphaned <orphan@voidlinux.org>"
+homepage="http://voidlinux.org"
From 0994f81d5f20928c81e5224bc364b79f688be77c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Fri, 27 Jan 2023 22:18:15 +0100
Subject: [PATCH 2/2] common/tests: cleanup with teardown
---
common/tests/00-target-pkg.bats | 10 ++++++++--
common/tests/10-jobs_number.bats | 19 ++++++++-----------
common/tests/10-options-comptype.bats | 25 ++++++++-----------------
3 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/common/tests/00-target-pkg.bats b/common/tests/00-target-pkg.bats
index 02428e41d0c1..e6b8b843cecd 100644
--- a/common/tests/00-target-pkg.bats
+++ b/common/tests/00-target-pkg.bats
@@ -1,7 +1,13 @@
-@test "Build simple pkg" {
+setup() {
load lib/testfuncs
prepare_pkg_test
+}
+
+teardown() {
+ cleanup_pkg_test
+}
+
+@test "Build simple pkg" {
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
- cleanup_pkg_test
}
diff --git a/common/tests/10-jobs_number.bats b/common/tests/10-jobs_number.bats
index d92a124d0a10..2d961beb8771 100644
--- a/common/tests/10-jobs_number.bats
+++ b/common/tests/10-jobs_number.bats
@@ -1,45 +1,42 @@
-@test "by default, one job" {
+setup() {
load lib/testfuncs
prepare_pkg_test jobcounter
+}
+
+teardown() {
+ cleanup_pkg_test
+}
+
+@test "by default, one job" {
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-jobcounter
test -f "${pkgfile}"
jobs=$(tar xOf ${pkgfile} ./etc/jobs)
echo "$jobs"
test 1 = "$jobs"
- cleanup_pkg_test
}
@test "-j 11" {
- load lib/testfuncs
- prepare_pkg_test jobcounter
./xbps-src -c "${tmprepo}" -r "${tmprepo}" -j 11 pkg xbps-src-test-jobcounter
test -f "${pkgfile}"
jobs=$(tar xOf ${pkgfile} ./etc/jobs)
echo "$jobs"
test 11 = "$jobs"
- cleanup_pkg_test
}
@test "XBPS_MAKEJOBS=6" {
- load lib/testfuncs
- prepare_pkg_test jobcounter
echo XBPS_MAKEJOBS=6 > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-jobcounter
test -f "${pkgfile}"
jobs=$(tar xOf ${pkgfile} ./etc/jobs)
echo "$jobs"
test 6 = "$jobs"
- cleanup_pkg_test
}
@test "-j 2 XBPS_MAKEJOBS=5" {
- load lib/testfuncs
- prepare_pkg_test jobcounter
echo XBPS_MAKEJOBS=5 > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" -j 2 pkg xbps-src-test-jobcounter
test -f "${pkgfile}"
jobs=$(tar xOf ${pkgfile} ./etc/jobs)
echo "$jobs"
test 2 = "$jobs"
- cleanup_pkg_test
}
diff --git a/common/tests/10-options-comptype.bats b/common/tests/10-options-comptype.bats
index f403bbd5d2c8..c765f8a1686e 100644
--- a/common/tests/10-options-comptype.bats
+++ b/common/tests/10-options-comptype.bats
@@ -1,71 +1,62 @@
-@test "XBPS_PKG_COMPTYPE=none" {
+setup() {
load lib/testfuncs
prepare_pkg_test
+}
+
+teardown() {
+ cleanup_pkg_test
+}
+
+@test "XBPS_PKG_COMPTYPE=none" {
echo XBPS_PKG_COMPTYPE=none > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
mime=$(file -b --mime-type "${pkgfile}")
echo "$mime"
test application/x-tar = "$mime"
- cleanup_pkg_test
}
@test "XBPS_PKG_COMPTYPE=gzip" {
- load lib/testfuncs
- prepare_pkg_test
echo XBPS_PKG_COMPTYPE=gzip > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
mime=$(file -b --mime-type "${pkgfile}")
echo "$mime"
test application/gzip = "$mime"
- cleanup_pkg_test
}
@test "XBPS_PKG_COMPTYPE=bzip2" {
- load lib/testfuncs
- prepare_pkg_test
echo XBPS_PKG_COMPTYPE=bzip2 > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
mime=$(file -b --mime-type "${pkgfile}")
echo "$mime"
test application/x-bzip2 = "$mime"
- cleanup_pkg_test
}
@test "XBPS_PKG_COMPTYPE=xz" {
- load lib/testfuncs
- prepare_pkg_test
echo XBPS_PKG_COMPTYPE=xz > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
mime=$(file -b --mime-type "${pkgfile}")
echo "$mime"
test application/x-xz = "$mime"
- cleanup_pkg_test
}
@test "XBPS_PKG_COMPTYPE=lz4" {
- load lib/testfuncs
- prepare_pkg_test
echo XBPS_PKG_COMPTYPE=lz4 > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
mime=$(file -b --mime-type "${pkgfile}")
echo "$mime"
test application/x-lz4 = "$mime"
- cleanup_pkg_test
}
@test "XBPS_PKG_COMPTYPE=zstd" {
- load lib/testfuncs
- prepare_pkg_test
echo XBPS_PKG_COMPTYPE=zstd > "${tmpconf}"
./xbps-src -c "${tmprepo}" -r "${tmprepo}" pkg xbps-src-test-pkg
test -f "${pkgfile}"
mime=$(file -b --mime-type "${pkgfile}")
echo "$mime"
test application/zstd = "$mime"
- cleanup_pkg_test
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: common/tests: create
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
` (3 preceding siblings ...)
2023-01-30 18:44 ` [PR PATCH] [Updated] " Chocimier
@ 2023-05-02 1:52 ` github-actions
2023-05-16 1:54 ` [PR PATCH] [Closed]: " github-actions
5 siblings, 0 replies; 7+ messages in thread
From: github-actions @ 2023-05-02 1:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
New comment by github-actions[bot] on void-packages repository
https://github.com/void-linux/void-packages/pull/29448#issuecomment-1530759919
Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PR PATCH] [Closed]: common/tests: create
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
` (4 preceding siblings ...)
2023-05-02 1:52 ` github-actions
@ 2023-05-16 1:54 ` github-actions
5 siblings, 0 replies; 7+ messages in thread
From: github-actions @ 2023-05-16 1:54 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
There's a closed pull request on the void-packages repository
common/tests: create
https://github.com/void-linux/void-packages/pull/29448
Description:
None
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-05-16 1:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-13 21:23 [PR PATCH] common/tests: create Chocimier
2022-05-08 2:12 ` github-actions
2022-08-09 2:13 ` github-actions
2022-08-24 2:14 ` [PR PATCH] [Closed]: " github-actions
2023-01-30 18:44 ` [PR PATCH] [Updated] " Chocimier
2023-05-02 1:52 ` github-actions
2023-05-16 1:54 ` [PR PATCH] [Closed]: " github-actions
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).