summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-08-07 12:37:21 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-08-07 12:37:21 +0100
commitb8c7370a682e4e29cda623222d17a790c01c3642 (patch)
treef6caa14689bd00a5760eadaa381ff41e50ef3c1b /eclass/tests
parent8a4997a7e2d1e36c089d4d76935b5a902d98d3d0 (diff)
gentoo auto-resync : 07:08:2024 - 12:37:20
Diffstat (limited to 'eclass/tests')
-rw-r--r--eclass/tests/Makefile2
-rwxr-xr-xeclass/tests/dist-kernel-utils.sh59
-rwxr-xr-xeclass/tests/eapi7-ver.sh174
-rwxr-xr-xeclass/tests/llvm-r1.sh26
-rw-r--r--eclass/tests/tests-common.sh2
-rwxr-xr-xeclass/tests/toolchain-funcs.sh40
-rwxr-xr-x[-rw-r--r--]eclass/tests/version-funcs.sh174
7 files changed, 293 insertions, 184 deletions
diff --git a/eclass/tests/Makefile b/eclass/tests/Makefile
index 99e824dea86d..23027aed6b66 100644
--- a/eclass/tests/Makefile
+++ b/eclass/tests/Makefile
@@ -1,5 +1,5 @@
SH_FILES := $(wildcard *.sh)
-TEST_FILES := $(filter-out tests-common.sh version-funcs.sh, $(SH_FILES))
+TEST_FILES := $(filter-out tests-common.sh, $(SH_FILES))
TEST_OK_FILES := $(patsubst %.sh, .%.sh.ok,$ $(TEST_FILES))
# !!! _All_ recipe lines for each target will be provided to a single
diff --git a/eclass/tests/dist-kernel-utils.sh b/eclass/tests/dist-kernel-utils.sh
index 50ba001f8e9c..28c8f7213a53 100755
--- a/eclass/tests/dist-kernel-utils.sh
+++ b/eclass/tests/dist-kernel-utils.sh
@@ -20,9 +20,68 @@ test_PV_to_KV() {
tend $?
}
+test_compressed_module_cleanup() {
+ mkdir -p "${tmpdir}/source" || die
+ pushd "${tmpdir}" >/dev/null || die
+
+ local module option fail=0
+ for option in NONE GZIP XZ ZSTD; do
+ tbegin "CONFIG_MODULE_COMPRESS_${option}"
+ echo "CONFIG_MODULE_COMPRESS_${option}=y" > source/.config
+
+ touch a.ko b.ko.gz c.ko.xz d.ko.gz e.ko f.ko.xz || die
+ # ensure some files are older
+ touch -d "2 hours ago" d.ko e.ko.xz f.ko.gz || die
+
+ IUSE=modules-compress dist-kernel_compressed_module_cleanup .
+
+ local to_keep=( a.ko b.ko.gz c.ko.xz )
+ local to_remove=()
+
+ case ${option} in
+ NONE)
+ to_keep+=( d.ko e.ko f.ko.xz )
+ to_remove+=( d.ko.gz e.ko.xz f.ko.gz )
+ ;;
+ GZIP)
+ to_keep+=( d.ko.gz e.ko f.ko.gz )
+ to_remove+=( d.ko e.ko.xz f.ko.xz )
+ ;;
+ XZ)
+ to_keep+=( d.ko.gz e.ko.xz f.ko.xz )
+ to_remove+=( d.ko e.ko f.ko.gz )
+ ;;
+ ZSTD)
+ to_keep+=( d.ko.gz e.ko f.ko.xz )
+ to_remove+=( d.ko e.ko.xz f.ko.gz )
+ ;;
+ esac
+
+ for module in "${to_keep[@]}"; do
+ if [[ ! -f ${module} ]]; then
+ eerror "Module ${module} was removed"
+ fail=1
+ fi
+ done
+
+ for module in "${to_remove[@]}"; do
+ if [[ -f ${module} ]]; then
+ eerror "Module ${module} was not removed"
+ fail=1
+ fi
+ done
+ tend ${fail}
+ done
+
+ popd >/dev/null || die
+}
+
+
test_PV_to_KV 6.0_rc1 6.0.0-rc1
test_PV_to_KV 6.0 6.0.0
test_PV_to_KV 6.0.1_rc1 6.0.1-rc1
test_PV_to_KV 6.0.1 6.0.1
+test_compressed_module_cleanup
+
texit
diff --git a/eclass/tests/eapi7-ver.sh b/eclass/tests/eapi7-ver.sh
deleted file mode 100755
index ee7e6d728ef7..000000000000
--- a/eclass/tests/eapi7-ver.sh
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source tests-common.sh || exit
-source version-funcs.sh || exit
-
-teq() {
- local expected=${1}; shift
-
- tbegin "${*} -> ${expected}"
- local got=$("${@}")
- [[ ${got} == ${expected} ]]
- tend ${?} "returned: ${got}"
-}
-
-teqr() {
- local expected=$1; shift
- tbegin "$* -> ${expected}"
- "$@"
- local ret=$?
- [[ ${ret} -eq ${expected} ]]
- tend $? "returned: ${ret}"
-}
-
-txf() {
- tbegin "XFAIL: ${*}"
- local got=$("${@}" 2>&1)
- [[ ${got} == die:* ]]
- tend ${?} "function did not die"
-}
-
-teq 1 ver_cut 1 1.2.3
-teq 1 ver_cut 1-1 1.2.3
-teq 1.2 ver_cut 1-2 1.2.3
-teq 2.3 ver_cut 2- 1.2.3
-teq 1.2.3 ver_cut 1- 1.2.3
-teq 3b ver_cut 3-4 1.2.3b_alpha4
-teq alpha ver_cut 5 1.2.3b_alpha4
-teq 1.2 ver_cut 1-2 .1.2.3
-teq .1.2 ver_cut 0-2 .1.2.3
-teq 2.3 ver_cut 2-3 1.2.3.
-teq 2.3. ver_cut 2- 1.2.3.
-teq 2.3. ver_cut 2-4 1.2.3.
-
-teq 1-2.3 ver_rs 1 - 1.2.3
-teq 1.2-3 ver_rs 2 - 1.2.3
-teq 1-2-3.4 ver_rs 1-2 - 1.2.3.4
-teq 1.2-3-4 ver_rs 2- - 1.2.3.4
-teq 1.2.3 ver_rs 2 . 1.2-3
-teq 1.2.3.a ver_rs 3 . 1.2.3a
-teq 1.2-alpha-4 ver_rs 2-3 - 1.2_alpha4
-teq 1.23-b_alpha4 ver_rs 3 - 2 "" 1.2.3b_alpha4
-teq a1b_2-c-3-d4e5 ver_rs 3-5 _ 4-6 - a1b2c3d4e5
-teq .1-2.3 ver_rs 1 - .1.2.3
-teq -1.2.3 ver_rs 0 - .1.2.3
-
-# truncating range
-teq 1.2 ver_cut 0-2 1.2.3
-teq 2.3 ver_cut 2-5 1.2.3
-teq "" ver_cut 4 1.2.3
-teq "" ver_cut 0 1.2.3
-teq "" ver_cut 4- 1.2.3
-teq 1.2.3 ver_rs 0 - 1.2.3
-teq 1.2.3 ver_rs 3 . 1.2.3
-teq 1.2.3 ver_rs 3- . 1.2.3
-teq 1.2.3 ver_rs 3-5 . 1.2.3
-
-txf ver_cut foo 1.2.3
-txf ver_rs -3 _ a1b2c3d4e5
-txf ver_rs 5-3 _ a1b2c3d4e5
-
-# Tests from Portage's test_vercmp.py
-teqr 0 ver_test 6.0 -gt 5.0
-teqr 0 ver_test 5.0 -gt 5
-teqr 0 ver_test 1.0-r1 -gt 1.0-r0
-teqr 0 ver_test 999999999999999999 -gt 999999999999999998 # 18 digits
-teqr 0 ver_test 1.0.0 -gt 1.0
-teqr 0 ver_test 1.0.0 -gt 1.0b
-teqr 0 ver_test 1b -gt 1
-teqr 0 ver_test 1b_p1 -gt 1_p1
-teqr 0 ver_test 1.1b -gt 1.1
-teqr 0 ver_test 12.2.5 -gt 12.2b
-teqr 0 ver_test 4.0 -lt 5.0
-teqr 0 ver_test 5 -lt 5.0
-teqr 0 ver_test 1.0_pre2 -lt 1.0_p2
-teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2
-teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1
-teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3
-teqr 0 ver_test 1.001000000000000001 -lt 1.001000000000000002
-teqr 0 ver_test 1.00100000000 -lt 1.001000000000000001
-teqr 0 ver_test 999999999999999998 -lt 999999999999999999
-teqr 0 ver_test 1.01 -lt 1.1
-teqr 0 ver_test 1.0-r0 -lt 1.0-r1
-teqr 0 ver_test 1.0 -lt 1.0-r1
-teqr 0 ver_test 1.0 -lt 1.0.0
-teqr 0 ver_test 1.0b -lt 1.0.0
-teqr 0 ver_test 1_p1 -lt 1b_p1
-teqr 0 ver_test 1 -lt 1b
-teqr 0 ver_test 1.1 -lt 1.1b
-teqr 0 ver_test 12.2b -lt 12.2.5
-teqr 0 ver_test 4.0 -eq 4.0
-teqr 0 ver_test 1.0 -eq 1.0
-teqr 0 ver_test 1.0-r0 -eq 1.0
-teqr 0 ver_test 1.0 -eq 1.0-r0
-teqr 0 ver_test 1.0-r0 -eq 1.0-r0
-teqr 0 ver_test 1.0-r1 -eq 1.0-r1
-teqr 1 ver_test 1 -eq 2
-teqr 1 ver_test 1.0_alpha -eq 1.0_pre
-teqr 1 ver_test 1.0_beta -eq 1.0_alpha
-teqr 1 ver_test 1 -eq 0.0
-teqr 1 ver_test 1.0-r0 -eq 1.0-r1
-teqr 1 ver_test 1.0-r1 -eq 1.0-r0
-teqr 1 ver_test 1.0 -eq 1.0-r1
-teqr 1 ver_test 1.0-r1 -eq 1.0
-teqr 1 ver_test 1.0 -eq 1.0.0
-teqr 1 ver_test 1_p1 -eq 1b_p1
-teqr 1 ver_test 1b -eq 1
-teqr 1 ver_test 1.1b -eq 1.1
-teqr 1 ver_test 12.2b -eq 12.2
-
-# A subset of tests from Paludis
-teqr 0 ver_test 1.0_alpha -gt 1_alpha
-teqr 0 ver_test 1.0_alpha -gt 1
-teqr 0 ver_test 1.0_alpha -lt 1.0
-teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1.2_alpha7-r4
-teqr 0 ver_test 0001 -eq 1
-teqr 0 ver_test 01 -eq 001
-teqr 0 ver_test 0001.1 -eq 1.1
-teqr 0 ver_test 01.01 -eq 1.01
-teqr 0 ver_test 1.010 -eq 1.01
-teqr 0 ver_test 1.00 -eq 1.0
-teqr 0 ver_test 1.0100 -eq 1.010
-teqr 0 ver_test 1-r00 -eq 1-r0
-
-# Additional tests
-teqr 0 ver_test 0_rc99 -lt 0
-teqr 0 ver_test 011 -eq 11
-teqr 0 ver_test 019 -eq 19
-teqr 0 ver_test 1.2 -eq 001.2
-teqr 0 ver_test 1.2 -gt 1.02
-teqr 0 ver_test 1.2a -lt 1.2b
-teqr 0 ver_test 1.2_pre1 -gt 1.2_pre1_beta2
-teqr 0 ver_test 1.2_pre1 -lt 1.2_pre1_p2
-teqr 0 ver_test 1.00 -lt 1.0.0
-teqr 0 ver_test 1.010 -eq 1.01
-teqr 0 ver_test 1.01 -lt 1.1
-teqr 0 ver_test 1.2_pre08-r09 -eq 1.2_pre8-r9
-teqr 0 ver_test 0 -lt 576460752303423488 # 2**59
-teqr 0 ver_test 0 -lt 9223372036854775808 # 2**63
-
-# Bad number or ordering of arguments
-txf ver_test 1
-txf ver_test 1 -lt 2 3
-txf ver_test -lt 1 2
-
-# Bad operators
-txf ver_test 1 "<" 2
-txf ver_test 1 lt 2
-txf ver_test 1 -foo 2
-
-# Malformed versions
-txf ver_test "" -ne 1
-txf ver_test 1. -ne 1
-txf ver_test 1ab -ne 1
-txf ver_test b -ne 1
-txf ver_test 1-r1_pre -ne 1
-txf ver_test 1-pre1 -ne 1
-txf ver_test 1_foo -ne 1
-txf ver_test 1_pre1.1 -ne 1
-txf ver_test 1-r1.0 -ne 1
-txf ver_test cvs.9999 -ne 9999
-
-texit
diff --git a/eclass/tests/llvm-r1.sh b/eclass/tests/llvm-r1.sh
index 9958f5bba420..8583fd6c799b 100755
--- a/eclass/tests/llvm-r1.sh
+++ b/eclass/tests/llvm-r1.sh
@@ -121,22 +121,30 @@ test_fix_tool_path() {
tend ${?}
}
+# full range
+test_globals '14 15 16 17 18 19' \
+ "+llvm_slot_18 llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_19" \
+ "^^ ( llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18 llvm_slot_19 )" \
+ "llvm_slot_15(-)?,llvm_slot_16(-)?,llvm_slot_17(-)?,llvm_slot_18(-)?,llvm_slot_19(-)?"
test_globals '14 15 16 17 18' \
- "+llvm_slot_17 llvm_slot_15 llvm_slot_16 llvm_slot_18" \
+ "+llvm_slot_18 llvm_slot_15 llvm_slot_16 llvm_slot_17" \
"^^ ( llvm_slot_15 llvm_slot_16 llvm_slot_17 llvm_slot_18 )" \
"llvm_slot_15(-)?,llvm_slot_16(-)?,llvm_slot_17(-)?,llvm_slot_18(-)?"
+# older than stable
test_globals '14 15 16' \
"+llvm_slot_16 llvm_slot_15" \
"^^ ( llvm_slot_15 llvm_slot_16 )" \
"llvm_slot_15(-)?,llvm_slot_16(-)?"
-test_globals '15 18' \
- "+llvm_slot_15 llvm_slot_18" \
- "^^ ( llvm_slot_15 llvm_slot_18 )" \
- "llvm_slot_15(-)?,llvm_slot_18(-)?"
-test_globals '18' \
- "+llvm_slot_18" \
- "^^ ( llvm_slot_18 )" \
- "llvm_slot_18(-)?"
+# old + newer than current stable
+test_globals '15 19' \
+ "+llvm_slot_15 llvm_slot_19" \
+ "^^ ( llvm_slot_15 llvm_slot_19 )" \
+ "llvm_slot_15(-)?,llvm_slot_19(-)?"
+# newer than current stable
+test_globals '19' \
+ "+llvm_slot_19" \
+ "^^ ( llvm_slot_19 )" \
+ "llvm_slot_19(-)?"
LLVM_COMPAT=( {14..18} )
inherit llvm-r1
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh
index 45b1e20b933a..f4e18f38fee9 100644
--- a/eclass/tests/tests-common.sh
+++ b/eclass/tests/tests-common.sh
@@ -55,6 +55,8 @@ has() {
}
use() { has "$1" ${IUSE} ; }
+in_iuse() { use "$@" ; }
+
die() {
echo "die: $*" 1>&2
exit 1
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index ee10ddf50c1e..0d6745862148 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -210,6 +210,36 @@ if type -P gcc &>/dev/null; then
tbegin "tc-get-c-rtlib (gcc)"
[[ $(CC=gcc tc-get-c-rtlib) == libgcc ]]
tend $?
+
+ tbegin "tc-is-lto (gcc, -fno-lto)"
+ CC=gcc CFLAGS=-fno-lto tc-is-lto
+ [[ $? -eq 1 ]]
+ tend $?
+
+ tbegin "tc-is-lto (gcc, -flto)"
+ CC=gcc CFLAGS=-flto tc-is-lto
+ [[ $? -eq 0 ]]
+ tend $?
+
+ case $(gcc -dumpmachine) in
+ i*86*-gnu*|arm*-gnu*|powerpc-*-gnu)
+ tbegin "tc-has-64bit-time_t (_TIME_BITS=32)"
+ CC=gcc CFLAGS="-U_TIME_BITS -D_TIME_BITS=32" tc-has-64bit-time_t
+ [[ $? -eq 1 ]]
+ tend $?
+
+ tbegin "tc-has-64bit-time_t (_TIME_BITS=64)"
+ CC=gcc CFLAGS="-U_FILE_OFFSET_BITS -U_TIME_BITS -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" tc-has-64bit-time_t
+ [[ $? -eq 0 ]]
+ tend $?
+ ;;
+ *)
+ tbegin "tc-has-64bit-time_t"
+ CC=gcc tc-has-64bit-time_t
+ [[ $? -eq 0 ]]
+ tend $?
+ ;;
+ esac
fi
if type -P clang &>/dev/null; then
@@ -232,6 +262,16 @@ if type -P clang &>/dev/null; then
[[ $(CC=clang CFLAGS="--rtlib=${rtlib}" tc-get-c-rtlib) == ${rtlib} ]]
tend $?
done
+
+ tbegin "tc-is-lto (clang, -fno-lto)"
+ CC=clang CFLAGS=-fno-lto tc-is-lto
+ [[ $? -eq 1 ]]
+ tend $?
+
+ tbegin "tc-is-lto (clang, -flto)"
+ CC=clang CFLAGS=-flto tc-is-lto
+ [[ $? -eq 0 ]]
+ tend $?
fi
texit
diff --git a/eclass/tests/version-funcs.sh b/eclass/tests/version-funcs.sh
index 6e83c01666f0..cb2a92342c65 100644..100755
--- a/eclass/tests/version-funcs.sh
+++ b/eclass/tests/version-funcs.sh
@@ -300,3 +300,177 @@ ver_test() {
_ver_compare "${va}" "${vb}"
test $? "${op}" 2
}
+
+# Return if we are being sourced
+return 2>/dev/null
+
+
+source tests-common.sh || exit
+
+teq() {
+ local expected=${1}; shift
+
+ tbegin "${*} -> ${expected}"
+ local got=$("${@}")
+ [[ ${got} == ${expected} ]]
+ tend ${?} "returned: ${got}"
+}
+
+teqr() {
+ local expected=$1; shift
+ tbegin "$* -> ${expected}"
+ "$@"
+ local ret=$?
+ [[ ${ret} -eq ${expected} ]]
+ tend $? "returned: ${ret}"
+}
+
+txf() {
+ tbegin "XFAIL: ${*}"
+ local got=$("${@}" 2>&1)
+ [[ ${got} == die:* ]]
+ tend ${?} "function did not die"
+}
+
+teq 1 ver_cut 1 1.2.3
+teq 1 ver_cut 1-1 1.2.3
+teq 1.2 ver_cut 1-2 1.2.3
+teq 2.3 ver_cut 2- 1.2.3
+teq 1.2.3 ver_cut 1- 1.2.3
+teq 3b ver_cut 3-4 1.2.3b_alpha4
+teq alpha ver_cut 5 1.2.3b_alpha4
+teq 1.2 ver_cut 1-2 .1.2.3
+teq .1.2 ver_cut 0-2 .1.2.3
+teq 2.3 ver_cut 2-3 1.2.3.
+teq 2.3. ver_cut 2- 1.2.3.
+teq 2.3. ver_cut 2-4 1.2.3.
+
+teq 1-2.3 ver_rs 1 - 1.2.3
+teq 1.2-3 ver_rs 2 - 1.2.3
+teq 1-2-3.4 ver_rs 1-2 - 1.2.3.4
+teq 1.2-3-4 ver_rs 2- - 1.2.3.4
+teq 1.2.3 ver_rs 2 . 1.2-3
+teq 1.2.3.a ver_rs 3 . 1.2.3a
+teq 1.2-alpha-4 ver_rs 2-3 - 1.2_alpha4
+teq 1.23-b_alpha4 ver_rs 3 - 2 "" 1.2.3b_alpha4
+teq a1b_2-c-3-d4e5 ver_rs 3-5 _ 4-6 - a1b2c3d4e5
+teq .1-2.3 ver_rs 1 - .1.2.3
+teq -1.2.3 ver_rs 0 - .1.2.3
+
+# truncating range
+teq 1.2 ver_cut 0-2 1.2.3
+teq 2.3 ver_cut 2-5 1.2.3
+teq "" ver_cut 4 1.2.3
+teq "" ver_cut 0 1.2.3
+teq "" ver_cut 4- 1.2.3
+teq 1.2.3 ver_rs 0 - 1.2.3
+teq 1.2.3 ver_rs 3 . 1.2.3
+teq 1.2.3 ver_rs 3- . 1.2.3
+teq 1.2.3 ver_rs 3-5 . 1.2.3
+
+txf ver_cut foo 1.2.3
+txf ver_rs -3 _ a1b2c3d4e5
+txf ver_rs 5-3 _ a1b2c3d4e5
+
+# Tests from Portage's test_vercmp.py
+teqr 0 ver_test 6.0 -gt 5.0
+teqr 0 ver_test 5.0 -gt 5
+teqr 0 ver_test 1.0-r1 -gt 1.0-r0
+teqr 0 ver_test 999999999999999999 -gt 999999999999999998 # 18 digits
+teqr 0 ver_test 1.0.0 -gt 1.0
+teqr 0 ver_test 1.0.0 -gt 1.0b
+teqr 0 ver_test 1b -gt 1
+teqr 0 ver_test 1b_p1 -gt 1_p1
+teqr 0 ver_test 1.1b -gt 1.1
+teqr 0 ver_test 12.2.5 -gt 12.2b
+teqr 0 ver_test 4.0 -lt 5.0
+teqr 0 ver_test 5 -lt 5.0
+teqr 0 ver_test 1.0_pre2 -lt 1.0_p2
+teqr 0 ver_test 1.0_alpha2 -lt 1.0_p2
+teqr 0 ver_test 1.0_alpha1 -lt 1.0_beta1
+teqr 0 ver_test 1.0_beta3 -lt 1.0_rc3
+teqr 0 ver_test 1.001000000000000001 -lt 1.001000000000000002
+teqr 0 ver_test 1.00100000000 -lt 1.001000000000000001
+teqr 0 ver_test 999999999999999998 -lt 999999999999999999
+teqr 0 ver_test 1.01 -lt 1.1
+teqr 0 ver_test 1.0-r0 -lt 1.0-r1
+teqr 0 ver_test 1.0 -lt 1.0-r1
+teqr 0 ver_test 1.0 -lt 1.0.0
+teqr 0 ver_test 1.0b -lt 1.0.0
+teqr 0 ver_test 1_p1 -lt 1b_p1
+teqr 0 ver_test 1 -lt 1b
+teqr 0 ver_test 1.1 -lt 1.1b
+teqr 0 ver_test 12.2b -lt 12.2.5
+teqr 0 ver_test 4.0 -eq 4.0
+teqr 0 ver_test 1.0 -eq 1.0
+teqr 0 ver_test 1.0-r0 -eq 1.0
+teqr 0 ver_test 1.0 -eq 1.0-r0
+teqr 0 ver_test 1.0-r0 -eq 1.0-r0
+teqr 0 ver_test 1.0-r1 -eq 1.0-r1
+teqr 1 ver_test 1 -eq 2
+teqr 1 ver_test 1.0_alpha -eq 1.0_pre
+teqr 1 ver_test 1.0_beta -eq 1.0_alpha
+teqr 1 ver_test 1 -eq 0.0
+teqr 1 ver_test 1.0-r0 -eq 1.0-r1
+teqr 1 ver_test 1.0-r1 -eq 1.0-r0
+teqr 1 ver_test 1.0 -eq 1.0-r1
+teqr 1 ver_test 1.0-r1 -eq 1.0
+teqr 1 ver_test 1.0 -eq 1.0.0
+teqr 1 ver_test 1_p1 -eq 1b_p1
+teqr 1 ver_test 1b -eq 1
+teqr 1 ver_test 1.1b -eq 1.1
+teqr 1 ver_test 12.2b -eq 12.2
+
+# A subset of tests from Paludis
+teqr 0 ver_test 1.0_alpha -gt 1_alpha
+teqr 0 ver_test 1.0_alpha -gt 1
+teqr 0 ver_test 1.0_alpha -lt 1.0
+teqr 0 ver_test 1.2.0.0_alpha7-r4 -gt 1.2_alpha7-r4
+teqr 0 ver_test 0001 -eq 1
+teqr 0 ver_test 01 -eq 001
+teqr 0 ver_test 0001.1 -eq 1.1
+teqr 0 ver_test 01.01 -eq 1.01
+teqr 0 ver_test 1.010 -eq 1.01
+teqr 0 ver_test 1.00 -eq 1.0
+teqr 0 ver_test 1.0100 -eq 1.010
+teqr 0 ver_test 1-r00 -eq 1-r0
+
+# Additional tests
+teqr 0 ver_test 0_rc99 -lt 0
+teqr 0 ver_test 011 -eq 11
+teqr 0 ver_test 019 -eq 19
+teqr 0 ver_test 1.2 -eq 001.2
+teqr 0 ver_test 1.2 -gt 1.02
+teqr 0 ver_test 1.2a -lt 1.2b
+teqr 0 ver_test 1.2_pre1 -gt 1.2_pre1_beta2
+teqr 0 ver_test 1.2_pre1 -lt 1.2_pre1_p2
+teqr 0 ver_test 1.00 -lt 1.0.0
+teqr 0 ver_test 1.010 -eq 1.01
+teqr 0 ver_test 1.01 -lt 1.1
+teqr 0 ver_test 1.2_pre08-r09 -eq 1.2_pre8-r9
+teqr 0 ver_test 0 -lt 576460752303423488 # 2**59
+teqr 0 ver_test 0 -lt 9223372036854775808 # 2**63
+
+# Bad number or ordering of arguments
+txf ver_test 1
+txf ver_test 1 -lt 2 3
+txf ver_test -lt 1 2
+
+# Bad operators
+txf ver_test 1 "<" 2
+txf ver_test 1 lt 2
+txf ver_test 1 -foo 2
+
+# Malformed versions
+txf ver_test "" -ne 1
+txf ver_test 1. -ne 1
+txf ver_test 1ab -ne 1
+txf ver_test b -ne 1
+txf ver_test 1-r1_pre -ne 1
+txf ver_test 1-pre1 -ne 1
+txf ver_test 1_foo -ne 1
+txf ver_test 1_pre1.1 -ne 1
+txf ver_test 1-r1.0 -ne 1
+txf ver_test cvs.9999 -ne 9999
+
+texit