blob: 4c7126bbc53c4b54ffa6ff6038bd436abe794eed [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001#!/bin/sh
2
3# build random configurations
4# Usage:
5# ARCH=i386 nohup ./extra/scripts/randconfig.sh & sleep 1800 && touch STOP
6#
7# The above builds random i386 configs and automatically stops after 30 minutes
8
9test "x$AWK" = "x" && AWK=awk
10test "x$ARCH" = "x" && ARCH=`uname -m`
11KCONFIG_ALLCONFIG=.config.allconfig
12(echo TARGET_$ARCH=y
13 echo '# UCLIBC_PREGENERATED_LOCALE_DATA is not set'
14 echo '# DOMULTI is not set'
15 echo '# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set'
16) > $KCONFIG_ALLCONFIG
17export KCONFIG_ALLCONFIG
18
19if test "x$NCPU" = "x"
20then
21 test -r /proc/cpuinfo && \
22 eval `$AWK 'BEGIN{NCPU=0}
23/processor/{let NCPU++}
24END{if (NCPU<1) {NCPU=1}; print("NCPU="NCPU);}' /proc/cpuinfo` || \
25 NCPU=1
26fi
27MAKELEVEL="-j$NCPU"
28i=0
29while test ! -f STOP
30do
31 ARCH=$ARCH make $* randconfig > /dev/null
32 ARCH=$ARCH make $* silentoldconfig > /dev/null
33 if (make $MAKELEVEL $*) 2>&1 >& mk.log
34 then
35 :
36 else
37 i=`expr $i + 1`
38 num=`printf "%.5d" $i`
39 mv .config FAILED.$num.config
40 mv mk.log FAILED.$num.log
41 fi
42 make distclean > /dev/null || true
43done
44rm -f STOP