4 # Copyright (c) 2014 Vojtech Horky
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # - Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # - Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # - The name of the author may not be used to endorse or promote products
17 # derived from this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 [ -z "$LOOPS" ] && LOOPS
=1
35 [ -z "$PARALLELISM" ] && PARALLELISM
=1
36 # By default, skip icc and native GCC
37 [ -z "$COMPILERS" ] && COMPILERS
="gcc_cross gcc_helenos clang"
41 echo " Cleaning after previous build." >&2
42 make distclean
-j$PARALLELISM 2>&1 ||
exit 1
46 echo " Preparing random configuration." >&2
47 make random-config
2>&1 ||
exit 1
51 BASIC_CONFIG
=`sed -n \
52 -e 's#PLATFORM = \(.*\)#\1#p' \
53 -e 's#MACHINE = \(.*\)#\1#p' \
54 -e 's#COMPILER = \(.*\)#\1#p' \
56 | paste '-sd,' | sed 's#,#, #g'`
58 echo -n " Building ($BASIC_CONFIG)... " >&2
60 make -j$PARALLELISM 2>&1
75 while [ $COUNTER -lt $LOOPS ]; do
76 COUNTER
=$
(( $COUNTER + 1 ))
77 echo "Try #$COUNTER (F$FAILED/S$SKIPPED):" >&2
81 CC
=`sed -n 's#^COMPILER = \(.*\)#\1#p' <Makefile.config`
82 if ! echo " $COMPILERS " |
grep -q " $CC "; then
83 echo " Skipping this one (compiler is $CC)." >&2
88 ) >random_run_
$COUNTER.log
90 if [ $RC -eq 2 ]; then
91 SKIPPED
=$
(( $SKIPPED + 1 ))
92 elif [ $RC -ne 0 ]; then
93 tail -n 10 random_run_
$COUNTER.log |
sed 's#.*# | &#'
94 FAILED
=$
(( $FAILED + 1 ))
96 cp Makefile.config random_run_
$COUNTER.Makefile.config
97 cp config.h random_run_
$COUNTER.config.h
100 echo "Out of $LOOPS tries, $SKIPPED were skipped and $FAILED configurations failed to compile." >&2