-
Notifications
You must be signed in to change notification settings - Fork 4
/
recompile-bash
29 lines (26 loc) · 1 KB
/
recompile-bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
set -e
echo debconf firebuild/license-accepted select true | debconf-set-selections
apt-get -yqq install firebuild
firebuild --version
for i in 1 2; do
rm -rf bash-*
apt-get source bash 2>&1
apt-get -yqq build-dep bash
(cd bash-* && /usr/bin/time -f "real${i}=%e\nuser${i}=%U\nsys${i}=%S" -a --output=../time.log firebuild -s -- sh -c "./configure && make -j4")
done
echo "Build times:"
cat time.log
# ./configure is harder to accelerate, but the second run should still be at least 80% faster
CPU_TIME_PERCENT2=$( (cat time.log ; echo "(user2+sys2)*100/(user1+sys1)") | bc)
echo "CPU time of the second build was ${CPU_TIME_PERCENT2}% of the first build"
case $(dpkg-architecture -q DEB_HOST_ARCH) in
armel)
# armel results typically just below 20%, while the hit rate is similar to other architectures'
[ $CPU_TIME_PERCENT2 -lt 30 ]
;;
*)
# 2nd builds are typically just below 10% of the first builds
[ $CPU_TIME_PERCENT2 -lt 20 ]
;;
esac