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

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

Working on getting jenkins.sh (with adolc) to run under cygwin.

get_adolc.sh: for cygwin: special edits version 2.3.0 and build static only.
get_colpack.sh: cygwin: build static only

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#! /bin/bash -e
2# $Id: test_one.sh.in 2940 2013-10-14 16:14:52Z 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# -----------------------------------------------------------------------------
13#
14# Run one of the tests
15if [ "$1" = "" ]
16then
17        echo "usage: test_one.sh file [extra]"
18        echo "file is the *.cpp file name with extension"
19        echo "and extra is extra options for g++ command"
20        exit 1
21fi
22if [ ! -e "$1" ]
23then
24        echo "Cannot find the file $1"
25        exit 1
26fi
27fun=`grep "^bool *[a-zA-Z0-9_]*( *void *)" $1 | tail -1 | \
28        sed -e "s/^bool *\([a-zA-Z0-9_]*\) *( *void *)/\1/"`
29if [ -e test_one.exe ]
30then
31        rm test_one.exe
32fi
33sed < test_more.cpp > test_one.cpp \
34-e '/ok *\&= *Run( /d' \
35-e "s/.*This line is used by test_one.sh.*/     ok \&= Run( $fun, \"$fun\");/" 
36#
37#
38if echo "$fun" | grep 'eigen' > /dev/null
39then
40        cxxflags='-g -Wall -ansi -pedantic-errors -Wno-long-long'
41else
42        cxxflags='-g -Wall -ansi -pedantic-errors -Wshadow'
43fi
44cmd="g++ test_one.cpp $*
45        -o test_one.exe
46        $cxxflags
47        -std=c++11
48        -DCPPAD_ADOLC_TEST
49        -DCPPAD_OPENMP_TEST
50        -DCPPAD_MAX_NUM_THREADS=1
51        @OPENMP_FLAGS@
52        -I..
53"
54if [ -e @adolc_prefix@/include ]
55then
56        cmd="$cmd -I@adolc_prefix@/include"
57fi
58if [ -e @eigen_prefix@/include ]
59then
60        cmd="$cmd -I@eigen_prefix@/include"
61fi
62for lib in lib lib64
63do
64        if [ -e @adolc_prefix@/$lib ]
65        then
66                cmd="$cmd -L@adolc_prefix@/$lib -ladolc -lColPack"
67                export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:@adolc_prefix@/$lib"
68        fi
69        if [ -e @ipopt_prefix@/$lib/pkgconfig ]
70        then
71                export PKG_CONFIG_PATH="@ipopt_prefix@/$lib/pkgconfig"
72                cflags=`pkg-config --cflags ipopt |
73                        sed -e 's|/coin$|/|' -e 's|/coin | |'`
74                libs=`pkg-config --libs ipopt`
75                cmd="$cmd $cflags $libs"
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.