public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2010-10-17 21:36 Mike Frysinger (vapier)
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Frysinger (vapier) @ 2010-10-17 21:36 UTC (permalink / raw
  To: gentoo-commits

vapier      10/10/17 21:36:18

  Modified:             tests-common.sh
  Log:
  add has/hasq stubs as some eclass use these in global scope

Revision  Changes    Path
1.2                  eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.1&r2=1.2

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tests-common.sh	2 Jan 2008 01:01:18 -0000	1.1
+++ tests-common.sh	17 Oct 2010 21:36:18 -0000	1.2
@@ -8,3 +8,6 @@
 		source ../${e}.eclass
 	done
 }
+
+hasq() { [[ " ${*:2} " == *" $1 "* ]]; }
+has() { hasq "$@"; }






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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2010-10-18  7:18 Michal Gorny (mgorny)
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Gorny (mgorny) @ 2010-10-18  7:18 UTC (permalink / raw
  To: gentoo-commits

mgorny      10/10/18 07:18:14

  Modified:             tests-common.sh
  Log:
  Implement debug-print*() family of functions for tests.

Revision  Changes    Path
1.3                  eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.3&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.3&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.2&r2=1.3

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tests-common.sh	17 Oct 2010 21:36:18 -0000	1.2
+++ tests-common.sh	18 Oct 2010 07:18:14 -0000	1.3
@@ -9,5 +9,23 @@
 	done
 }
 
+debug-print() {
+	[[ ${#} -eq 0 ]] && return
+		
+	if [[ ${ECLASS_DEBUG_OUTPUT} == on ]]; then
+		printf 'debug: %s\n' "${@}" >&2
+	elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
+		printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}"
+	fi
+}
+
+debug-print-function() {
+	debug-print "${1}, parameters: ${*:2}"
+}
+
+debug-print-section() {
+	debug-print "now in section ${*}"
+}
+
 hasq() { [[ " ${*:2} " == *" $1 "* ]]; }
 has() { hasq "$@"; }






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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2011-07-12 14:27 Samuli Suominen (ssuominen)
  0 siblings, 0 replies; 9+ messages in thread
From: Samuli Suominen (ssuominen) @ 2011-07-12 14:27 UTC (permalink / raw
  To: gentoo-commits

ssuominen    11/07/12 14:27:46

  Modified:             tests-common.sh
  Log:
  Copy Portage's code for has -function to tests-common.sh. None of the eclasses use hasq anymore, so assuming this is safe. Feel free to yell at me if this breaks.

Revision  Changes    Path
1.4                  eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.4&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.4&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.3&r2=1.4

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tests-common.sh	18 Oct 2010 07:18:14 -0000	1.3
+++ tests-common.sh	12 Jul 2011 14:27:46 -0000	1.4
@@ -27,5 +27,13 @@
 	debug-print "now in section ${*}"
 }
 
-hasq() { [[ " ${*:2} " == *" $1 "* ]]; }
-has() { hasq "$@"; }
+has() {
+	local needle=$1
+	shift
+
+	local x
+	for x in "$@"; do
+		[ "${x}" = "${needle}" ] && return 0
+	done
+	return 1
+}






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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2011-09-23  4:03 Mike Frysinger (vapier)
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Frysinger (vapier) @ 2011-09-23  4:03 UTC (permalink / raw
  To: gentoo-commits

vapier      11/09/23 04:03:12

  Modified:             tests-common.sh
  Log:
  add die and has_version helpers

Revision  Changes    Path
1.5                  eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.5&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.5&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.4&r2=1.5

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- tests-common.sh	12 Jul 2011 14:27:46 -0000	1.4
+++ tests-common.sh	23 Sep 2011 04:03:12 -0000	1.5
@@ -11,7 +11,7 @@
 
 debug-print() {
 	[[ ${#} -eq 0 ]] && return
-		
+
 	if [[ ${ECLASS_DEBUG_OUTPUT} == on ]]; then
 		printf 'debug: %s\n' "${@}" >&2
 	elif [[ -n ${ECLASS_DEBUG_OUTPUT} ]]; then
@@ -37,3 +37,12 @@
 	done
 	return 1
 }
+
+die() {
+	echo "die: $*" 1>&2
+	exit 1
+}
+
+has_version() {
+	portageq has_version / "$@"
+}






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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2011-12-15  0:12 Mike Frysinger (vapier)
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Frysinger (vapier) @ 2011-12-15  0:12 UTC (permalink / raw
  To: gentoo-commits

vapier      11/12/15 00:12:46

  Modified:             tests-common.sh
  Log:
  import KV_to_int and friends since a few eclasses still want it ...

Revision  Changes    Path
1.6                  eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.6&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.6&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.5&r2=1.6

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tests-common.sh	23 Sep 2011 04:03:12 -0000	1.5
+++ tests-common.sh	15 Dec 2011 00:12:46 -0000	1.6
@@ -46,3 +46,44 @@
 has_version() {
 	portageq has_version / "$@"
 }
+
+KV_major() {
+	[[ -z $1 ]] && return 1
+
+	local KV=$@
+	echo "${KV%%.*}"
+}
+
+KV_minor() {
+	[[ -z $1 ]] && return 1
+
+	local KV=$@
+	KV=${KV#*.}
+	echo "${KV%%.*}"
+}
+
+KV_micro() {
+	[[ -z $1 ]] && return 1
+
+	local KV=$@
+	KV=${KV#*.*.}
+	echo "${KV%%[^[:digit:]]*}"
+}
+
+KV_to_int() {
+	[[ -z $1 ]] && return 1
+
+	local KV_MAJOR=$(KV_major "$1")
+	local KV_MINOR=$(KV_minor "$1")
+	local KV_MICRO=$(KV_micro "$1")
+	local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
+
+	# We make version 2.2.0 the minimum version we will handle as
+	# a sanity check ... if its less, we fail ...
+	if [[ ${KV_int} -ge 131584 ]] ; then
+		echo "${KV_int}"
+		return 0
+	fi
+
+	return 1
+}






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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2012-09-12 16:36 Mike Frysinger (vapier)
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Frysinger (vapier) @ 2012-09-12 16:36 UTC (permalink / raw
  To: gentoo-commits

vapier      12/09/12 16:36:27

  Modified:             tests-common.sh
  Log:
  error out if loading functions.sh failed

Revision  Changes    Path
1.11                 eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.11&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.11&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.10&r2=1.11

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- tests-common.sh	4 Jan 2012 08:25:05 -0000	1.10
+++ tests-common.sh	12 Sep 2012 16:36:26 -0000	1.11
@@ -1,6 +1,9 @@
 #!/bin/bash
 
-source /etc/init.d/functions.sh
+if ! source /etc/init.d/functions.sh ; then
+	echo "Missing functions.sh.  Please to install!" 1>&2
+	exit 1
+fi
 
 inherit() {
 	local e





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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2014-10-16 17:36 Mike Frysinger (vapier)
  0 siblings, 0 replies; 9+ messages in thread
From: Mike Frysinger (vapier) @ 2014-10-16 17:36 UTC (permalink / raw
  To: gentoo-commits

vapier      14/10/16 17:36:43

  Modified:             tests-common.sh
  Log:
  tests: let overlays add their own eclasses and testsuites and reuse this infrastructure

Revision  Changes    Path
1.13                 eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.13&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.13&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.12&r2=1.13

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- tests-common.sh	25 Sep 2013 11:20:12 -0000	1.12
+++ tests-common.sh	16 Oct 2014 17:36:43 -0000	1.13
@@ -5,11 +5,21 @@
 	exit 1
 fi
 
+# Let overlays override this so they can add their own testsuites.
+TESTS_ECLASS_SEARCH_PATHS=( .. )
+
 inherit() {
-	local e
+	local e path
 	for e in "$@" ; do
-		source ../${e}.eclass
+		for path in "${TESTS_ECLASS_SEARCH_PATHS[@]}" ; do
+			local eclass=${path}/${e}.eclass
+			if [[ -e "${eclass}" ]] ; then
+				source "${eclass}"
+				return 0
+			fi
+		done
 	done
+	die "could not find ${eclass}"
 }
 EXPORT_FUNCTIONS() { :; }
 





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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2014-12-21 14:29 Michal Gorny (mgorny)
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Gorny (mgorny) @ 2014-12-21 14:29 UTC (permalink / raw
  To: gentoo-commits

mgorny      14/12/21 14:29:37

  Modified:             tests-common.sh
  Log:
  Use gentoo-functions for tests, bug #504378.

Revision  Changes    Path
1.14                 eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.14&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.14&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.13&r2=1.14

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- tests-common.sh	16 Oct 2014 17:36:43 -0000	1.13
+++ tests-common.sh	21 Dec 2014 14:29:37 -0000	1.14
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-if ! source /etc/init.d/functions.sh ; then
-	echo "Missing functions.sh.  Please to install!" 1>&2
+if ! source /lib/gentoo/functions.sh ; then
+	echo "Missing functions.sh.  Please install sys-apps/gentoo-functions!" 1>&2
 	exit 1
 fi
 





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

* [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh
@ 2015-05-11 17:34 Ulrich Mueller (ulm)
  0 siblings, 0 replies; 9+ messages in thread
From: Ulrich Mueller (ulm) @ 2015-05-11 17:34 UTC (permalink / raw
  To: gentoo-commits

ulm         15/05/11 17:34:39

  Modified:             tests-common.sh
  Log:
  Add standard header, acknowledged by vapier and mgorny in bug 548984.

Revision  Changes    Path
1.15                 eclass/tests/tests-common.sh

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.15&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?rev=1.15&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/tests/tests-common.sh?r1=1.14&r2=1.15

Index: tests-common.sh
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- tests-common.sh	21 Dec 2014 14:29:37 -0000	1.14
+++ tests-common.sh	11 May 2015 17:34:39 -0000	1.15
@@ -1,4 +1,7 @@
 #!/bin/bash
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/tests/tests-common.sh,v 1.15 2015/05/11 17:34:39 ulm Exp $
 
 if ! source /lib/gentoo/functions.sh ; then
 	echo "Missing functions.sh.  Please install sys-apps/gentoo-functions!" 1>&2





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

end of thread, other threads:[~2015-05-11 17:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-16 17:36 [gentoo-commits] gentoo-x86 commit in eclass/tests: tests-common.sh Mike Frysinger (vapier)
  -- strict thread matches above, loose matches on Subject: below --
2015-05-11 17:34 Ulrich Mueller (ulm)
2014-12-21 14:29 Michal Gorny (mgorny)
2012-09-12 16:36 Mike Frysinger (vapier)
2011-12-15  0:12 Mike Frysinger (vapier)
2011-09-23  4:03 Mike Frysinger (vapier)
2011-07-12 14:27 Samuli Suominen (ssuominen)
2010-10-18  7:18 Michal Gorny (mgorny)
2010-10-17 21:36 Mike Frysinger (vapier)

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