-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-buildfs
executable file
·50 lines (45 loc) · 1.53 KB
/
run-buildfs
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/bash
basedir=/data
path=$1
project=$2
with_strace=$3
iterations=$4
mkdir -p $basedir/$project
cd $path
echo $(pwd) > $basedir/$project/$project.path
debian/rules clean
debian/rules build
if [ ! -f Makefile ]; then
echo "Couln't find Makefile" > $basedir/$project/$project.warning
fi
make clean
for i in {1..$iterations}; do
if [ $with_strace -eq 0 ]; then
echo "Building the Make project $project without BuildFS..."
echo "Depending on the build, it may take some time (even hours). Bear with us..."
start_time=$(date +%s.%N)
make
elapsed_time=$(echo "$(date +%s.%N) - $start_time" | bc)
# Compute the time spent on build.
printf "%.2f\n" $elapsed_time >> $basedir/$project/base-build.time
else
sed -i -r 's/make/\$\(MAKE\)/' Makefile
echo "Building Make project $project with BuildFS..."
echo "Depending on the build, it may take some time (even hours). Bear with us..."
buildfs make-build \
-mode online \
-trace-file $basedir/$project/$project.strace \
-print-stats \
-build-dir "$(pwd)" > $basedir/$project/$project.faults 2> $basedir/$project/err
if [ ! -s $basedir/$project/err ]; then
rm $basedir/$project/err
# This is the build time using BuildFS...
btime=$(cat $basedir/$project/$project.faults |
grep -oP 'Analysis time: .*' |
sed -r 's/Analysis time: (.*)/\1/g')
echo $btime >> $basedir/$project/build-buildfs.times
make -pn > $basedir/$project/$project.makedb
fi
make clean
fi
done