public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-config:master commit in: tests/
@ 2012-12-30 23:24 Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2012-12-30 23:24 UTC (permalink / raw
  To: gentoo-commits

commit:     fbfb0cc589e7ef8e3d61d4ccf8038356c2b5f2bc
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 30 15:46:09 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Dec 30 23:25:07 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=fbfb0cc5

run_test: set RC_NOCOLOR to suppress colours

NOCOLOR appears not to work with functions.sh from baselayout-prefix,
which is an old copy, prior to 2.0.  Not sure if this patch is really
worth it, since the output of functions.sh also differs enough to make
tests fail.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/run_tests |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tests/run_tests b/tests/run_tests
index 1d35d9f..caca986 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -18,7 +18,7 @@ if ! . /etc/init.d/functions.sh 2>/dev/null ; then
 	die() { echo "$*"; exit 1; }
 fi
 
-vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR )
+vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )
 unset ${vars[@]}
 
 TROOT=${PWD}
@@ -29,6 +29,7 @@ fi
 PATH="${TROOT}/..:${PATH}"
 
 NOCOLOR="true"
+RC_NOCOLOR="yes" # Older baselayout/openrc versions.
 # This CHOST value doesn't matter.  It could be anything.
 # As long as all the configs we test are based on this being
 # the CHOST value.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: tests/
@ 2012-12-31  0:34 Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2012-12-31  0:34 UTC (permalink / raw
  To: gentoo-commits

commit:     f856383b4f3dc563127bf8df83a05adb6327498f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 31 00:35:20 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Dec 31 00:35:20 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=f856383b

tests: run in parallel

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/run_tests |   58 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/tests/run_tests b/tests/run_tests
index caca986..82c8948 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -3,20 +3,20 @@
 # Avoid bash localization of error messages
 export LC_ALL=C
 
-if ! . /etc/init.d/functions.sh 2>/dev/null ; then
-	ebegin() { printf '%s ... ' "$*" ; }
-	eend() {
-		local r=${1:-0}
-		shift
-		if [[ $r -eq 0 ]] ; then
-			echo "[ ok ]"
-		else
-			echo "$* [ !! ]"
-		fi
-		return $r
-	}
-	die() { echo "$*"; exit 1; }
-fi
+. /etc/init.d/functions.sh 2>/dev/null
+ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
+eend() {
+	local r=${1:-0}
+	shift
+	if [[ $r -eq 0 ]] ; then
+		printf '[ %sok%s ]\n' "${GOOD}" "${NORMAL}"
+	else
+		printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
+	fi
+	return $r
+}
+die() { echo "$*" 1>&2; exit 1; }
+eval $(eval_ecolors)
 
 vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )
 unset ${vars[@]}
@@ -38,7 +38,7 @@ CHOST="x86_64-pc-linux-gnu"
 cmp_log() {
 	local ret log=$1 exp=$2
 	local v args=()
-	for v in ${vars[@]} ; do
+	for v in "${vars[@]}" ; do
 		args+=( -e "s:@${v}@:${!v}:g" )
 	done
 	args+=( -e "s|: line [0-9]*: |: |g" )
@@ -56,14 +56,19 @@ rm -rf TMP-*-rw-*
 if [[ $# -eq 0 ]] ; then
 	set -- */test*
 else
-	set -- ${@/%//test*}
-	set -- ${@//\/\///}
+	set -- "${@/%//test*}"
+	set -- "${@//\/\///}"
 fi
 
+max_jobs=$(getconf _NPROCESSORS_ONLN)
+jobs=()
 tret=0
 for t in "$@" ; do
 	[[ ${t} == *.exp ]] && continue
 
+	(
+	out=$(
+	(
 	ebegin "Running ${t}"
 
 	test=${t##*/}
@@ -75,7 +80,7 @@ for t in "$@" ; do
 
 	ROOT=${TROOT}/${tdir}
 
-	r="${ROOT}/runit"
+	r="${ROOT}/${test}.runit"
 	cat <<-EOF > "${r}"
 	#!/bin/bash
 	cd "${ROOT}"
@@ -101,5 +106,22 @@ for t in "$@" ; do
 	else
 		: $(( tret += $? ))
 	fi
+
+	) 2>&1
+	)
+	echo "${out}"
+	) &
+
+	# Run all the tests in parallel.
+	jobs+=( $! )
+	if [[ ${#jobs[@]} -ge ${max_jobs} ]] ; then
+		wait ${jobs[0]}
+		: $(( tret += $? ))
+		jobs=( ${jobs[@]:1} )
+	fi
+done
+for j in ${jobs[@]} ; do
+	wait ${j}
+	: $(( tret += $? ))
 done
 exit ${tret}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: tests/
@ 2012-12-31  1:18 Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2012-12-31  1:18 UTC (permalink / raw
  To: gentoo-commits

commit:     fdeeafe1f410a94c5bca1b245e3c4c39b7518ada
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 31 00:35:20 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Dec 31 01:19:05 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=fdeeafe1

tests: run in parallel

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 tests/run_tests |   60 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/tests/run_tests b/tests/run_tests
index caca986..b0a45c0 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -3,20 +3,20 @@
 # Avoid bash localization of error messages
 export LC_ALL=C
 
-if ! . /etc/init.d/functions.sh 2>/dev/null ; then
-	ebegin() { printf '%s ... ' "$*" ; }
-	eend() {
-		local r=${1:-0}
-		shift
-		if [[ $r -eq 0 ]] ; then
-			echo "[ ok ]"
-		else
-			echo "$* [ !! ]"
-		fi
-		return $r
-	}
-	die() { echo "$*"; exit 1; }
-fi
+. /etc/init.d/functions.sh 2>/dev/null
+ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
+eend() {
+	local r=${1:-0}
+	shift
+	if [[ $r -eq 0 ]] ; then
+		printf '[ %sok%s ]\n' "${GOOD}" "${NORMAL}"
+	else
+		printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
+	fi
+	return $r
+}
+die() { echo "$*" 1>&2; exit 1; }
+eval $(eval_ecolors)
 
 vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )
 unset ${vars[@]}
@@ -38,7 +38,7 @@ CHOST="x86_64-pc-linux-gnu"
 cmp_log() {
 	local ret log=$1 exp=$2
 	local v args=()
-	for v in ${vars[@]} ; do
+	for v in "${vars[@]}" ; do
 		args+=( -e "s:@${v}@:${!v}:g" )
 	done
 	args+=( -e "s|: line [0-9]*: |: |g" )
@@ -50,20 +50,25 @@ cmp_log() {
 	return ${ret}
 }
 
-rm -f */*.log*
+rm -f */*.log* */*.runit
 rm -rf TMP-*-rw-*
 
 if [[ $# -eq 0 ]] ; then
 	set -- */test*
 else
-	set -- ${@/%//test*}
-	set -- ${@//\/\///}
+	set -- "${@/%//test*}"
+	set -- "${@//\/\///}"
 fi
 
+max_jobs=$(getconf _NPROCESSORS_ONLN)
+jobs=()
 tret=0
 for t in "$@" ; do
 	[[ ${t} == *.exp ]] && continue
 
+	(
+	out=$(
+	(
 	ebegin "Running ${t}"
 
 	test=${t##*/}
@@ -75,7 +80,7 @@ for t in "$@" ; do
 
 	ROOT=${TROOT}/${tdir}
 
-	r="${ROOT}/runit"
+	r="${ROOT}/${test}.runit"
 	cat <<-EOF > "${r}"
 	#!/bin/bash
 	cd "${ROOT}"
@@ -101,5 +106,22 @@ for t in "$@" ; do
 	else
 		: $(( tret += $? ))
 	fi
+
+	) 2>&1
+	)
+	echo "${out}"
+	) &
+
+	# Run all the tests in parallel.
+	jobs+=( $! )
+	if [[ ${#jobs[@]} -ge ${max_jobs} ]] ; then
+		wait ${jobs[0]}
+		: $(( tret += $? ))
+		jobs=( ${jobs[@]:1} )
+	fi
+done
+for j in ${jobs[@]} ; do
+	wait ${j}
+	: $(( tret += $? ))
 done
 exit ${tret}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: tests/
@ 2015-05-13  4:26 Ryan Hill
  0 siblings, 0 replies; 6+ messages in thread
From: Ryan Hill @ 2015-05-13  4:26 UTC (permalink / raw
  To: gentoo-commits

commit:     d45de09450ffb63b138bbb7f78cae43e1101e2ec
Author:     Ryan Hill <rhill <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 04:09:28 2015 +0000
Commit:     Ryan Hill <rhill <AT> gentoo <DOT> org>
CommitDate: Wed May 13 04:09:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d45de094

Ignore whitespace when diffing test results.

The amount of whitespace output by ebegin/eend from gentoo-functions
is dynamic (seems to be dependent on terminal width).  Since we can't
predict this we have to ignore all whitespace differences.

URL: https://bugs.gentoo.org/547586
Reported-by: tka <tka <AT> kamph.org>
Signed-off-by: Ryan Hill <rhill <AT> gentoo.org>

 tests/run_tests | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/run_tests b/tests/run_tests
index 2ff7d77..397d667 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -44,7 +44,7 @@ cmp_log() {
 	args+=( -e "s|: line [0-9]*: |: |g" )
 	sed "${args[@]}" "${exp}" > "${exp}.tmp"
 	sed "${args[@]}" "${log}" > "${log}.tmp"
-	diff -u "${exp}.tmp" "${log}.tmp" > "${log}.diff"
+	diff -uw "${exp}.tmp" "${log}.tmp" > "${log}.diff"
 	ret=$?
 	rm "${exp}.tmp"
 	return ${ret}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: tests/
@ 2018-08-13 21:58 Sergei Trofimovich
  0 siblings, 0 replies; 6+ messages in thread
From: Sergei Trofimovich @ 2018-08-13 21:58 UTC (permalink / raw
  To: gentoo-commits

commit:     03db74215077d0d19b5e3d6bf60fe1781229c2e4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 13 21:58:02 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Aug 13 21:58:02 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=03db7421

tests/run_tests: switch to /lib/gentoo/functions.sh

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 tests/run_tests | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/run_tests b/tests/run_tests
index 397d667..9ba34a0 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -3,7 +3,7 @@
 # Avoid bash localization of error messages
 export LC_ALL=C
 
-. /etc/init.d/functions.sh 2>/dev/null
+. /lib/gentoo/functions.sh 2>/dev/null
 ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
 eend() {
 	local r=${1:-0}
@@ -16,7 +16,7 @@ eend() {
 	return $r
 }
 die() { echo "$*" 1>&2; exit 1; }
-eval $(eval_ecolors)
+eval $(eval_ecolors 2>/dev/null)
 
 vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )
 unset ${vars[@]}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: tests/
@ 2022-09-22 23:46 Sam James
  0 siblings, 0 replies; 6+ messages in thread
From: Sam James @ 2022-09-22 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     fa49a60a8a2a169eca8c9cd12c4220988a8fdadc
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 22 23:20:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 23:45:43 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=fa49a60a

tests: use sys-apps/gentoo-functions if available

Gives us nicer looking output.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 tests/run_tests | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/tests/run_tests b/tests/run_tests
index 602aa92..ef38770 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -3,17 +3,24 @@
 # Avoid bash localization of error messages
 export LC_ALL=C
 
-ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
-eend() {
-	local r=${1:-0}
-	shift
-	if [[ $r -eq 0 ]] ; then
+functions_script="${EPREFIX}/lib/gentoo/functions.sh"
+source "${functions_script}" || {
+	echo "${argv0}: Could not source ${functions_script}!" 1>&2
+
+	ebegin() { printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*" ; }
+
+	eend() {
+		local r=${1:-0}
+		shift
+		if [[ $r -eq 0 ]] ; then
 		printf '[ %sok%s ]\n' "${GOOD}" "${NORMAL}"
-	else
-		printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
-	fi
-	return $r
+		else
+			printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
+		fi
+		return $r
+	}
 }
+
 die() { echo "$*" 1>&2; exit 1; }
 
 vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-22 23:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-22 23:46 [gentoo-commits] proj/gcc-config:master commit in: tests/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2018-08-13 21:58 Sergei Trofimovich
2015-05-13  4:26 Ryan Hill
2012-12-31  1:18 Mike Frysinger
2012-12-31  0:34 Mike Frysinger
2012-12-30 23:24 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox