Debian Codegraph @

scripts/randomtest

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # If not specified in environment...
4 if ! testscip-shell system . . test. "$LIBC"; then
5 # Select which libc to build against
6 LIBC="glibc"
7 LIBC="uclibc"
8 fi
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
14 if testscip-shell system . . test. $# -lt 2 || ! testscip-shell system . . test. -d "$1" || testscip-shell system . . test. -e "$2"; then
15 echoscip-shell system . . echo. "Usage: $0 SRC_DIR TMP_DIR"
16 echoscip-shell system . . echo.
17 echoscip-shell system . . echo. "SRC_DIR will be copied to TMP_DIR directory."
18 echoscip-shell system . . echo. "Then a random build will be performed."
19 echoscip-shell system . . echo.
20 echoscip-shell system . . echo. "Useful variables:"
21 echoscip-shell system . . echo. "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS"
22 exit 1
23 fi
24
25 cpscip-shell system . . cp. -dpr -- "$1" "$2" || { echoscip-shell system . . echo. "copy error"; exit 1; }
26 cd -- "$2" || { echoscip-shell system . . echo. "cd $dir error"; exit 1; }
27
28 # Generate random config
29 makescip-shell system . . make. randconfig >/dev/nullscip-shell filesystem . . `/dev/null`. || { echoscip-shell system . . echo. "randconfig error"; exit 1; }
30
31 # Tweak resulting config
32 catscip-shell system . . cat. .config \
33 | grepscip-shell system . . grep. -v CONFIG_DEBUG_PESSIMIZE \
34 | grepscip-shell system . . grep. -v CONFIG_WERROR \
35 | grepscip-shell system . . grep. -v CONFIG_CROSS_COMPILER_PREFIX \
36 | grepscip-shell system . . grep. -v CONFIG_SELINUX \
37 | grepscip-shell system . . grep. -v CONFIG_EFENCE \
38 | grepscip-shell system . . grep. -v CONFIG_DMALLOC \
39 | grepscip-shell system . . grep. -v CONFIG_FEATURE_TELNETD_SELFTEST_DEBUG \
40 \
41 | grepscip-shell system . . grep. -v CONFIG_RFKILL \
42 >.config.new
43 mvscip-shell system . . mv. .config.new .config
44 echoscip-shell system . . echo. '# CONFIG_DEBUG_PESSIMIZE is not set' >>.config
45 echoscip-shell system . . echo. '# CONFIG_WERROR is not set' >>.config
46 echoscip-shell system . . echo. "CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILER_PREFIX}\"" >>.config
47 echoscip-shell system . . echo. '# CONFIG_SELINUX is not set' >>.config
48 echoscip-shell system . . echo. '# CONFIG_EFENCE is not set' >>.config
49 echoscip-shell system . . echo. '# CONFIG_DMALLOC is not set' >>.config
50 echoscip-shell system . . echo. '# CONFIG_FEATURE_TELNETD_SELFTEST_DEBUG is not set' >>.config
51 echoscip-shell system . . echo. '# CONFIG_RFKILL is not set' >>.config
52
53 # If glibc, don't build static
54 if testscip-shell system . . test. x"$LIBC" = x"glibc"; then
55 catscip-shell system . . cat. .config \
56 | grepscip-shell system . . grep. -v CONFIG_STATIC \
57 | grepscip-shell system . . grep. -v CONFIG_FEATURE_LIBBUSYBOX_STATIC \
58 | grepscip-shell system . . grep. -v CONFIG_TC \
59 \
60 | grepscip-shell system . . grep. -v CONFIG_FEATURE_2_4_MODULES \
61 | grepscip-shell system . . grep. -v CONFIG_FEATURE_USE_BSS_TAIL \
62 | grepscip-shell system . . grep. -v CONFIG_DEBUG_SANITIZE \
63 | grepscip-shell system . . grep. -v CONFIG_FEATURE_MOUNT_NFS \
64 | grepscip-shell system . . grep. -v CONFIG_FEATURE_INETD_RPC \
65 >.config.new
66 mvscip-shell system . . mv. .config.new .config
67 echoscip-shell system . . echo. '# CONFIG_STATIC is not set' >>.config
68 echoscip-shell system . . echo. '# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set' >>.config
69 echoscip-shell system . . echo. '# CONFIG_TC is not set' >>.config
70 # newer glibc (at least 2.23) no longer supply query_module() ABI.
71 # People who target 2.4 kernels would likely use older glibc (and older bbox).
72 echoscip-shell system . . echo. '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
73 echoscip-shell system . . echo. '# CONFIG_FEATURE_USE_BSS_TAIL is not set' >>.config
74 echoscip-shell system . . echo. '# CONFIG_DEBUG_SANITIZE is not set' >>.config
75 # 2018: current glibc versions no longer include rpc/rpc.h
76 echoscip-shell system . . echo. '# CONFIG_FEATURE_MOUNT_NFS is not set' >>.config
77 echoscip-shell system . . echo. '# CONFIG_FEATURE_INETD_RPC is not set' >>.config
78 fi
79
80 # If uclibc, build static, and remove some things
81 # likely to not work on uclibc.
82 if testscip-shell system . . test. x"$LIBC" = x"uclibc"; then
83 catscip-shell system . . cat. .config \
84 | grepscip-shell system . . grep. -v CONFIG_STATIC \
85 | grepscip-shell system . . grep. -v CONFIG_BUILD_LIBBUSYBOX \
86 | grepscip-shell system . . grep. -v CONFIG_PIE \
87 \
88 | grepscip-shell system . . grep. -v CONFIG_FEATURE_2_4_MODULES \
89 | grepscip-shell system . . grep. -v CONFIG_FEATURE_SYNC_FANCY \
90 | grepscip-shell system . . grep. -v CONFIG_NANDWRITE \
91 | grepscip-shell system . . grep. -v CONFIG_NANDDUMP \
92 | grepscip-shell system . . grep. -v CONFIG_BLKDISCARD \
93 | grepscip-shell system . . grep. -v CONFIG_NSENTER \
94 | grepscip-shell system . . grep. -v CONFIG_UNSHARE \
95 | grepscip-shell system . . grep. -v CONFIG_FALLOCATE \
96 | grepscip-shell system . . grep. -v CONFIG_UDHCPC6 \
97 | grepscip-shell system . . grep. -v CONFIG_NSLOOKUP \
98 | grepscip-shell system . . grep. -v CONFIG_ASH_INTERNAL_GLOB \
99 >.config.new
100 mvscip-shell system . . mv. .config.new .config
101 echoscip-shell system . . echo. 'CONFIG_STATIC=y' >>.config
102 echoscip-shell system . . echo. '# CONFIG_BUILD_LIBBUSYBOX is not set' >>.config
103 echoscip-shell system . . echo. '# CONFIG_PIE is not set' >>.config
104 echoscip-shell system . . echo. '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
105 echoscip-shell system . . echo. '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config
106 # My uclibc installation does not support some needed APIs...
107 echoscip-shell system . . echo. '# CONFIG_NANDWRITE is not set' >>.config
108 echoscip-shell system . . echo. '# CONFIG_NANDDUMP is not set' >>.config
109 echoscip-shell system . . echo. '# CONFIG_BLKDISCARD is not set' >>.config
110 echoscip-shell system . . echo. '# CONFIG_NSENTER is not set' >>.config
111 echoscip-shell system . . echo. '# CONFIG_UNSHARE is not set' >>.config
112 echoscip-shell system . . echo. '# CONFIG_FALLOCATE is not set' >>.config
113 echoscip-shell system . . echo. '# CONFIG_UDHCPC6 is not set' >>.config
114 echoscip-shell system . . echo. '# CONFIG_NSLOOKUP is not set' >>.config
115 echoscip-shell system . . echo. 'CONFIG_ASH_INTERNAL_GLOB=y' >>.config
116 fi
117
118 # If musl
119 if testscip-shell system . . test. x"$LIBC" = x"musl"; then
120 catscip-shell system . . cat. .config \
121 | grepscip-shell system . . grep. -v CONFIG_STATIC \
122 | grepscip-shell system . . grep. -v CONFIG_DEBUG_SANITIZE \
123 | grepscip-shell system . . grep. -v CONFIG_LFS \
124 | grepscip-shell system . . grep. -v CONFIG_EXTRA_COMPAT \
125 | grepscip-shell system . . grep. -v CONFIG_FEATURE_2_4_MODULES \
126 | grepscip-shell system . . grep. -v CONFIG_FEATURE_VI_REGEX_SEARCH \
127 | grepscip-shell system . . grep. -v CONFIG_FEATURE_MOUNT_NFS \
128 | grepscip-shell system . . grep. -v CONFIG_FEATURE_INETD_RPC \
129 >.config.new
130 mvscip-shell system . . mv. .config.new .config
131 echoscip-shell system . . echo. 'CONFIG_STATIC=y' >>.config
132 # "error: cannot specify -static with -fsanitize=address":
133 echoscip-shell system . . echo. '# CONFIG_DEBUG_SANITIZE is not set' >>.config
134 # with LFS off, uoff_t will have wrong width:
135 echoscip-shell system . . echo. 'CONFIG_LFS=y' >>.config
136 echoscip-shell system . . echo. '# CONFIG_EXTRA_COMPAT is not set' >>.config
137 echoscip-shell system . . echo. '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
138 echoscip-shell system . . echo. '# CONFIG_FEATURE_VI_REGEX_SEARCH is not set' >>.config
139 echoscip-shell system . . echo. '# CONFIG_FEATURE_MOUNT_NFS is not set' >>.config
140 echoscip-shell system . . echo. '# CONFIG_FEATURE_INETD_RPC is not set' >>.config
141 fi
142
143 # If STATIC, remove some things.
144 # PAM with static linking is probably pointless
145 # (but I need to try - now I don't have libpam.a on my system, only libpam.so)
146 if grepscip-shell system . . grep. -q "^CONFIG_STATIC=y" .config; then
147 catscip-shell system . . cat. .config \
148 | grepscip-shell system . . grep. -v CONFIG_PAM \
149 >.config.new
150 mvscip-shell system . . mv. .config.new .config
151 echoscip-shell system . . echo. '# CONFIG_PAM is not set' >>.config
152 fi
153
154 # Regenerate .config with default answers for yanked-off options
155 # (most of default answers are "no").
156 { yesscip-shell system . . yes. "" | makescip-shell system . . make. oldconfig >/dev/nullscip-shell filesystem . . `/dev/null`.; } || { echoscip-shell system . . echo. "oldconfig error"; exit 1; }
157
158 # Build!
159 nicescip-shell system . . nice. -n 10 make $MAKEOPTS 2>&1 | teescip-shell system . . tee. make.log
160 grepscip-shell system . . grep. 'Rerun make' make.log \
161 && nicescip-shell system . . nice. -n 10 make $MAKEOPTS 2>&1 | teescip-shell system . . tee. -a make.log
162
163 # Return exitcode 1 if busybox executable does not exist
164 testscip-shell system . . test. -x busybox