summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-06-14 00:09:04 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-06-14 00:09:04 +0100
commit5e41a38157bb40e8513e8e34426e85faba672fe7 (patch)
tree38e9365afd56c161d0e970ddf5420b2585130587 /eclass/tests
parent0ebcd2cbf178600b5eb36b2f24cdbb3d2f4a9000 (diff)
gentoo auto-resync : 14:06:2024 - 00:09:04
Diffstat (limited to 'eclass/tests')
-rw-r--r--eclass/tests/Makefile10
-rwxr-xr-xeclass/tests/rebar_fix_include_path.sh8
-rwxr-xr-xeclass/tests/rebar_remove_deps.sh4
-rwxr-xr-xeclass/tests/rebar_set_vsn.sh4
-rwxr-xr-xeclass/tests/savedconfig.sh22
5 files changed, 30 insertions, 18 deletions
diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile
index ee4a454912c3..99e824dea86d 100644
--- a/eclass/tests/Makefile
+++ b/eclass/tests/Makefile
@@ -1,19 +1,21 @@
SH_FILES := $(wildcard *.sh)
-TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES))
+TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES))
TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES))
+# !!! _All_ recipe lines for each target will be provided to a single
+# !!! invocation of the shell.
+.ONESHELL:
+
# We cache a successful test result if the testfile itself did not
# change (%.sh) and the contents of the eclass/ directory did not
# change (.eclasssum).
.%.sh.ok: %.sh .eclasssum
- ./$<
- touch $@
+ ./$< && touch $@
.PHONY: test
test: $(TEST_OK_FILES)
.PHONY: force
-.ONESHELL:
.eclasssum: SHELL = /bin/bash
.eclasssum: force
set -euo pipefail
diff --git a/eclass/tests/rebar_fix_include_path.sh b/eclass/tests/rebar_fix_include_path.sh
index 339633e91e3a..46c5712104b1 100755
--- a/eclass/tests/rebar_fix_include_path.sh
+++ b/eclass/tests/rebar_fix_include_path.sh
@@ -1,16 +1,20 @@
#!/bin/bash
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh || exit
-EAPI=6
+EAPI=8
inherit rebar
EPREFIX="${tmpdir}/fakeroot"
S="${WORKDIR}/${P}"
+get_libdir() {
+ echo lib
+}
+
setup() {
mkdir -p "${S}" || die
diff --git a/eclass/tests/rebar_remove_deps.sh b/eclass/tests/rebar_remove_deps.sh
index b544a3078dbb..e2717b59eaf9 100755
--- a/eclass/tests/rebar_remove_deps.sh
+++ b/eclass/tests/rebar_remove_deps.sh
@@ -1,10 +1,10 @@
#!/bin/bash
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh || exit
-EAPI=6
+EAPI=8
inherit rebar
diff --git a/eclass/tests/rebar_set_vsn.sh b/eclass/tests/rebar_set_vsn.sh
index c828732b0079..6cc4600695a6 100755
--- a/eclass/tests/rebar_set_vsn.sh
+++ b/eclass/tests/rebar_set_vsn.sh
@@ -1,10 +1,10 @@
#!/bin/bash
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh || exit
-EAPI=6
+EAPI=8
inherit rebar
diff --git a/eclass/tests/savedconfig.sh b/eclass/tests/savedconfig.sh
index 16645fc05854..ad03ce2d2d94 100755
--- a/eclass/tests/savedconfig.sh
+++ b/eclass/tests/savedconfig.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -18,7 +18,13 @@ quiet() {
sc() { EBUILD_PHASE=install quiet save_config "$@" ; }
rc() { EBUILD_PHASE=prepare quiet restore_config "$@" ; }
-cleanup() { rm -rf "${ED}"/* "${T}"/* "${WORKDIR}"/* ; }
+cleanup() {
+ # make sure that these variables exist
+ [[ -n ${ED} && -n ${T} && -n ${WORKDIR} ]] \
+ || { die "${FUNCNAME[0]}: undefined variable"; exit 1; }
+ rm -rf "${ED}"/* "${T}"/* "${WORKDIR}"/*
+}
+
test-it() {
local ret=0
tbegin "$@"
@@ -26,7 +32,7 @@ test-it() {
: $(( ret |= $? ))
pushd "${WORKDIR}" >/dev/null
: $(( ret |= $? ))
- test
+ test_sc
: $(( ret |= $? ))
popd >/dev/null
: $(( ret |= $? ))
@@ -34,21 +40,21 @@ test-it() {
cleanup
}
-test() {
+test_sc() {
touch f || return 1
sc f || return 1
[[ -f ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
}
test-it "simple save_config"
-test() {
+test_sc() {
touch a b c || return 1
sc a b c || return 1
[[ -d ${ED}/etc/portage/savedconfig/${CATEGORY}/${PF} ]]
}
test-it "multi save_config"
-test() {
+test_sc() {
mkdir dir || return 1
touch dir/{a,b,c} || return 1
sc dir || return 1
@@ -58,14 +64,14 @@ test-it "dir save_config"
PORTAGE_CONFIGROOT=${D}
-test() {
+test_sc() {
echo "ggg" > f || return 1
rc f || return 1
[[ $(<f) == "ggg" ]]
}
test-it "simple restore_config"
-test() {
+test_sc() {
echo "ggg" > f || return 1
rc f || return 1
[[ $(<f) == "ggg" ]] || return 1