source: checkcommits.sh@ 75d42a

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 75d42a was dcc228, checked in by Frederik Heber <heber@…>, 14 years ago

Added script to check all commits in a given range externally.

  • i.e. the repository is cloned and we go through every commit in the range by a respective git checkout including bootstrap, configure, make, and make check phase, both with and without debug.
  • Property mode set to 100755
File size: 4.4 KB
Line 
1#!/bin/bash
2#
3# This script checks each commit in a given interval by:
4# - checking out the commit in a clean manner
5# - compiling completely (with debug)
6# - running the testsuite
7# and rounding all up in a suitable log to tell what if went wrong.
8
9# check sufficiently given arguments
10if [ -z $4 ]; then
11 echo "Usage: $0 <source repo> <Path where to check> <first commit> <second commit> [...parameters for configure...]"
12 echo "This will check each of the commits in the inclusive interval [first, second]."
13 exit 255
14fi
15# check source
16SOURCEDIR=`realpath $1`
17shift
18if [ ! $? -eq 0 ]; then
19 echo "Please install realpath package!"
20 exit 128
21fi
22DIR=$1
23shift
24base=$1
25shift
26limit=$1
27shift
28
29# some variables
30LOG="`pwd`/commitcheck-${base}-${limit}"
31checkdir="commitchecking"
32cores=12
33
34# check whether base dir contains valid repo
35if [ ! -e $SOURCEDIR ]; then
36 echo "$SOURCEDIR does not exist!"
37 exit 255
38fi
39if [ ! -e $SOURCEDIR/HEAD ]; then
40 if [ ! -e $SOURCEDIR/.git ]; then
41 echo "$SOURCEDIR does not contain a git repository!" | tee -a ${LOG}.log
42 exit 255
43 else
44 SOURCEDIR="$SOURCEDIR/.git"
45 fi
46fi
47
48# check whether target is empty and create clone of git repo
49if [ -e $DIR ]; then
50 echo "Target directory $DIR must not be present!"
51 exit 255
52fi
53echo -e "#Begin of Logfile" >${LOG}.log
54git clone $SOURCEDIR $DIR | tee -a ${LOG}.log
55DIR=`realpath $DIR`
56
57# we are set go to target dir
58OLDDIR=`pwd`
59cd $DIR
60
61# check whether both given commit names are valid
62test=`git rev-list ${base}..${limit} &>/dev/null`
63if [ $? -eq 128 ]; then
64 # try with remote on either side
65 test=`git rev-list remotes/origin/${base}..${limit} &>/dev/null`
66 if [ $? -eq 128 ]; then
67 test=`git rev-list ${base}..remotes/origin/${limit} &>/dev/null`
68 if [ $? -eq 128 ]; then
69 test=`git rev-list remotes/origin/${base}..remotes/origin/${limit} &>/dev/null`
70 if [ $? -eq 128 ]; then
71 echo "At least one of the given commits ${base} or ${limit} does not exist!" | tee -a ${LOG}.log
72 exit 255
73 else
74 echo "Using remotes/origin/${base} instead of ${base} and remotes/origin/${limit} instead of ${limit}"
75 base="remotes/origin/${base}"
76 limit="remotes/origin/${limit}"
77 fi
78 else
79 echo "Using remotes/origin/${limit} instead of ${limit}."
80 limit="remotes/origin/${limit}"
81 fi
82 else
83 echo "Using remotes/origin/${base} instead of ${base}."
84 base="remotes/origin/${base}"
85 fi
86fi
87
88# calculate the number of commits
89commitscount=`git rev-list --no-merges ${base}..${limit} | wc -l`
90if [ $commitscount -eq 0 ]; then
91 echo "There are no commits to check!" | tee -a ${LOG}.log
92 echo "Maybe you have given first and second wrong way round?" | tee -a ${LOG}.log
93 echo "Remember: First has to be older than second." | tee -a ${LOG}.log
94 exit 1
95fi
96# DON't set limit for HEAD~: git starts counting at 0, wc however at 1, but git does not include last commit ${base} in the list!
97let commitlimit=$commitscount
98# and check whether it conincides with ${base}
99basecommitdescribe=`git describe ${base}`
100topcommitdescribe=`git describe ${limit}`
101basecommitdescribefromtop=`git describe ${limit}~${commitlimit}`
102if [ "$basecommitdescribe" != "$basecommitdescribefromtop" ]; then
103 echo "Something went wrong internally!" | tee -a ${LOG}.log
104 echo "Compared $basecommitdescribe with $basecommitdescribefromtop ..."
105 echo "The number of commits calculated in between does not lead to the base commit." | tee -a ${LOG}.log
106 exit 128
107fi
108
109# ============== PERFORMING CHECKS ==========================
110echo "We are checking all commits from ${base} to ${limit}." | tee -a ${LOG}.log
111echo "Base: ${basecommitdescribe}" | tee -a ${LOG}.log
112echo -e "Top: ${topcommitdescribe}\n" | tee -a ${LOG}.log
113# first fast overview without debug, then thorough with debug
114for debug_option in "--disable-debug" "--enable-debug"; do
115 i=${commitlimit}
116 while [ $i -ge 0 ]; do
117 let nr=${commitlimit}-$i
118 git checkout -f ${limit}~${i}
119 ./bootstrap
120 rm -rf $checkdir
121 mkdir -p $checkdir
122 cd $checkdir
123 echo "Now testing version `git describe --dirty --always` with $debug_option" &>${LOG}-${nr}.log
124 ../configure --prefix=${DIR}/$checkdir ${debug_option} "$@" &>>${LOG}-${nr}.log
125 make -k -j${cores} check &>>${LOG}-${nr}.log
126 if [ $? -gt 0 ]; then
127 echo -e "${nr}: `git describe --dirty --always`, ${debug_option}: FAILED." >>${LOG}.log
128 else
129 echo -e "${nr}: `git describe --dirty --always`, ${debug_option}: ok." >>${LOG}.log
130 fi
131 cd ..
132 ((i-=1));
133 done
134done
135# =================== DONE =================================
136
137echo -e "#End of Logfile" >>${LOG}.log
138cd $OLDDIR
139exit 0
Note: See TracBrowser for help on using the repository browser.