source: MondoRescue/branches/3.3/mindi-busybox/scripts/randomtest@ 3621

Last change on this file since 3621 was 3621, checked in by Bruno Cornec, 7 years ago

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

  • Property svn:executable set to *
File size: 3.8 KB
Line 
1#!/bin/sh
2
3# If not specified in environment...
4if ! test "$LIBC"; then
5 # Select which libc to build against
6 LIBC="glibc"
7 LIBC="uclibc"
8fi
9# x86 32-bit:
10#CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
11# My system has strange prefix for x86 64-bit uclibc:
12#CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-"
13
14if test $# -lt 2 || ! test -d "$1" || test -e "$2"; then
15 echo "Usage: $0 SRC_DIR TMP_DIR"
16 echo
17 echo "SRC_DIR will be copied to TMP_DIR directory."
18 echo "Then a random build will be performed."
19 echo
20 echo "Useful variables:"
21 echo "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS"
22 exit 1
23fi
24
25cp -dpr -- "$1" "$2" || { echo "copy error"; exit 1; }
26cd -- "$2" || { echo "cd $dir error"; exit 1; }
27
28# Generate random config
29make randconfig >/dev/null || { echo "randconfig error"; exit 1; }
30
31# Tweak resulting config
32cat .config \
33| grep -v CONFIG_DEBUG_PESSIMIZE \
34| grep -v CONFIG_WERROR \
35| grep -v CONFIG_CROSS_COMPILER_PREFIX \
36| grep -v CONFIG_SELINUX \
37| grep -v CONFIG_EFENCE \
38| grep -v CONFIG_DMALLOC \
39\
40| grep -v CONFIG_RFKILL \
41>.config.new
42mv .config.new .config
43echo '# CONFIG_DEBUG_PESSIMIZE is not set' >>.config
44echo '# CONFIG_WERROR is not set' >>.config
45echo "CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILER_PREFIX}\"" >>.config
46echo '# CONFIG_SELINUX is not set' >>.config
47echo '# CONFIG_EFENCE is not set' >>.config
48echo '# CONFIG_DMALLOC is not set' >>.config
49echo '# CONFIG_RFKILL is not set' >>.config
50
51# If glibc, don't build static
52if test x"$LIBC" = x"glibc"; then
53 cat .config \
54 | grep -v CONFIG_STATIC \
55 \
56 | grep -v CONFIG_FEATURE_2_4_MODULES \
57 | grep -v CONFIG_FEATURE_USE_BSS_TAIL \
58 | grep -v CONFIG_DEBUG_SANITIZE \
59 >.config.new
60 mv .config.new .config
61 echo '# CONFIG_STATIC is not set' >>.config
62 # newer glibc (at least 2.23) no longer supply query_module() ABI.
63 # People who target 2.4 kernels would likely use older glibc (and older bbox).
64 echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
65 echo '# CONFIG_FEATURE_USE_BSS_TAIL is not set' >>.config
66 echo '# CONFIG_DEBUG_SANITIZE is not set' >>.config
67fi
68
69# If uclibc, build static, and remove some things
70# likely to not work on uclibc.
71if test x"$LIBC" = x"uclibc"; then
72 cat .config \
73 | grep -v CONFIG_STATIC \
74 | grep -v CONFIG_BUILD_LIBBUSYBOX \
75 | grep -v CONFIG_PIE \
76 \
77 | grep -v CONFIG_FEATURE_2_4_MODULES \
78 | grep -v CONFIG_FEATURE_SYNC_FANCY \
79 | grep -v CONFIG_FEATURE_TOUCH_NODEREF \
80 | grep -v CONFIG_NANDWRITE \
81 | grep -v CONFIG_NANDDUMP \
82 | grep -v CONFIG_BLKDISCARD \
83 | grep -v CONFIG_NSENTER \
84 | grep -v CONFIG_UNSHARE \
85 >.config.new
86 mv .config.new .config
87 echo 'CONFIG_STATIC=y' >>.config
88 echo '# CONFIG_BUILD_LIBBUSYBOX is not set' >>.config
89 echo '# CONFIG_PIE is not set' >>.config
90 echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
91 echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config
92 echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config
93 # My uclibc installation does not support some needed APIs...
94 echo '# CONFIG_NANDWRITE is not set' >>.config
95 echo '# CONFIG_NANDDUMP is not set' >>.config
96 echo '# CONFIG_BLKDISCARD is not set' >>.config
97 echo '# CONFIG_NSENTER is not set' >>.config
98 echo '# CONFIG_UNSHARE is not set' >>.config
99fi
100
101# If STATIC, remove some things.
102# PAM with static linking is probably pointless
103# (but I need to try - now I don't have libpam.a on my system, only libpam.so)
104if grep -q "^CONFIG_STATIC=y" .config; then
105 cat .config \
106 | grep -v CONFIG_PAM \
107 >.config.new
108 mv .config.new .config
109 echo '# CONFIG_PAM is not set' >>.config
110fi
111
112# Regenerate .config with default answers for yanked-off options
113# (most of default answers are "no").
114{ yes "" | make oldconfig >/dev/null; } || { echo "oldconfig error"; exit 1; }
115
116# Build!
117nice -n 10 make $MAKEOPTS 2>&1 | tee make.log
118grep 'Rerun make' make.log \
119&& nice -n 10 make $MAKEOPTS 2>&1 | tee -a make.log
120
121# Return exitcode 1 if busybox executable does not exist
122test -x busybox
Note: See TracBrowser for help on using the repository browser.