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