randomtest 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/bin/sh
  2. # Select which libc to build against
  3. libc="glibc" # assumed native
  4. # static, cross-compilation
  5. libc="uclibc"
  6. # x86 32-bit:
  7. uclibc_cross="i486-linux-uclibc-"
  8. # My system has strange prefix for x86 64-bit uclibc:
  9. #uclibc_cross="x86_64-pc-linux-gnu-"
  10. test -d tree || exit 1
  11. dir=test.$$
  12. while test -e "$dir" -o -e failed."$dir"; do
  13. dir=test."$RANDOM"
  14. done
  15. cp -dpr tree "$dir" || exit 1
  16. cd "$dir" || exit 1
  17. echo "Running randconfig test in $dir..." >&2
  18. make randconfig >/dev/null || exit 1
  19. cat .config \
  20. | grep -v ^CONFIG_DEBUG_PESSIMIZE= \
  21. | grep -v CONFIG_WERROR \
  22. | cat >.config.new
  23. mv .config.new .config
  24. echo CONFIG_WERROR=y >>.config
  25. test "$libc" = glibc && {
  26. cat .config \
  27. | grep -v ^CONFIG_SELINUX= \
  28. | grep -v ^CONFIG_EFENCE= \
  29. | grep -v ^CONFIG_DMALLOC= \
  30. | cat >.config.new
  31. mv .config.new .config
  32. }
  33. test "$libc" = uclibc && {
  34. cat .config \
  35. | grep -v ^CONFIG_SELINUX= \
  36. | grep -v ^CONFIG_EFENCE= \
  37. | grep -v ^CONFIG_DMALLOC= \
  38. | grep -v ^CONFIG_BUILD_LIBBUSYBOX= \
  39. | grep -v ^CONFIG_PAM= \
  40. | grep -v ^CONFIG_TASKSET= \
  41. | grep -v ^CONFIG_FEATURE_ASSUME_UNICODE= \
  42. | grep -v ^CONFIG_PIE= \
  43. | grep -v CONFIG_STATIC \
  44. | grep -v CONFIG_CROSS_COMPILER_PREFIX \
  45. | cat >.config.new
  46. mv .config.new .config
  47. echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config
  48. echo 'CONFIG_STATIC=y' >>.config
  49. }
  50. # If NOMMU, remove some things
  51. grep -q ^CONFIG_NOMMU= .config && {
  52. cat .config \
  53. | grep -v ^CONFIG_ASH= \
  54. | grep -v ^CONFIG_FEATURE_SH_IS_ASH= \
  55. | cat >.config.new
  56. mv .config.new .config
  57. }
  58. # If STATIC, remove some things
  59. # PAM with static linking is probably pointless
  60. # (but I need to try - now I don't have libpam.a on my system, only libpam.so)
  61. grep -q ^CONFIG_STATIC= .config && {
  62. cat .config \
  63. | grep -v ^CONFIG_PAM= \
  64. | cat >.config.new
  65. mv .config.new .config
  66. }
  67. # CONFIG_NOMMU + CONFIG_HUSH + CONFIG_WERROR don't mix
  68. # (produces warning)
  69. grep -q ^CONFIG_NOMMU= .config && \
  70. grep -q ^CONFIG_HUSH= .config && \
  71. {
  72. cat .config \
  73. | grep -v ^CONFIG_WERROR= \
  74. | cat >.config.new
  75. mv .config.new .config
  76. }
  77. # Regenerate .config with default answers for yanked-off options
  78. { yes "" | make oldconfig >/dev/null; } || exit 1
  79. nice -n 10 make
  80. test -x busybox && {
  81. cd ..
  82. rm -rf "$dir"
  83. exit 0
  84. }
  85. cd ..
  86. mv "$dir" failed."$dir"
  87. exit 1