randconfig.sh 972 B

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