summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-12-15 00:15:09 +0000
committerMike Frysinger <vapier@gentoo.org>2011-12-15 00:15:09 +0000
commitdee950db421051fdf29613d77fa4fa5e057065c8 (patch)
tree3617ba0ae6c63c942ff86d22c986dacf4ba66d07 /eclass/tests
parentimport KV_to_int and friends since a few eclasses still want it ... (diff)
downloadgentoo-2-dee950db421051fdf29613d77fa4fa5e057065c8.tar.gz
gentoo-2-dee950db421051fdf29613d77fa4fa5e057065c8.tar.bz2
gentoo-2-dee950db421051fdf29613d77fa4fa5e057065c8.zip
add some test status helpers to simplify management of i/o and exit status
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/autotools:eaclocal_amflags.sh6
-rwxr-xr-xeclass/tests/eutils:path_exists.sh9
-rwxr-xr-xeclass/tests/scons-utils.sh6
-rw-r--r--eclass/tests/tests-common.sh12
-rwxr-xr-xeclass/tests/toolchain-funcs.sh14
5 files changed, 31 insertions, 16 deletions
diff --git a/eclass/tests/autotools:eaclocal_amflags.sh b/eclass/tests/autotools:eaclocal_amflags.sh
index ac0ab767aa55..186565629051 100755
--- a/eclass/tests/autotools:eaclocal_amflags.sh
+++ b/eclass/tests/autotools:eaclocal_amflags.sh
@@ -5,11 +5,11 @@ source tests-common.sh
inherit autotools
test-it() {
- ebegin "Testing eaclocal_amflags $1: $2"
+ tbegin "eaclocal_amflags $1: $2"
printf "ACLOCAL_AMFLAGS = %b\n" "$2" > Makefile.am
local flags=$(eaclocal_amflags) exp=${3:-$2}
[[ "${flags}" == "${exp}" ]]
- if ! eend $? ; then
+ if ! tend $? ; then
printf '### INPUT:\n%s\n' "$2"
printf '### FILE:\n%s\n' "$(<Makefile.am)"
printf '### EXPECTED:\n%s\n' "${exp}"
@@ -25,3 +25,5 @@ test-it shell-exec '`echo hi`' "hi"
test-it shell-exec '`echo {0..3}`' "0 1 2 3"
test-it multiline '-I oneline \\\n\t-I twoline' "-I oneline -I twoline"
+
+texit
diff --git a/eclass/tests/eutils:path_exists.sh b/eclass/tests/eutils:path_exists.sh
index 5260b268edb0..9d1ddfc2f1d6 100755
--- a/eclass/tests/eutils:path_exists.sh
+++ b/eclass/tests/eutils:path_exists.sh
@@ -4,15 +4,12 @@ source tests-common.sh
inherit eutils
-tret=0
-
test-path_exists() {
local exp=$1; shift
- ebegin "Testing path_exists($*) == ${exp}"
+ tbegin "path_exists($*) == ${exp}"
path_exists "$@"
[[ ${exp} -eq $? ]]
- eend $?
- : $(( tret |= $? ))
+ tend $?
}
test-path_exists 1
@@ -33,4 +30,4 @@ test-path_exists 1 ${good} ${bad}
test-path_exists 1 -a ${good} ${bad}
test-path_exists 0 -o ${good} ${bad}
-(exit ${tret})
+texit
diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh
index e8c60ff78393..345f0a401c23 100755
--- a/eclass/tests/scons-utils.sh
+++ b/eclass/tests/scons-utils.sh
@@ -26,7 +26,7 @@ jc=5
# failed test counter
failed=0
-ebegin "Testing scons_clean_makeopts()"
+tbegin "scons_clean_makeopts()"
# sane MAKEOPTS
test-scons_clean_makeopts '--jobs=14 -k'
@@ -56,4 +56,6 @@ test-scons_clean_makeopts '--jobs funnystuff -k' "--jobs=${jc} -k"
test-scons_clean_makeopts '--jobs -l3' "--jobs=${jc}"
test-scons_clean_makeopts '-j -l3' "-j ${jc}"
-eend ${failed}
+tend ${failed}
+
+texit
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh
index 5413d7ec4cdb..3b1ffab5d764 100644
--- a/eclass/tests/tests-common.sh
+++ b/eclass/tests/tests-common.sh
@@ -87,3 +87,15 @@ KV_to_int() {
return 1
}
+
+tret=0
+tbegin() {
+ ebegin "Testing $*"
+}
+texit() {
+ exit ${tret}
+}
+tend() {
+ eend "$@"
+ : $(( tret |= $? ))
+}
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index 73dadbb20154..d8fb97e5bc73 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -22,23 +22,23 @@ test-tc-arch-kernel() {
done
return ${ret}
}
-ebegin "Testing tc-arch-kernel() (KV=2.6.0)"
+tbegin "tc-arch-kernel() (KV=2.6.0)"
test-tc-arch-kernel 2.6.0 \
alpha arm{,eb}:arm avr32 bfin:blackfin cris hppa:parisc \
i{3..6}86:i386 ia64 m68k mips{,eb}:mips nios2 powerpc:ppc powerpc64:ppc64 \
s390{,x}:s390 sh{1..4}{,eb}:sh sparc{,64} vax x86_64 \
i{3..6}86-gentoo-freebsd:i386
-eend $?
-ebegin "Testing tc-arch-kernel() (KV=2.6.30)"
+tend $?
+tbegin "tc-arch-kernel() (KV=2.6.30)"
test-tc-arch-kernel 2.6.30 \
i{3..6}86:x86 x86_64:x86 \
powerpc{,64}:powerpc i{3..6}86-gentoo-freebsd:i386
-eend $?
+tend $?
#
# TEST: tc-arch
#
-ebegin "Testing tc-arch"
+tbegin "tc-arch"
ret=0
for CHOST in \
alpha arm{,eb}:arm avr32:avr bfin cris hppa i{3..6}86:x86 ia64 m68k \
@@ -54,4 +54,6 @@ do
((++ret))
fi
done
-eend ${ret}
+tend ${ret}
+
+texit