summaryrefslogtreecommitdiff
path: root/eclass/tests
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-06-13 00:08:30 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-06-13 00:08:30 +0100
commit0ebcd2cbf178600b5eb36b2f24cdbb3d2f4a9000 (patch)
tree941e6ba8c256dd27e9f9ca634f08d4bf0278798e /eclass/tests
parentf0ddcad13515f66d2f3bf827d33c277bdba7e1dd (diff)
gentoo auto-resync : 13:06:2024 - 00:08:29
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/cargo-bench.sh4
-rwxr-xr-xeclass/tests/git-r3.sh208
-rwxr-xr-xeclass/tests/linux-info_get_running_version.sh12
-rwxr-xr-xeclass/tests/pypi-bench.sh4
-rwxr-xr-xeclass/tests/python-utils-bench.sh4
-rwxr-xr-xeclass/tests/toolchain-funcs.sh4
6 files changed, 18 insertions, 218 deletions
diff --git a/eclass/tests/cargo-bench.sh b/eclass/tests/cargo-bench.sh
index d30b04569905..9347fe339c12 100755
--- a/eclass/tests/cargo-bench.sh
+++ b/eclass/tests/cargo-bench.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2023 Gentoo Authors
+# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -39,7 +39,7 @@ timeit() {
local xr avg
for x in real user; do
xr="${x}[*]"
- avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p")
+ avg=$(dc -e "3 k ${ITERATIONS} ${RUNS} * ${!xr} + + / p")
printf '%s %4.0f it/s\n' "${x}" "${avg}"
done
diff --git a/eclass/tests/git-r3.sh b/eclass/tests/git-r3.sh
deleted file mode 100755
index 02cbcbc59125..000000000000
--- a/eclass/tests/git-r3.sh
+++ /dev/null
@@ -1,208 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# git no longer allows ext: protocol, meh
-exit 0
-
-EAPI=7
-
-source tests-common.sh || exit
-
-inherit git-r3
-
-testdir=${pkg_root}/git
-mkdir "${testdir}" || die "unable to mkdir testdir"
-cd "${testdir}" || die "unable to cd to testdir"
-
-EGIT3_STORE_DIR=store
-mkdir "${EGIT3_STORE_DIR}" || die "unable to mkdir store"
-
-test_file() {
- local fn=${1}
- local expect=${2}
-
- if [[ ! -f ${fn} ]]; then
- eerror "${fn} does not exist (not checked out?)"
- else
- local got=$(<"${fn}")
-
- if [[ ${got} != ${expect} ]]; then
- eerror "${fn}, expected: ${expect}, got: ${got}"
- else
- return 0
- fi
- fi
- return 1
-}
-
-test_no_file() {
- local fn=${1}
-
- if [[ -f ${fn} ]]; then
- eerror "${fn} exists (wtf?!)"
- else
- return 0
- fi
- return 1
-}
-
-test_repo_clean() {
- local P=${P}_${FUNCNAME#test_}
-
- (
- mkdir repo
- cd repo
- git init -q
- echo test > file
- git add file
- git commit -m 1 -q
- echo other-text > file2
- git add file2
- git commit -m 2 -q
- ) || die "unable to prepare repo"
-
- # we need to use an array to preserve whitespace
- local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/repo"
- )
-
- tbegin "fetching from a simple repo"
- (
- git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" test && \
- test_file "${WORKDIR}/${P}/file2" other-text
- ) &>fetch.log
-
- eend ${?} || cat fetch.log
-}
-
-test_repo_revert() {
- local P=${P}_${FUNCNAME#test_}
-
- (
- cd repo
- git revert -n HEAD^
- git commit -m r1 -q
- ) || die "unable to prepare repo"
-
- # we need to use an array to preserve whitespace
- local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/repo"
- )
-
- tbegin "fetching revert"
- (
- git-r3_src_unpack
- test_no_file "${WORKDIR}/${P}/file" && \
- test_file "${WORKDIR}/${P}/file2" other-text
- ) &>fetch.log
-
- eend ${?} || cat fetch.log
-}
-
-test_repo_branch() {
- local P=${P}_${FUNCNAME#test_}
-
- (
- cd repo
- git branch -q other-branch HEAD^
- git checkout -q other-branch
- echo one-more > file3
- git add file3
- git commit -m 3 -q
- git checkout -q master
- ) || die "unable to prepare repo"
-
- # we need to use an array to preserve whitespace
- local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/repo"
- )
- local EGIT_BRANCH=other-branch
-
- tbegin "switching branches"
- (
- git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" test && \
- test_file "${WORKDIR}/${P}/file2" other-text && \
- test_file "${WORKDIR}/${P}/file3" one-more
- ) &>fetch.log
-
- eend ${?} || cat fetch.log
-}
-
-test_repo_merge() {
- local P=${P}_${FUNCNAME#test_}
-
- (
- cd repo
- git branch -q one-more-branch HEAD^
- git checkout -q one-more-branch
- echo foobarbaz > file3
- git add file3
- git commit -m 3b -q
- git checkout -q master
- git merge -m 4 -q one-more-branch
- ) || die "unable to prepare repo"
-
- # we need to use an array to preserve whitespace
- local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/repo"
- )
-
- tbegin "fetching a merge commit"
- (
- git-r3_src_unpack
- test_no_file "${WORKDIR}/${P}/file" && \
- test_file "${WORKDIR}/${P}/file2" other-text && \
- test_file "${WORKDIR}/${P}/file3" foobarbaz
- ) &>fetch.log
-
- eend ${?} || cat fetch.log
-}
-
-test_repo_revert_merge() {
- local P=${P}_${FUNCNAME#test_}
-
- (
- cd repo
- git branch -q to-be-reverted
- git checkout -q to-be-reverted
- echo trrm > file3
- git add file3
- git commit -m 5b -q
- git checkout -q master
- echo trrm > file2
- git add file2
- git commit -m 5 -q
- git merge -m 6 -q to-be-reverted
- echo trrm > file
- git add file
- git commit -m 7 -q
- git revert -m 1 -n HEAD^
- git commit -m 7r -q
- ) || die "unable to prepare repo"
-
- # we need to use an array to preserve whitespace
- local EGIT_REPO_URI=(
- "ext::git daemon --export-all --base-path=. --inetd %G/repo"
- )
-
- tbegin "fetching a revert of a merge commit"
- (
- git-r3_src_unpack
- test_file "${WORKDIR}/${P}/file" trrm && \
- test_file "${WORKDIR}/${P}/file2" trrm && \
- test_file "${WORKDIR}/${P}/file3" foobarbaz
- ) &>fetch.log
-
- eend ${?} || cat fetch.log
-}
-
-test_repo_clean
-test_repo_revert
-test_repo_branch
-test_repo_merge
-test_repo_revert_merge
-
-texit
diff --git a/eclass/tests/linux-info_get_running_version.sh b/eclass/tests/linux-info_get_running_version.sh
index 57aaf2fedcd4..b8ae8c4b85ae 100755
--- a/eclass/tests/linux-info_get_running_version.sh
+++ b/eclass/tests/linux-info_get_running_version.sh
@@ -1,12 +1,20 @@
#!/bin/bash
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=6
+EAPI=8
source tests-common.sh || exit
+source version-funcs.sh || exit
inherit linux-info
+use() {
+ case $1 in
+ kernel_linux) return 0 ;;
+ esac
+ die "${FUNCNAME[0]}: unknown flag"
+}
+
test_get_running_version() {
local test_kv=$1 major=$2 minor=$3 patch=$4 extra=$5
tbegin "get_running_version ${test_kv}"
diff --git a/eclass/tests/pypi-bench.sh b/eclass/tests/pypi-bench.sh
index cce93527b729..02855563db3f 100755
--- a/eclass/tests/pypi-bench.sh
+++ b/eclass/tests/pypi-bench.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2023 Gentoo Authors
+# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -39,7 +39,7 @@ timeit() {
local xr avg
for x in real user; do
xr="${x}[*]"
- avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p")
+ avg=$(dc -e "3 k ${ITERATIONS} ${RUNS} * ${!xr} + + / p")
printf '%s %4.0f it/s\n' "${x}" "${avg}"
done
diff --git a/eclass/tests/python-utils-bench.sh b/eclass/tests/python-utils-bench.sh
index 7f27adef5509..f718b9f125cb 100755
--- a/eclass/tests/python-utils-bench.sh
+++ b/eclass/tests/python-utils-bench.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2023 Gentoo Authors
+# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -38,7 +38,7 @@ timeit() {
local xr avg
for x in real user; do
xr="${x}[*]"
- avg=$(dc -S 3 -e "${ITERATIONS} ${RUNS} * ${!xr} + + / p")
+ avg=$(dc -e "3 k ${ITERATIONS} ${RUNS} * ${!xr} + + / p")
printf '%s %4.0f it/s\n' "${x}" "${avg}"
done
diff --git a/eclass/tests/toolchain-funcs.sh b/eclass/tests/toolchain-funcs.sh
index 08cfd74611aa..ee10ddf50c1e 100755
--- a/eclass/tests/toolchain-funcs.sh
+++ b/eclass/tests/toolchain-funcs.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -28,7 +28,7 @@ test-tc-arch-kernel() {
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 \
+ powerpc{,64}:powerpc \
or1k:openrisc or1k-linux-musl:openrisc
tend $?