Add installation script for phoronix-static.
[gcc-perf-regression-tester.git] / go.sh
blob7de9a27bcaac8442bbfe75568201de48f75a075f
1 #!/bin/bash -x
3 # Copyright (C) 2011 Sebastian Pop <sebpop@gmail.com>.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. A copy of this license
13 # can be downloaded from http://www.gnu.org/copyleft/gpl.html
15 # You can invoke this script like this:
16 # echo "1fda60c695b7a1bb7303f79a0b6d4b792db0efe0" | ./go.sh
17 # This will build GCC and start the scripts in the bmks directory with
18 # the default configuration.
20 # Invoke this script as a gearman worker like this:
21 # nohup gearman -h 10.236.48.91 -w -f tester ~/gcc/test/go.sh &
22 # then you can distribute work using a todo file like this:
23 # gearman -b -h 10.236.48.91 -n -f tester < todo
25 # the format of each line in the todo file is "key config email" with
26 # key a valid SHA1 object, config the symbolic name for the compiler
27 # options to be used. The minimal valid line contains only the SHA1
28 # key, the default config is ofast, and no email is sent. For example
29 # the following would be a valid line in the todo file:
30 # 820c090b60266f0102253822c3d108e05f135014 ofast foo@bar.com
32 # To retrieve a list of SHA1 for all the patches containing "config/i386"
33 # in the last 500 commits, use this command:
34 # git log --pretty=format:%H --grep="config/i386" HEAD~500..HEAD
36 # To fetch the tags from the test machines, one can use
37 # git fetch --tags testmachine
39 X=$HOME/gcc/test
40 usr=
41 key=
42 config=
43 procs=`cat /proc/cpuinfo | grep "processor" | sort | tail -1 | cut -d ':' -f2 | sed -e 's/ //g'`
44 procs=`echo "$procs + 1" | bc`
45 ulimit -t 10000
46 mkdir -p $X/log/
47 mkdir -p $X/usr/
49 if ! test -d $X/gcc/.git/; then
50 echo "Error: there is no GCC git repo in $X/gcc/."
51 exit 1
54 cd $X; git pull
55 cd $X/gcc; git pull
57 build_gcc () {
58 usr=$X/usr/$key
59 if test -x $usr/bin/gcc; then
60 return 0
63 cd $X/gcc
64 if ! git checkout $key; then
65 echo "Error: $key does not seem to be a valid SHA1 object in git repo $X/gcc/."
66 return 1
69 cd $X/gcc
70 rm -rf $X/gcc/build-test $usr
71 mkdir -p $X/gcc/build-test $usr
72 cd $X/gcc/build-test
73 ../configure --with-cloog --with-ppl --enable-cloog-backend=isl --prefix=$usr --disable-bootstrap --enable-languages=c,c++,fortran
74 if ! make -j$procs ; then
75 echo "Error: build of GCC failed."
76 return 1
78 if ! make install ; then
79 echo "Error: install of GCC failed."
80 return 1
84 read key config email
85 if ! build_gcc; then
86 exit 0
89 export LD_LIBRARY_PATH=$usr/lib64:$usr/lib:$LD_LIBRARY_PATH
90 export PATH=$usr/bin:$PATH
91 export CC=gcc
92 export CXX=g++
93 export FC=gfortran
94 export CPP=cpp
95 for d in `ls -d $X/bmks/*`; do
96 if test -x $d/go.sh; then
97 $d/go.sh $config $email
99 done