source: trunk/example/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: 1.9 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# 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
26# determine the function name
27fun=`grep "^bool *[a-zA-Z0-9_]*( *void *)" $1 | tail -1 | \
28        sed -e "s/^bool *\([a-zA-Z0-9_]*\) *( *void *)/\1/"`
29#
30if [ -e test_one.exe ]
31then
32        rm test_one.exe
33fi
34if [ -e test_one.cpp ]
35then
36        rm test_one.cpp
37fi
38sed < example.cpp > test_one.cpp \
39-e '/ok *\&= *Run( /d' \
40-e "s/.*This line is used by test_one.sh.*/     ok \&= Run( $fun, \"$fun\");/" 
41#
42if echo "$fun" | grep 'eigen' > /dev/null
43then
44        cxxflags='-g -Wall -ansi -pedantic-errors -Wno-long-long'
45else
46        cxxflags='-g -Wall -ansi -pedantic-errors -Wshadow'
47fi
48cmd="g++ test_one.cpp $*
49        -o test_one.exe
50        $cxxflags
51        -g
52        -fopenmp
53        -lboost_thread-mt
54        -lpthread
55        -std=c++11 -DCPPAD_ADOLC_EXAMPLES -DCPPAD_EIGEN_EXAMPLES
56        -I..
57"
58if [ -e @adolc_prefix@/include ]
59then
60        cmd="$cmd -I@adolc_prefix@/include"
61fi
62if [ -e @eigen_prefix@/include ]
63then
64        cmd="$cmd -I@eigen_prefix@/include"
65fi
66for lib in lib lib64
67do
68        if [ -e @adolc_prefix@/$lib ]
69        then
70                cmd="$cmd -L@adolc_prefix@/$lib -ladolc -lColPack"
71                export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:@adolc_prefix@/$lib"
72        fi
73done
74echo $cmd
75$cmd
76#
77echo "./test_one.exe"
78if ! ./test_one.exe
79then
80        exit 1
81fi
82exit 0
Note: See TracBrowser for help on using the repository browser.