randomtest 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. # Regenerate .config with default answers for yanked-off options
  68. { yes "" | make oldconfig >/dev/null; } || exit 1
  69. nice -n 10 make 2>&1 | tee -a make.log
  70. test -x busybox && {
  71. cd ..
  72. rm -rf "$dir"
  73. exit 0
  74. }
  75. cd ..
  76. mv "$dir" "failed.$dir"
  77. exit 1