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

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

Include automated test for, and fix, bug in thread_alloc.

speed_compare.sh: fix old version of make test command.
alloc_global.sh: original version of test before totally automated.
reachable.sh: add copyright.
thread_alloc.hpp: fix bug, fix documentation of return_memory.

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1# $Id: test_one.sh.in 2307 2012-03-21 19:13:44Z 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#                     Common 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#
36cmd="g++ test_one.cpp $*
37        -o test_one.exe
38        -g -Wall -ansi -pedantic-errors -Wshadow
39        -std=c++98
40        -DCPPAD_ADOLC_TEST
41        -DCPPAD_OPENMP_TEST
42        @OPENMP_FLAGS@
43        -I..
44"
45if [ -e @ADOLC_DIR@/include ]
46then
47        cmd="$cmd -I@ADOLC_DIR@/include"
48fi
49if [ -e @IPOPT_DIR@/include ]
50then
51        cmd="$cmd -I@IPOPT_DIR@/include"
52fi
53for lib in lib lib64
54do
55        if [ -e @ADOLC_DIR@/$lib ]
56        then
57                cmd="$cmd -L@ADOLC_DIR@/$lib -ladolc"
58                export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:@ADOLC_DIR@/$lib"
59        fi
60        if [ -e @IPOPT_DIR@/$lib ]
61        then
62                cmd="$cmd -L@IPOPT_DIR@/$lib -lipopt"
63                cmd="$cmd @FCLIBS@ @PTHREAD_LIB@ @DL_LIB@"
64                export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:@IPOPT_DIR@/$lib"
65        fi
66done
67if [ "$1" == 'ndebug.cpp' ]
68then
69        cmd="$cmd -DNDEBUG"
70fi
71echo $cmd
72$cmd
73echo "./test_one.exe"
74if ! ./test_one.exe
75then
76        exit 1
77fi
78exit 0
Note: See TracBrowser for help on using the repository browser.