summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2010-10-07 19:14:48 +0000
committerMichał Górny <mgorny@gentoo.org>2010-10-07 19:14:48 +0000
commit02bcd10757bb591ca09325a96fa67ddc0f6ddfe1 (patch)
treef3f5595ea0639bb863ee6355c3c818d116a9a596 /eclass/tests
parentold (diff)
downloadhistorical-02bcd10757bb591ca09325a96fa67ddc0f6ddfe1.tar.gz
historical-02bcd10757bb591ca09325a96fa67ddc0f6ddfe1.tar.bz2
historical-02bcd10757bb591ca09325a96fa67ddc0f6ddfe1.zip
Introducing scons-utils.eclass -- a new eclass providing functions to help using SCons buildsystem.
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/scons-utils.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/eclass/tests/scons-utils.sh b/eclass/tests/scons-utils.sh
new file mode 100755
index 000000000000..a45d082875dd
--- /dev/null
+++ b/eclass/tests/scons-utils.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+source tests-common.sh
+
+inherit scons-utils
+
+test-scons_clean_makeopts() {
+ local sconsopts=$(scons_clean_makeopts ${1})
+
+ if [[ ${sconsopts} != ${2-${1}} ]]; then
+ eerror "Self-test failed:"
+ eindent
+ eerror "MAKEOPTS: ${1}"
+ eerror "Expected: ${2-${1}}"
+ eerror "Actual: ${sconsopts}"
+ eoutdent
+ (( ++failed ))
+ return 1
+ fi
+
+ return 0
+}
+
+# jobcount expected for non-specified state
+jc=255
+# failed test counter
+failed=0
+
+ebegin "Testing scons_clean_makeopts()"
+
+# sane MAKEOPTS
+test-scons_clean_makeopts '--jobs=14 -k'
+test-scons_clean_makeopts '--jobs=14 -k'
+test-scons_clean_makeopts '--jobs 15 -k'
+test-scons_clean_makeopts '--jobs=16 --keep-going'
+test-scons_clean_makeopts '-j17 --keep-going'
+test-scons_clean_makeopts '-j 18 --keep-going'
+
+# needing cleaning
+test-scons_clean_makeopts '--jobs -k' "--jobs=${jc} -k"
+test-scons_clean_makeopts '--jobs --keep-going' "--jobs=${jc} --keep-going"
+test-scons_clean_makeopts '-kj' "-kj ${jc}"
+
+# broken by definition (but passed as it breaks make as well)
+test-scons_clean_makeopts '-jk'
+test-scons_clean_makeopts '--jobs=randum'
+test-scons_clean_makeopts '-kjrandum'
+
+# needing stripping
+test-scons_clean_makeopts '--load-average=25 -kj16' '-kj16'
+test-scons_clean_makeopts '--load-average 25 -k -j17' '-k -j17'
+test-scons_clean_makeopts '-j2 HOME=/tmp' '-j2'
+test-scons_clean_makeopts '--jobs funnystuff -k' "--jobs=${jc} -k"
+
+eend ${failed}