File: test_install.sh

package info (click to toggle)
cppad 2026.00.00.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,584 kB
  • sloc: cpp: 112,960; sh: 6,146; ansic: 179; python: 71; sed: 12; makefile: 10
file content (65 lines) | stat: -rwxr-xr-x 1,582 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/bash -e
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
cat << EOF
This is not a bug but rather a test of installing with
   cppad_prefix=$HOME/prefix
EOF
cat << EOF > bug.$$
# include <cppad/cppad.hpp>
int main(void)
{  bool ok = true;
   using std::cout;
   using CppAD::AD;
   //
   CPPAD_TESTVECTOR( AD<double> ) ax(1), ay(1);
   ax[0] = 1.0;
   CppAD::Independent(ax);
   ay[0] = sin( ax[0] );
   CppAD::ADFun<double> f(ax, ay);
   //
   std::vector< std::set<size_t> > p(1);
   p[0].insert(0);
   CppAD::vector< size_t > row(1), col(1);
   row[0] = 0;
   col[0] = 0;
   CppAD::sparse_jacobian_work work;
   work.color_method = "colpack";
   CPPAD_TESTVECTOR(double) x(1), jac(1);
   x[0] = 2.0;
   f.SparseJacobianForward(x, p, row, col, jac, work);
   //
   ok  &= jac[0] == std::cos( x[0] );
   //
   if( ok )
      return 0;
   return 1;
}
EOF
# -----------------------------------------------------------------------------
if [ ! -e build ]
then
   mkdir build
fi
cd build
echo "$0"
name=`echo $0 | sed -e 's|.*/||' -e 's|\..*||'`
mv ../bug.$$ $name.cpp
cmd="g++ -I $HOME/prefix/cppad/include --std=c++11 -g $name.cpp -o $name"
cmd="$cmd -L $HOME/prefix/cppad/lib64 -lcppad_lib"
cmd="$cmd -L $HOME/prefix/colpack/lib64 -lColPack"
echo "$cmd"
eval $cmd
#
echo "./$name"
if ! ./$name
then
   echo
   echo "$name.sh: Error"
   exit 1
fi
echo
echo "$name.sh: OK"
exit 0