public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] multiprocessing.eclass: make loadavg regex work for float values
@ 2017-09-11  3:23 Mike Gilbert
  2017-09-11 14:45 ` [gentoo-dev] [PATCH 1/2] " Mike Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2017-09-11  3:23 UTC (permalink / raw
  To: gentoo-dev; +Cc: base-system

Bug: https://bugs.gentoo.org/630626
---
 eclass/multiprocessing.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index 50368e35ea93..029201779957 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -120,7 +120,7 @@ makeopts_loadavg() {
 	# This assumes the first .* will be more greedy than the second .*
 	# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
 	local lavg=$(echo " $* " | sed -r -n \
-		-e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \
+		-e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+(\.[0-9]+)*).*:\3:p' \
 		-e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p")
 	# Default to ${inf} since the default is to not use a load limit.
 	echo ${lavg:-${2:-999}}
-- 
2.14.1



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

* [gentoo-dev] [PATCH 1/2] multiprocessing.eclass: make loadavg regex work for float values
  2017-09-11  3:23 [gentoo-dev] [PATCH] multiprocessing.eclass: make loadavg regex work for float values Mike Gilbert
@ 2017-09-11 14:45 ` Mike Gilbert
  2017-09-11 14:45   ` [gentoo-dev] [PATCH 2/2] multiprocessing.eclass: add tests " Mike Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Gilbert @ 2017-09-11 14:45 UTC (permalink / raw
  To: gentoo-dev; +Cc: base-system

Bug: https://bugs.gentoo.org/630626
---
v2: Reject "-l 2.3.4"

 eclass/multiprocessing.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/multiprocessing.eclass b/eclass/multiprocessing.eclass
index 50368e35ea93..b6e92976f73e 100644
--- a/eclass/multiprocessing.eclass
+++ b/eclass/multiprocessing.eclass
@@ -120,7 +120,7 @@ makeopts_loadavg() {
 	# This assumes the first .* will be more greedy than the second .*
 	# since POSIX doesn't specify a non-greedy match (i.e. ".*?").
 	local lavg=$(echo " $* " | sed -r -n \
-		-e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' \
+		-e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+(\.[0-9]+)?)[[:space:]].*:\3:p' \
 		-e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p")
 	# Default to ${inf} since the default is to not use a load limit.
 	echo ${lavg:-${2:-999}}
-- 
2.14.1



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

* [gentoo-dev] [PATCH 2/2] multiprocessing.eclass: add tests for float values
  2017-09-11 14:45 ` [gentoo-dev] [PATCH 1/2] " Mike Gilbert
@ 2017-09-11 14:45   ` Mike Gilbert
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Gilbert @ 2017-09-11 14:45 UTC (permalink / raw
  To: gentoo-dev; +Cc: base-system

Also fix the test function to output the correct var for failures.

Bug: https://bugs.gentoo.org/630626
---
 eclass/tests/multiprocessing_makeopts_loadavg.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/eclass/tests/multiprocessing_makeopts_loadavg.sh b/eclass/tests/multiprocessing_makeopts_loadavg.sh
index a03bf0ca8799..d17d7734b9f2 100755
--- a/eclass/tests/multiprocessing_makeopts_loadavg.sh
+++ b/eclass/tests/multiprocessing_makeopts_loadavg.sh
@@ -15,7 +15,7 @@ test-makeopts_loadavg() {
 		tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'"
 	else
 		[[ ${direct} == "${exp}" ]]
-		tend $? "Got back: ${act}"
+		tend $? "Got back: ${direct}"
 	fi
 }
 
@@ -35,6 +35,8 @@ tests=(
 	999 "-kl"
 	4 "-kl4"
 	5 "-kl 5"
+	2.3 "-l 2.3"
+	999 "-l 2.3.4"
 )
 for (( i = 0; i < ${#tests[@]}; i += 2 )) ; do
 	test-makeopts_loadavg "${tests[i]}" "${tests[i+1]}"
-- 
2.14.1



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

end of thread, other threads:[~2017-09-11 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-11  3:23 [gentoo-dev] [PATCH] multiprocessing.eclass: make loadavg regex work for float values Mike Gilbert
2017-09-11 14:45 ` [gentoo-dev] [PATCH 1/2] " Mike Gilbert
2017-09-11 14:45   ` [gentoo-dev] [PATCH 2/2] multiprocessing.eclass: add tests " Mike Gilbert

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