diff options
author | Mike Frysinger <vapier@gentoo.org> | 2017-02-09 13:15:13 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2017-02-09 13:16:07 -0500 |
commit | 9470312c23d126f0055f82c0e656003b3945430b (patch) | |
tree | b7f2359d9f627ac59df262213d391b7d420b3768 /eclass/tests | |
parent | 5c89a86903d7f8846bb021fc54053275230280f2 (diff) | |
download | gentoo-9470312c23d126f0055f82c0e656003b3945430b.tar.gz gentoo-9470312c23d126f0055f82c0e656003b3945430b.tar.xz |
multiprocess.eclass: makeopts_{jobs,loadavg}: fix implicit handling of $MAKEOPTS #608242
We missed quoting on ${MAKEOPTS} to set it as the first arg which meant
we might load invalid values into the second arg which is the "infinite"
scenario.
Diffstat (limited to 'eclass/tests')
-rwxr-xr-x | eclass/tests/multiprocessing_makeopts_jobs.sh | 12 | ||||
-rwxr-xr-x | eclass/tests/multiprocessing_makeopts_loadavg.sh | 11 |
2 files changed, 17 insertions, 6 deletions
diff --git a/eclass/tests/multiprocessing_makeopts_jobs.sh b/eclass/tests/multiprocessing_makeopts_jobs.sh index ef477277ab3..cc4f91b6943 100755 --- a/eclass/tests/multiprocessing_makeopts_jobs.sh +++ b/eclass/tests/multiprocessing_makeopts_jobs.sh @@ -10,14 +10,20 @@ inherit multiprocessing test-makeopts_jobs() { local exp=$1; shift tbegin "makeopts_jobs($1${2+; inf=${2}}) == ${exp}" - local act=$(makeopts_jobs "$@") - [[ ${act} == "${exp}" ]] - tend $? "Got back: ${act}" + local indirect=$(MAKEOPTS="$*" makeopts_jobs) + local direct=$(makeopts_jobs "$@") + if [[ "${direct}" != "${indirect}" ]] ; then + tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'" + else + [[ ${direct} == "${exp}" ]] + tend $? "Got back: ${act}" + fi } tests=( 999 "-j" 999 "--jobs" + 999 "-j -l9" 1 "" 1 "-l9 -w" 1 "-l9 -w-j4" diff --git a/eclass/tests/multiprocessing_makeopts_loadavg.sh b/eclass/tests/multiprocessing_makeopts_loadavg.sh index 6b976beb1ae..ffa679d13e2 100755 --- a/eclass/tests/multiprocessing_makeopts_loadavg.sh +++ b/eclass/tests/multiprocessing_makeopts_loadavg.sh @@ -10,9 +10,14 @@ inherit multiprocessing test-makeopts_loadavg() { local exp=$1; shift tbegin "makeopts_loadavg($1${2+; inf=${2}}) == ${exp}" - local act=$(makeopts_loadavg "$@") - [[ ${act} == "${exp}" ]] - tend $? "Got back: ${act}" + local indirect=$(MAKEOPTS="$*" makeopts_loadavg) + local direct=$(makeopts_loadavg "$@") + if [[ "${direct}" != "${indirect}" ]] ; then + tend 1 "Mismatch between MAKEOPTS/cli: '${indirect}' != '${direct}'" + else + [[ ${direct} == "${exp}" ]] + tend $? "Got back: ${act}" + fi } tests=( |