source: trunk/bin/check_all.sh @ 2683

Last change on this file since 2683 was 2683, checked in by bradbell, 7 years ago

Merge ipopt_solve branch into trunk

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1#! /bin/bash -e
2# $Id: check_all.sh 2683 2012-12-30 18:17:03Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 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_exec() {
19     echo $* 
20     eval $*
21}
22echo_exec_log() {
23        echo "$* >> check_all.log"
24        echo $* >> $top_srcdir/check_all.log
25        eval $* >> $top_srcdir/check_all.log
26}
27# circular shift program list and set program to first entry in list
28next_program() {
29        program_list=`echo "$program_list" | sed -e 's| *\([^ ]*\) *\(.*\)|\2 \1|'`
30        program=`echo "$program_list" | sed -e 's| *\([^ ]*\).*|\1|'`
31}
32if [ -e 'check_all.log' ]
33then
34        echo_exec rm check_all.log
35fi
36top_srcdir=`pwd`
37cmake_args=''
38if [ "$1" != "" ]
39then
40        if [ "$1" == '--verbose' ]
41        then
42                cmake_args="$cmake_args  -D CMAKE_VERBOSE_MAKEFILE=1"
43        else
44                echo 'usage: bin/check_all.sh: [--verbose]'
45                exit 1
46        fi
47fi
48# -----------------------------------------------------------------------------
49# Create package to run test in
50echo_exec bin/package.sh
51# -----------------------------------------------------------------------------
52# change into gpl version of package directory
53version=`bin/version.sh get`
54echo_exec cd work/cppad-$version
55# -----------------------------------------------------------------------------
56list="
57        check_all.log
58        $HOME/prefix/cppad
59        work
60"
61for name in $list
62do
63        if [ -e "$name" ]
64        then
65                echo_exec rm -r $name
66        fi
67done
68echo_exec mkdir work
69echo_exec cd work
70# -----------------------------------------------------------------------------
71cmake_args="$cmake_args  -D cmake_install_prefix=$HOME/prefix/cppad"
72if [ -d '/usr/include' ]
73then
74        cmake_args="$cmake_args -D cmake_install_includedirs=include"
75fi
76#
77if [ -d '/usr/share' ]
78then
79        cmake_args="$cmake_args -D cmake_install_datadir=share"
80fi
81#
82if [ -d '/usr/lib64' ]
83then
84        cmake_args="$cmake_args -D cmake_install_libdirs='lib64;lib'"
85elif [ -d '/usr/lib' ]
86then
87        cmake_args="$cmake_args -D cmake_install_libdirs='lib;lib64'"
88fi
89for package in adolc eigen ipopt fadbad sacado
90do
91        dir=$HOME/prefix/$package
92        if [ -d "$dir" ]
93        then
94                cmake_args="$cmake_args  -D ${package}_prefix=$dir"
95        fi
96done
97cmake_args="$cmake_args -D cppad_sparse_list=YES"
98cmake_args="$cmake_args -D cppad_testvector=boost"
99cmake_args="$cmake_args -D cppad_tape_id_type='unsigned int'"
100cmake_args="$cmake_args -D cppad_tape_addr_type=int"
101cmake_args="$cmake_args -D cppad_max_num_threads=48"
102cmake_args="$cmake_args -D cppad_documentation=YES"
103cmake_args="$cmake_args -D cppad_cxx_flags=\
104'-Wall -ansi -pedantic-errors -std=c++98 -Wshadow'"
105#
106#
107echo_exec_log cmake $cmake_args ..
108# -----------------------------------------------------------------------------
109echo_exec_log make check
110# -----------------------------------------------------------------------------
111skip=''
112list='
113        cppad_ipopt/example/example_ipopt_nlp
114        cppad_ipopt/speed/speed_ipopt_nlp
115        cppad_ipopt/test/test_more_ipopt_nlp
116        example/example
117        example/ipopt_solve/example_ipopt_solve
118        introduction/exp_apx/introduction_exp_apx
119        introduction/get_started/introduction_get_started
120        speed/example/speed_example
121        test_more/test_more
122'
123#
124# standard tests
125for program in $list
126do
127        if [ ! -e "$program" ]
128        then
129                skip="$skip $program"
130        else
131                echo_exec_log $program 
132        fi
133done
134#
135# speed tests
136for dir in adolc cppad double fadbad sacado profile
137do
138        program="speed/$dir/speed_${dir}"
139        if [ ! -e "$program" ]
140        then
141                skip="$skip $program"
142        else
143                echo_exec_log $program correct 54321
144                echo_exec_log $program correct 54321 retape
145        fi
146done
147#
148# multi_thread tests
149# ----------------------------------------------------------------------------
150program_list=''
151for dir in bthread openmp pthread
152do
153        program="multi_thread/${dir}/${dir}_test"
154        if [ ! -e $program ]
155        then
156                skip="$skip $program"
157        else
158                program_list="$program_list $program"
159                #
160                # fast cases, test for all programs
161                echo_exec_log ./$program a11c
162                echo_exec_log ./$program simple_ad
163                echo_exec_log ./$program team_example
164        fi
165done
166if [ "$program_list" != '' ]
167then
168        # test_time=1,max_thread=4,mega_sum=1
169        next_program
170        echo_exec_log ./$program harmonic 1 4 1
171        #
172        # test_time=2,max_thread=4,num_zero=20,num_sub=30,num_sum=500,use_ad=true
173        next_program
174        echo_exec_log ./$program multi_newton 2 4 20 30 500 true
175        #
176        # case that failed in the past
177        next_program
178        echo_exec_log ./$program multi_newton 1 1 100 700 1 true
179        #
180        # case that failed in the past
181        next_program
182        echo_exec_log ./$program multi_newton 1 2 3 12 1 true
183fi
184#
185# print_for test
186if [ ! -e 'print_for/print_for' ]
187then
188        skip="$skip print_for/print_for"
189else
190        echo_exec_log print_for/print_for
191        print_for/print_for | sed -e '/^Test passes/,$d' > junk.1.$$
192        print_for/print_for | sed -e '1,/^Test passes/d' > junk.2.$$
193        if diff junk.1.$$ junk.2.$$
194        then
195                rm junk.1.$$ junk.2.$$
196                echo "print_for: OK"  >> $top_srcdir/check_all.log
197        else
198                echo "print_for: Error"  >> $top_srcdir/check_all.log
199                exit 1
200        fi
201fi
202#
203echo_exec_log make install
204#
205if [ "$skip" != '' ]
206then
207        echo "check_all.sh: skip = $skip"
208        exit 1
209fi
210#
211echo 'check_all.sh: OK'
212exit 0
Note: See TracBrowser for help on using the repository browser.