1842 |
02 Mar 09 |
peter |
# $Id$ |
1842 |
02 Mar 09 |
peter |
2 |
|
4312 |
16 Feb 23 |
peter |
# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2023 Peter Johansson |
1842 |
02 Mar 09 |
peter |
4 |
# |
1842 |
02 Mar 09 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
1842 |
02 Mar 09 |
peter |
6 |
# |
1842 |
02 Mar 09 |
peter |
# The yat library is free software; you can redistribute it |
1842 |
02 Mar 09 |
peter |
# and/or modify it under the terms of the GNU General Public License as |
1842 |
02 Mar 09 |
peter |
# published by the Free Software Foundation; either version 3 of the |
1842 |
02 Mar 09 |
peter |
# License, or (at your option) any later version. |
1842 |
02 Mar 09 |
peter |
11 |
# |
1842 |
02 Mar 09 |
peter |
# The yat library is distributed in the hope that it will be useful, |
1842 |
02 Mar 09 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1842 |
02 Mar 09 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1842 |
02 Mar 09 |
peter |
# General Public License for more details. |
1842 |
02 Mar 09 |
peter |
16 |
# |
1842 |
02 Mar 09 |
peter |
# You should have received a copy of the GNU General Public License |
1842 |
02 Mar 09 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
1842 |
02 Mar 09 |
peter |
19 |
|
3036 |
03 Jun 13 |
peter |
20 |
. test/defs.sh || exit 99 |
1854 |
07 Mar 09 |
peter |
21 |
|
1851 |
05 Mar 09 |
peter |
22 |
echo "=== Running $me ===" |
1847 |
04 Mar 09 |
peter |
23 |
|
3036 |
03 Jun 13 |
peter |
24 |
check_requirements |
2692 |
28 Feb 12 |
peter |
25 |
|
4312 |
16 Feb 23 |
peter |
# Some tests run 'make distcheck', which issues chmod a-w on files. If |
4312 |
16 Feb 23 |
peter |
# test fails and files are left as read-only, a simple 'rm -rf' fails |
4312 |
16 Feb 23 |
peter |
# and we use this blurp from Automake's $(am__remove_distdir) |
4312 |
16 Feb 23 |
peter |
29 |
if test -d $test_dir; then |
4312 |
16 Feb 23 |
peter |
30 |
find $test_dir -type d ! -perm -200 -exec chmod u+w {} ';' \ |
4312 |
16 Feb 23 |
peter |
31 |
&& rm -rf $test_dir/* \ |
4312 |
16 Feb 23 |
peter |
32 |
|| { sleep 5 && rm -rf $test_dir/*; } |
4312 |
16 Feb 23 |
peter |
33 |
fi |
4312 |
16 Feb 23 |
peter |
34 |
|
3036 |
03 Jun 13 |
peter |
35 |
$mkdir_p $test_dir |
1842 |
02 Mar 09 |
peter |
36 |
|
2943 |
04 Jan 13 |
peter |
# Taken from Automake 1.11 tests/defs.sh.in |
2943 |
04 Jan 13 |
peter |
38 |
|
2943 |
04 Jan 13 |
peter |
# Unset some MAKE... variables that may cause 'make' to act like a |
2943 |
04 Jan 13 |
peter |
# recursively invoked sub-make. Any 'make' invocation in a test is |
2943 |
04 Jan 13 |
peter |
# conceptually an independent invocation, not part of the main |
2943 |
04 Jan 13 |
peter |
# 'yat' build. |
2943 |
04 Jan 13 |
peter |
43 |
unset MFLAGS |
2943 |
04 Jan 13 |
peter |
44 |
unset MAKEFLAGS |
2943 |
04 Jan 13 |
peter |
45 |
unset MAKELEVEL |
2943 |
04 Jan 13 |
peter |
46 |
unset DESTDIR |
2943 |
04 Jan 13 |
peter |
47 |
unset V |
2943 |
04 Jan 13 |
peter |
48 |
unset TESTS |
2943 |
04 Jan 13 |
peter |
49 |
unset TEST_LOGS |
2943 |
04 Jan 13 |
peter |
50 |
unset RECHECK_LOGS |
2943 |
04 Jan 13 |
peter |
51 |
unset VERBOSE |
2943 |
04 Jan 13 |
peter |
52 |
|
1934 |
30 Apr 09 |
peter |
53 |
cd $test_dir |
1854 |
07 Mar 09 |
peter |
54 |
|
2225 |
22 Mar 10 |
peter |
55 |
if (echo "$required" | grep autoconf > /dev/null); then |
1854 |
07 Mar 09 |
peter |
56 |
echo "creating configure.ac" |
2225 |
22 Mar 10 |
peter |
57 |
cat > configure.ac <<EOF |
1842 |
02 Mar 09 |
peter |
58 |
AC_INIT([hello],[1.0]) |
1842 |
02 Mar 09 |
peter |
59 |
AC_CONFIG_SRCDIR([hello.cc]) |
1842 |
02 Mar 09 |
peter |
60 |
AC_CONFIG_MACRO_DIR([m4]) |
1842 |
02 Mar 09 |
peter |
61 |
EOF |
2527 |
26 Jul 11 |
peter |
62 |
if (echo "$required" | grep automake > /dev/null); then |
2527 |
26 Jul 11 |
peter |
63 |
echo "AM_INIT_AUTOMAKE([foreign])" >> configure.ac |
2527 |
26 Jul 11 |
peter |
64 |
fi |
2225 |
22 Mar 10 |
peter |
65 |
if (echo "$required" | grep libtool > /dev/null); then |
2805 |
02 Aug 12 |
peter |
66 |
cat >> configure.ac << EOF |
2805 |
02 Aug 12 |
peter |
67 |
AC_LANG([C++]) |
2805 |
02 Aug 12 |
peter |
68 |
AC_PROG_CXXCPP |
2805 |
02 Aug 12 |
peter |
69 |
AC_PROG_CXX |
2805 |
02 Aug 12 |
peter |
70 |
AC_PROG_LIBTOOL |
2805 |
02 Aug 12 |
peter |
71 |
EOF |
2225 |
22 Mar 10 |
peter |
72 |
fi |
1842 |
02 Mar 09 |
peter |
73 |
|
2225 |
22 Mar 10 |
peter |
74 |
|
1854 |
07 Mar 09 |
peter |
75 |
echo "creating Makefile.am" |
2225 |
22 Mar 10 |
peter |
76 |
cat > Makefile.am <<EOF |
2543 |
04 Aug 11 |
peter |
77 |
ACLOCAL_AMFLAGS = -I m4 |
1842 |
02 Mar 09 |
peter |
78 |
AM_CPPFLAGS = \$(YAT_CPPFLAGS) |
1842 |
02 Mar 09 |
peter |
79 |
AM_CXXFLAGS = \$(YAT_CXXFLAGS) |
3018 |
04 Apr 13 |
peter |
80 |
AM_LDFLAGS = \$(YAT_LDFLAGS) |
1899 |
16 Apr 09 |
peter |
81 |
LDADD = \$(YAT_LDADD) |
1842 |
02 Mar 09 |
peter |
82 |
bin_PROGRAMS = hello |
1842 |
02 Mar 09 |
peter |
83 |
TESTS = hello |
1842 |
02 Mar 09 |
peter |
84 |
hello_SOURCES = hello.cc |
1842 |
02 Mar 09 |
peter |
85 |
EOF |
1842 |
02 Mar 09 |
peter |
86 |
|
1854 |
07 Mar 09 |
peter |
87 |
echo "creating hello.cc" |
2225 |
22 Mar 10 |
peter |
88 |
cat > hello.cc <<EOF |
1842 |
02 Mar 09 |
peter |
#include <yat/utility/Vector.h> |
1842 |
02 Mar 09 |
peter |
#include <yat/utility/version.h> |
1842 |
02 Mar 09 |
peter |
#include <algorithm> |
1842 |
02 Mar 09 |
peter |
#include <iostream> |
1842 |
02 Mar 09 |
peter |
#include <string> |
1842 |
02 Mar 09 |
peter |
94 |
int main(void) |
1842 |
02 Mar 09 |
peter |
95 |
{ |
1842 |
02 Mar 09 |
peter |
96 |
using namespace theplu::yat; |
3036 |
03 Jun 13 |
peter |
97 |
if (utility::version()!="$VERSION") { |
1842 |
02 Mar 09 |
peter |
98 |
std::cerr << "Incorrect version of linked libyat\n"; |
1842 |
02 Mar 09 |
peter |
99 |
return 1; |
1842 |
02 Mar 09 |
peter |
100 |
} |
1842 |
02 Mar 09 |
peter |
101 |
// testing something with gsl |
1842 |
02 Mar 09 |
peter |
102 |
utility::Vector v(10); |
2927 |
21 Dec 12 |
peter |
103 |
v.resize(120); |
1842 |
02 Mar 09 |
peter |
104 |
// testing something with boost |
1842 |
02 Mar 09 |
peter |
105 |
std::copy(v.begin(), v.begin()+10, v.begin()+10); |
1842 |
02 Mar 09 |
peter |
106 |
return 0; |
1842 |
02 Mar 09 |
peter |
107 |
} |
1842 |
02 Mar 09 |
peter |
108 |
EOF |
1918 |
24 Apr 09 |
peter |
109 |
fi #end of creation of autotool files |
1842 |
02 Mar 09 |
peter |
110 |
|
2454 |
29 Mar 11 |
peter |
# turn on shell traces |
2228 |
25 Mar 10 |
peter |
112 |
set -x |
2927 |
21 Dec 12 |
peter |
# remove old core dumps |
2927 |
21 Dec 12 |
peter |
114 |
rm -f core* |