source: trunk/test_more/test_one.sh.in @ 2506

Last change on this file since 2506 was 2506, checked in by bradbell, 8 years ago

Change Licenses: CPL-1.0 -> EPL-1.0, GPL-2.0->GPL-3.0

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1# $Id: test_one.sh.in 2506 2012-10-24 19:36:49Z bradbell $
2# -----------------------------------------------------------------------------
3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
4#
5# CppAD is distributed under multiple licenses. This distribution is under
6# the terms of the
7#                     Eclipse Public License Version 1.0.
8#
9# A copy of this license is included in the COPYING file of this distribution.
10# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11# -----------------------------------------------------------------------------
12#
13# Run one of the tests
14if [ "$1" = "" ]
15then
16        echo "usage: test_one.sh file [extra]"
17        echo "file is the *.cpp file name with extension"
18        echo "and extra is extra options for g++ command"
19        exit 1
20fi
21if [ ! -e "$1" ]
22then
23        echo "Cannot find the file $1"
24        exit 1
25fi
26fun=`grep "^bool *[a-zA-Z0-9_]*( *void *)" $1 | tail -1 | \
27        sed -e "s/^bool *\([a-zA-Z0-9_]*\) *( *void *)/\1/"`
28if [ -e test_one.exe ]
29then
30        rm test_one.exe
31fi
32sed < test_more.cpp > test_one.cpp \
33-e '/ok *\&= *Run( /d' \
34-e "s/.*This line is used by test_one.sh.*/     ok \&= Run( $fun, \"$fun\");/" 
35#
36#
37if echo "$fun" | grep 'eigen' > /dev/null
38then
39        cxxflags='-g -Wall -ansi -pedantic-errors -Wno-long-long'
40else
41        cxxflags='-g -Wall -ansi -pedantic-errors -Wshadow'
42fi
43cmd="g++ test_one.cpp $*
44        -o test_one.exe
45        $cxxflags
46        -std=c++98
47        -DCPPAD_ADOLC_TEST
48        -DCPPAD_OPENMP_TEST
49        @OPENMP_FLAGS@
50        -I..
51"
52if [ -e @ADOLC_DIR@/include ]
53then
54        cmd="$cmd -I@ADOLC_DIR@/include"
55fi
56if [ -e @EIGEN_DIR@/include ]
57then
58        cmd="$cmd -I@EIGEN_DIR@/include"
59fi
60if [ -e @IPOPT_DIR@/include ]
61then
62        cmd="$cmd -I@IPOPT_DIR@/include"
63fi
64for lib in lib lib64
65do
66        if [ -e @ADOLC_DIR@/$lib ]
67        then
68                cmd="$cmd -L@ADOLC_DIR@/$lib -ladolc"
69                export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:@ADOLC_DIR@/$lib"
70        fi
71        if [ -e @IPOPT_DIR@/$lib ]
72        then
73                cmd="$cmd -L@IPOPT_DIR@/$lib -lipopt"
74                cmd="$cmd @FCLIBS@ @PTHREAD_LIB@ @DL_LIB@"
75                export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:@IPOPT_DIR@/$lib"
76        fi
77done
78if [ "$1" == 'ndebug.cpp' ]
79then
80        cmd="$cmd -DNDEBUG"
81fi
82echo $cmd
83$cmd
84echo "./test_one.exe"
85if ! ./test_one.exe
86then
87        exit 1
88fi
89exit 0
Note: See TracBrowser for help on using the repository browser.