source: trunk/bin/check_all.sh @ 2873

Last change on this file since 2873 was 2873, checked in by bradbell, 6 years ago

Check for and abort if warnings occur during compliation.

svn_ignore.sh: ignore file used for catching warnings.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1#! /bin/bash -e
2# $Id: check_all.sh 2873 2013-07-29 05:15:13Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
5#
6# CppAD is distributed under multiple licenses. This distribution is under
7# the terms of the
8#                     Eclipse Public License Version 1.0.
9#
10# A copy of this license is included in the COPYING file of this distribution.
11# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
12# -----------------------------------------------------------------------------
13if [ ! -e "bin/check_all.sh" ]
14then
15        echo "bin/check_all.sh: must be executed from its parent directory"
16        exit 1
17fi
18echo_log_eval() {
19        echo $*
20        echo $* >> $top_srcdir/check_all.log
21        if ! eval $* >> $top_srcdir/check_all.log 2> $top_srcdir/check_all.err
22        then
23                cat $top_srcdir/check_all.err
24                echo 'Error: see check_all.log'
25                exit 1
26        fi
27        msg=`cat $top_srcdir/check_all.err`
28        cat $top_srcdir/check_all.err
29        rm $top_srcdir/check_all.err
30        if [ "$msg" != '' ]
31        then
32                exit 1
33        fi
34}
35log_eval() {
36        echo $* >> $top_srcdir/check_all.log
37        if ! eval $* >> $top_srcdir/check_all.log
38        then
39                echo "Error: check check_all.log"
40                exit 1
41        fi
42}
43if [ -e check_all.log ]
44then
45        echo "rm check_all.log"
46        rm check_all.log
47fi
48top_srcdir=`pwd`
49# ---------------------------------------------------------------------------
50# circular shift program list and set program to first entry in list
51next_program() {
52        program_list=`echo "$program_list" | sed -e 's| *\([^ ]*\) *\(.*\)|\2 \1|'`
53        program=`echo "$program_list" | sed -e 's| *\([^ ]*\).*|\1|'`
54}
55# ---------------------------------------------------------------------------
56# Create package to run test in
57echo "bin/package.sh"
58bin/package.sh
59# -----------------------------------------------------------------------------
60# choose which tarball to use for testing
61version=`bin/version.sh get`
62echo_log_eval cd build
63list=( `ls cppad-$version.*.tgz` )
64if [ "${#list[@]}" == '1' ]
65then
66        tarball="${list[0]}"
67        skip="$skip other_tarball"
68else
69        choice=`echo $RANDOM % 2 | bc`
70        tarball="${list[$choice]}"
71fi
72echo_log_eval rm -r cppad-$version
73echo_log_eval tar -xzf $tarball
74echo_log_eval cd cppad-$version
75# -----------------------------------------------------------------------------
76list="
77        $HOME/prefix/cppad
78        build
79"
80for name in $list
81do
82        if [ -e "$name" ]
83        then
84                echo_log_eval rm -r $name
85        fi
86done
87echo_log_eval bin/run_cmake.sh
88echo_log_eval cd build
89# -----------------------------------------------------------------------------
90echo_log_eval make check
91# -----------------------------------------------------------------------------
92skip=''
93list='
94        cppad_ipopt/example/example_ipopt_nlp
95        cppad_ipopt/speed/speed_ipopt_nlp
96        cppad_ipopt/test/test_more_ipopt_nlp
97        example/example
98        example/ipopt_solve/example_ipopt_solve
99        introduction/exp_apx/introduction_exp_apx
100        introduction/get_started/introduction_get_started
101        speed/example/speed_example
102        test_more/test_more
103'
104#
105# standard tests
106for program in $list
107do
108        if [ ! -e "$program" ]
109        then
110                skip="$skip $program"
111        else
112                echo_log_eval $program 
113        fi
114done
115#
116# speed tests
117for dir in adolc cppad double fadbad sacado profile
118do
119        program="speed/$dir/speed_${dir}"
120        if [ ! -e "$program" ]
121        then
122                skip="$skip $program"
123        else
124                echo_log_eval $program correct 54321
125                echo_log_eval $program correct 54321 retape
126        fi
127done
128#
129# multi_thread tests
130# ----------------------------------------------------------------------------
131program_list=''
132for dir in bthread openmp pthread
133do
134        program="multi_thread/${dir}/${dir}_test"
135        if [ ! -e $program ]
136        then
137                skip="$skip $program"
138        else
139                program_list="$program_list $program"
140                #
141                # fast cases, test for all programs
142                echo_log_eval ./$program a11c
143                echo_log_eval ./$program simple_ad
144                echo_log_eval ./$program team_example
145        fi
146done
147if [ "$program_list" != '' ]
148then
149        # test_time=1,max_thread=4,mega_sum=1
150        next_program
151        echo_log_eval ./$program harmonic 1 4 1
152        #
153        # test_time=2,max_thread=4,num_zero=20,num_sub=30,num_sum=500,use_ad=true
154        next_program
155        echo_log_eval ./$program multi_newton 2 4 20 30 500 true
156        #
157        # case that failed in the past
158        next_program
159        echo_log_eval ./$program multi_newton 1 1 100 700 1 true
160        #
161        # case that failed in the past
162        next_program
163        echo_log_eval ./$program multi_newton 1 2 3 12 1 true
164fi
165#
166# print_for test
167if [ ! -e 'print_for/print_for' ]
168then
169        skip="$skip print_for/print_for"
170else
171        echo_log_eval print_for/print_for
172        print_for/print_for | sed -e '/^Test passes/,$d' > junk.1.$$
173        print_for/print_for | sed -e '1,/^Test passes/d' > junk.2.$$
174        if diff junk.1.$$ junk.2.$$
175        then
176                rm junk.1.$$ junk.2.$$
177                echo_log_eval echo "print_for: OK" 
178        else
179                echo_log_eval echo "print_for: Error"
180                exit 1
181        fi
182fi
183#
184echo_log_eval make install
185#
186if [ "$skip" != '' ]
187then
188        echo_log_eval echo "check_all.sh: skip = $skip"
189        exit 1
190fi
191#
192echo_log_eval echo 'check_all.sh: OK'
193exit 0
Note: See TracBrowser for help on using the repository browser.