Commit c935749f287c3d554149a267f3d9dba0186882ef

Authored by Jürgen Knödlseder
1 parent da7627a1

Support out of source builds (#1484)

ChangeLog
1 -2016-06-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> 1 +2016-07-04 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2
3 * Version 1.1.0 released 3 * Version 1.1.0 released
4 ========================= 4 =========================
@@ -61,6 +61,7 @@ @@ -61,6 +61,7 @@
61 Use GFilename in GFits to store filename (#1649) 61 Use GFilename in GFits to store filename (#1649)
62 Load CTA GTI extension from the HDU name provided by the DSS keyword (#1598) 62 Load CTA GTI extension from the HDU name provided by the DSS keyword (#1598)
63 Support Fermi LAT Pass 8 response functions (#1517) 63 Support Fermi LAT Pass 8 response functions (#1517)
  64 + Support out of source builds (#1484)
64 Finalize implementation of CTA On/Off fitting (#1044, #1781) 65 Finalize implementation of CTA On/Off fitting (#1044, #1781)
65 66
66 67
Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for GammaLib package #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Include M4 macros 22 # Include M4 macros
4 ACLOCAL_AMFLAGS = -I m4 23 ACLOCAL_AMFLAGS = -I m4
@@ -25,7 +44,7 @@ doc_DATA = \ @@ -25,7 +44,7 @@ doc_DATA = \
25 AUTHORS \ 44 AUTHORS \
26 ChangeLog \ 45 ChangeLog \
27 COPYING \ 46 COPYING \
28 - INSTALL \ 47 + INSTALL \
29 NEWS \ 48 NEWS \
30 README.md 49 README.md
31 docdir = ${datadir}/doc/${PACKAGE} 50 docdir = ${datadir}/doc/${PACKAGE}
@@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 1.1.0 @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 1.1.0
2 2
3 Author(s) : Juergen Knoedlseder 3 Author(s) : Juergen Knoedlseder
4 4
5 -24 June 2016 5 +4 July 2016
6 6
7 7
8 1. Introduction 8 1. Introduction
@@ -143,7 +143,7 @@ The interface for the following methods has been changed: @@ -143,7 +143,7 @@ The interface for the following methods has been changed:
143 143
144 3. Configuration 144 3. Configuration
145 ----------------- 145 -----------------
146 -None 146 +The GammaLib package now supports out of source builds (#1484).
147 147
148 148
149 4. Application module 149 4. Application module
configure.ac
@@ -76,14 +76,6 @@ AC_DEFINE_UNQUOTED([PACKAGE_PREFIX], &quot;${gammalib_prefix}&quot;, [Location where libra @@ -76,14 +76,6 @@ AC_DEFINE_UNQUOTED([PACKAGE_PREFIX], &quot;${gammalib_prefix}&quot;, [Location where libra
76 76
77 77
78 ############################################################################# 78 #############################################################################
79 -# Determine source directory for unit testing #  
80 -#############################################################################  
81 -PACKAGE_SOURCE=`pwd`  
82 -AC_DEFINE_UNQUOTED([PACKAGE_SOURCE], "${PACKAGE_SOURCE}", [Location where source is installed])  
83 -AC_SUBST(PACKAGE_SOURCE)  
84 -  
85 -  
86 -#############################################################################  
87 # Check for programs that are required by automake # 79 # Check for programs that are required by automake #
88 ############################################################################# 80 #############################################################################
89 AC_PROG_MAKE_SET 81 AC_PROG_MAKE_SET
@@ -563,7 +555,7 @@ esac @@ -563,7 +555,7 @@ esac
563 # Checks for optional instrument specific interfaces # 555 # Checks for optional instrument specific interfaces #
564 ############################################################################# 556 #############################################################################
565 # Checks for the existence of instrument specific interfaces 557 # Checks for the existence of instrument specific interfaces
566 -AC_CHECK_FILE([inst/README.md], 558 +AC_CHECK_FILE([$srcdir/inst/README.md],
567 [with_inst=yes], 559 [with_inst=yes],
568 [with_inst=no]) 560 [with_inst=no])
569 AM_CONDITIONAL([WITH_INST], [test "x$with_inst" = "xyes"]) 561 AM_CONDITIONAL([WITH_INST], [test "x$with_inst" = "xyes"])
@@ -575,7 +567,7 @@ AC_ARG_WITH([mwl], @@ -575,7 +567,7 @@ AC_ARG_WITH([mwl],
575 [], 567 [],
576 [with_mwl=yes]) 568 [with_mwl=yes])
577 if test "x$with_mwl" = "xyes"; then 569 if test "x$with_mwl" = "xyes"; then
578 - AC_CHECK_FILE([inst/mwl/README.md], 570 + AC_CHECK_FILE([$srcdir/inst/mwl/README.md],
579 [with_mwl=yes], 571 [with_mwl=yes],
580 [with_mwl=no]) 572 [with_mwl=no])
581 fi 573 fi
@@ -588,7 +580,7 @@ AC_ARG_WITH([cta], @@ -588,7 +580,7 @@ AC_ARG_WITH([cta],
588 [], 580 [],
589 [with_cta=yes]) 581 [with_cta=yes])
590 if test "x$with_cta" = "xyes"; then 582 if test "x$with_cta" = "xyes"; then
591 - AC_CHECK_FILE([inst/cta/README.md], 583 + AC_CHECK_FILE([$srcdir/inst/cta/README.md],
592 [with_cta=yes], 584 [with_cta=yes],
593 [with_cta=no]) 585 [with_cta=no])
594 fi 586 fi
@@ -601,7 +593,7 @@ AC_ARG_WITH([lat], @@ -601,7 +593,7 @@ AC_ARG_WITH([lat],
601 [], 593 [],
602 [with_lat=yes]) 594 [with_lat=yes])
603 if test "x$with_lat" = "xyes"; then 595 if test "x$with_lat" = "xyes"; then
604 - AC_CHECK_FILE([inst/lat/README.md], 596 + AC_CHECK_FILE([$srcdir/inst/lat/README.md],
605 [with_lat=yes], 597 [with_lat=yes],
606 [with_lat=no]) 598 [with_lat=no])
607 fi 599 fi
@@ -614,7 +606,7 @@ AC_ARG_WITH([com], @@ -614,7 +606,7 @@ AC_ARG_WITH([com],
614 [], 606 [],
615 [with_com=yes]) 607 [with_com=yes])
616 if test "x$with_com" = "xyes"; then 608 if test "x$with_com" = "xyes"; then
617 - AC_CHECK_FILE([inst/com/README.md], 609 + AC_CHECK_FILE([$srcdir/inst/com/README.md],
618 [with_com=yes], 610 [with_com=yes],
619 [with_com=no]) 611 [with_com=no])
620 fi 612 fi
@@ -1393,12 +1385,13 @@ AC_CONFIG_FILES([Makefile @@ -1393,12 +1385,13 @@ AC_CONFIG_FILES([Makefile
1393 include/Makefile 1385 include/Makefile
1394 test/Makefile 1386 test/Makefile
1395 test/test_python.sh 1387 test/test_python.sh
  1388 + test/test_examples.sh
  1389 + test/reports/Makefile
1396 pyext/Makefile 1390 pyext/Makefile
1397 pyext/setup.py 1391 pyext/setup.py
1398 pyext/gammalib/__init__.py 1392 pyext/gammalib/__init__.py
1399 examples/Makefile 1393 examples/Makefile
1400 examples/cpp/Makefile 1394 examples/cpp/Makefile
1401 - test/test_examples.sh  
1402 gammalib.pc 1395 gammalib.pc
1403 testconf.sh], 1396 testconf.sh],
1404 [if test -f test/test_python.sh; then chmod +x test/test_python.sh; fi; 1397 [if test -f test/test_python.sh; then chmod +x test/test_python.sh; fi;
examples/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for examples module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set sub directories 22 # Set sub directories
4 SUBDIRS = cpp 23 SUBDIRS = cpp
examples/cpp/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for example/cpp module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Darwin support 22 # Darwin support
4 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 23 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
@@ -29,40 +48,40 @@ check_PROGRAMS = createfits \ @@ -29,40 +48,40 @@ check_PROGRAMS = createfits \
29 createfits_SOURCES = createfits.cpp 48 createfits_SOURCES = createfits.cpp
30 createfits_LDFLAGS = @LDFLAGS@ 49 createfits_LDFLAGS = @LDFLAGS@
31 createfits_CPPFLAGS = @CPPFLAGS@ 50 createfits_CPPFLAGS = @CPPFLAGS@
32 -createfits_LDADD = $(top_srcdir)/src/libgamma.la 51 +createfits_LDADD = $(top_builddir)/src/libgamma.la
33 52
34 # Program definition 53 # Program definition
35 createskymap_SOURCES = createskymap.cpp 54 createskymap_SOURCES = createskymap.cpp
36 createskymap_LDFLAGS = @LDFLAGS@ 55 createskymap_LDFLAGS = @LDFLAGS@
37 createskymap_CPPFLAGS = @CPPFLAGS@ 56 createskymap_CPPFLAGS = @CPPFLAGS@
38 -createskymap_LDADD = $(top_srcdir)/src/libgamma.la 57 +createskymap_LDADD = $(top_builddir)/src/libgamma.la
39 58
40 # Program definition 59 # Program definition
41 createxml_SOURCES = createxml.cpp 60 createxml_SOURCES = createxml.cpp
42 createxml_LDFLAGS = @LDFLAGS@ 61 createxml_LDFLAGS = @LDFLAGS@
43 createxml_CPPFLAGS = @CPPFLAGS@ 62 createxml_CPPFLAGS = @CPPFLAGS@
44 -createxml_LDADD = $(top_srcdir)/src/libgamma.la 63 +createxml_LDADD = $(top_builddir)/src/libgamma.la
45 64
46 # Program definition 65 # Program definition
47 interpolate_SOURCES = interpolate.cpp 66 interpolate_SOURCES = interpolate.cpp
48 interpolate_LDFLAGS = @LDFLAGS@ 67 interpolate_LDFLAGS = @LDFLAGS@
49 interpolate_CPPFLAGS = @CPPFLAGS@ 68 interpolate_CPPFLAGS = @CPPFLAGS@
50 -interpolate_LDADD = $(top_srcdir)/src/libgamma.la 69 +interpolate_LDADD = $(top_builddir)/src/libgamma.la
51 70
52 # Program definition 71 # Program definition
53 numerics_SOURCES = numerics.cpp 72 numerics_SOURCES = numerics.cpp
54 numerics_LDFLAGS = @LDFLAGS@ 73 numerics_LDFLAGS = @LDFLAGS@
55 numerics_CPPFLAGS = @CPPFLAGS@ 74 numerics_CPPFLAGS = @CPPFLAGS@
56 -numerics_LDADD = $(top_srcdir)/src/libgamma.la 75 +numerics_LDADD = $(top_builddir)/src/libgamma.la
57 76
58 # Program definition 77 # Program definition
59 optimize_SOURCES = optimize.cpp 78 optimize_SOURCES = optimize.cpp
60 optimize_LDFLAGS = @LDFLAGS@ 79 optimize_LDFLAGS = @LDFLAGS@
61 optimize_CPPFLAGS = @CPPFLAGS@ 80 optimize_CPPFLAGS = @CPPFLAGS@
62 -optimize_LDADD = $(top_srcdir)/src/libgamma.la 81 +optimize_LDADD = $(top_builddir)/src/libgamma.la
63 82
64 # Program definition 83 # Program definition
65 readmodel_SOURCES = readmodel.cpp 84 readmodel_SOURCES = readmodel.cpp
66 readmodel_LDFLAGS = @LDFLAGS@ 85 readmodel_LDFLAGS = @LDFLAGS@
67 readmodel_CPPFLAGS = @CPPFLAGS@ 86 readmodel_CPPFLAGS = @CPPFLAGS@
68 -readmodel_LDADD = $(top_srcdir)/src/libgamma.la 87 +readmodel_LDADD = $(top_builddir)/src/libgamma.la
include/Makefile.am
  1 +#############################################################################
  2 +# Makefile.am for include module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
  21 +
1 # Define package included headers (to be installed) 22 # Define package included headers (to be installed)
2 pkginclude_HEADERS = GammaLib.hpp \ 23 pkginclude_HEADERS = GammaLib.hpp \
3 GTypemaps.hpp \ 24 GTypemaps.hpp \
inst/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for inst module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Detect configuration 22 # Detect configuration
4 if WITH_INST_CTA 23 if WITH_INST_CTA
inst/com/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for com module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Darwin support 22 # Darwin support
4 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 23 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
inst/com/test/test_COM.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * test_COM.cpp - test COM classes * 2 * test_COM.cpp - test COM classes *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 #endif 30 #endif
31 #include <stdlib.h> 31 #include <stdlib.h>
32 #include <unistd.h> 32 #include <unistd.h>
  33 +#include <cstdlib> // getenv
33 #include "GTools.hpp" 34 #include "GTools.hpp"
34 #include "test_COM.hpp" 35 #include "test_COM.hpp"
35 36
@@ -38,8 +39,9 @@ @@ -38,8 +39,9 @@
38 /* __ Globals ____________________________________________________________ */ 39 /* __ Globals ____________________________________________________________ */
39 40
40 /* __ Constants __________________________________________________________ */ 41 /* __ Constants __________________________________________________________ */
41 -const std::string datadir = PACKAGE_SOURCE"/inst/com/test/data";  
42 -const std::string com_caldb = PACKAGE_SOURCE"/inst/com/caldb"; 42 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  43 +const std::string datadir = srcdir + "/inst/com/test/data";
  44 +const std::string com_caldb = srcdir + "/inst/com/caldb";
43 const std::string com_iaq = "ENERG(1.0-3.0)MeV"; // 1-3 MeV 45 const std::string com_iaq = "ENERG(1.0-3.0)MeV"; // 1-3 MeV
44 const std::string com_dre = datadir+"/m50439_dre.fits"; // 1-3 MeV 46 const std::string com_dre = datadir+"/m50439_dre.fits"; // 1-3 MeV
45 const std::string com_drb = datadir+"/m34997_drg.fits"; 47 const std::string com_drb = datadir+"/m34997_drg.fits";
inst/cta/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for cta module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Darwin support 22 # Darwin support
4 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 23 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
inst/cta/test/data/irf_1dc.xml
1 <observation_list title="observation library"> 1 <observation_list title="observation library">
2 <observation name="Crab" id="000001" instrument="CTA"> 2 <observation name="Crab" id="000001" instrument="CTA">
3 <parameter name="CountsCube" file="crab_cntmap.fits"/> 3 <parameter name="CountsCube" file="crab_cntmap.fits"/>
4 - <parameter name="EffectiveArea" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/dc1/arf.fits"/>  
5 - <parameter name="PointSpreadFunction" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/dc1/psf_magic.fits"/>  
6 - <parameter name="EnergyDispersion" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/dc1/rmf.fits"/> 4 + <parameter name="EffectiveArea" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/dc1/arf.fits"/>
  5 + <parameter name="PointSpreadFunction" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/dc1/psf_magic.fits"/>
  6 + <parameter name="EnergyDispersion" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/dc1/rmf.fits"/>
7 <parameter name="Background" file=""/> 7 <parameter name="Background" file=""/>
8 </observation> 8 </observation>
9 </observation_list> 9 </observation_list>
inst/cta/test/data/irf_binned.xml
1 <observation_list title="observation library"> 1 <observation_list title="observation library">
2 <observation name="Crab" id="000001" instrument="CTA"> 2 <observation name="Crab" id="000001" instrument="CTA">
3 <parameter name="CountsCube" file="crab_cntmap.fits"/> 3 <parameter name="CountsCube" file="crab_cntmap.fits"/>
4 - <parameter name="EffectiveArea" file="$(PACKAGE_SOURCE)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>  
5 - <parameter name="PointSpreadFunction" file="$(PACKAGE_SOURCE)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>  
6 - <parameter name="EnergyDispersion" file="$(PACKAGE_SOURCE)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>  
7 - <parameter name="Background" file="$(PACKAGE_SOURCE)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/> 4 + <parameter name="EffectiveArea" file="$(TESTS_SRCDIR)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>
  5 + <parameter name="PointSpreadFunction" file="$(TESTS_SRCDIR)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>
  6 + <parameter name="EnergyDispersion" file="$(TESTS_SRCDIR)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>
  7 + <parameter name="Background" file="$(TESTS_SRCDIR)/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/>
8 </observation> 8 </observation>
9 </observation_list> 9 </observation_list>
inst/cta/test/data/irf_unbinned.xml
1 <observation_list title="observation library"> 1 <observation_list title="observation library">
2 <observation name="Crab" id="000001" instrument="CTA"> 2 <observation name="Crab" id="000001" instrument="CTA">
3 <parameter name="EventList" file="crab_events.fits"/> 3 <parameter name="EventList" file="crab_events.fits"/>
4 - <parameter name="EffectiveArea" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/cta_dummy_irf.dat"/>  
5 - <parameter name="PointSpreadFunction" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/cta_dummy_irf.dat"/>  
6 - <parameter name="EnergyDispersion" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/cta_dummy_irf.dat"/>  
7 - <parameter name="Background" file="$(PACKAGE_SOURCE)/inst/cta/test/caldb/cta_dummy_irf.dat"/> 4 + <parameter name="EffectiveArea" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/cta_dummy_irf.dat"/>
  5 + <parameter name="PointSpreadFunction" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/cta_dummy_irf.dat"/>
  6 + <parameter name="EnergyDispersion" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/cta_dummy_irf.dat"/>
  7 + <parameter name="Background" file="$(TESTS_SRCDIR)/inst/cta/test/caldb/cta_dummy_irf.dat"/>
8 </observation> 8 </observation>
9 </observation_list> 9 </observation_list>
inst/cta/test/test_CTA.cpp
@@ -29,9 +29,10 @@ @@ -29,9 +29,10 @@
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 #include <stdlib.h> 31 #include <stdlib.h>
  32 +#include <unistd.h>
32 #include <iostream> 33 #include <iostream>
33 #include <cmath> 34 #include <cmath>
34 -#include <unistd.h> 35 +#include <cstdlib> // getenv
35 #include "GCTALib.hpp" 36 #include "GCTALib.hpp"
36 #include "GTools.hpp" 37 #include "GTools.hpp"
37 #include "GNodeArray.hpp" 38 #include "GNodeArray.hpp"
@@ -46,8 +47,10 @@ @@ -46,8 +47,10 @@
46 /* __ Globals ____________________________________________________________ */ 47 /* __ Globals ____________________________________________________________ */
47 48
48 /* __ Constants __________________________________________________________ */ 49 /* __ Constants __________________________________________________________ */
49 -const std::string datadir = PACKAGE_SOURCE"/inst/cta/test/data";  
50 -const std::string cta_caldb = PACKAGE_SOURCE"/inst/cta/caldb"; 50 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  51 +const std::string datadir = srcdir+"/inst/cta/test/data";
  52 +const std::string caldbdir = srcdir+"/inst/cta/test/caldb";
  53 +const std::string cta_caldb = srcdir+"/inst/cta/caldb";
51 const std::string cta_irf = "cta_dummy_irf"; 54 const std::string cta_irf = "cta_dummy_irf";
52 const std::string cta_events = datadir+"/crab_events.fits"; 55 const std::string cta_events = datadir+"/crab_events.fits";
53 const std::string cta_events_gti = datadir+"/crab_events_gti.fits[EVENTS2]"; 56 const std::string cta_events_gti = datadir+"/crab_events_gti.fits[EVENTS2]";
@@ -59,12 +62,12 @@ const std::string cta_rsp_xml = datadir+&quot;/rsp_models.xml&quot;; @@ -59,12 +62,12 @@ const std::string cta_rsp_xml = datadir+&quot;/rsp_models.xml&quot;;
59 const std::string cta_cube_bgd_xml = datadir+"/cta_model_cube_bgd.xml"; 62 const std::string cta_cube_bgd_xml = datadir+"/cta_model_cube_bgd.xml";
60 const std::string cta_irf_bgd_xml = datadir+"/cta_model_irf_bgd.xml"; 63 const std::string cta_irf_bgd_xml = datadir+"/cta_model_irf_bgd.xml";
61 const std::string cta_aeff_bgd_xml = datadir+"/cta_model_aeff_bgd.xml"; 64 const std::string cta_aeff_bgd_xml = datadir+"/cta_model_aeff_bgd.xml";
62 -const std::string cta_caldb_king = PACKAGE_SOURCE"/inst/cta/caldb/data/cta/e/bcf/IFAE20120510_50h_King"; 65 +const std::string cta_caldb_king = cta_caldb+"/data/cta/e/bcf/IFAE20120510_50h_King";
63 const std::string cta_irf_king = "irf_file.fits"; 66 const std::string cta_irf_king = "irf_file.fits";
64 -const std::string cta_psf_table = PACKAGE_SOURCE"/inst/cta/test/caldb/psf_table.fits[PSF_2D_TABLE]";  
65 -const std::string cta_edisp_perf = PACKAGE_SOURCE"/inst/cta/test/caldb/cta_dummy_irf.dat";  
66 -const std::string cta_edisp_rmf = PACKAGE_SOURCE"/inst/cta/test/caldb/dc1/rmf.fits";  
67 -const std::string cta_edisp_2D = PACKAGE_SOURCE"/inst/cta/test/caldb/edisp_matrix.fits"; 67 +const std::string cta_psf_table = caldbdir+"/psf_table.fits[PSF_2D_TABLE]";
  68 +const std::string cta_edisp_perf = caldbdir+"/cta_dummy_irf.dat";
  69 +const std::string cta_edisp_rmf = caldbdir+"/dc1/rmf.fits";
  70 +const std::string cta_edisp_2D = caldbdir+"/edisp_matrix.fits";
68 const std::string cta_modbck_fit = datadir+"/bg_test.fits"; 71 const std::string cta_modbck_fit = datadir+"/bg_test.fits";
69 const std::string cta_point_table = datadir+"/crab_pointing.fits"; 72 const std::string cta_point_table = datadir+"/crab_pointing.fits";
70 73
inst/cta/test/test_CTA.py
@@ -17,8 +17,8 @@ @@ -17,8 +17,8 @@
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # 18 #
19 # ========================================================================== 19 # ==========================================================================
20 -import gammalib  
21 import os 20 import os
  21 +import gammalib
22 import math 22 import math
23 23
24 24
@@ -37,19 +37,25 @@ class Test(gammalib.GPythonTestSuite): @@ -37,19 +37,25 @@ class Test(gammalib.GPythonTestSuite):
37 # Call base class constructor 37 # Call base class constructor
38 gammalib.GPythonTestSuite.__init__(self) 38 gammalib.GPythonTestSuite.__init__(self)
39 39
40 - # Initialise CALDB  
41 - self.caldb = '../inst/cta/test/caldb' 40 + # Set directory base path
  41 + self.testdir(os.path.dirname(os.path.abspath(__file__)))
42 42
43 # Return 43 # Return
44 return 44 return
45 45
46 - # Define CALDB  
47 - def caldb_path(self, path): 46 + # Set test directory base path
  47 + def testdir(self, path):
48 """ 48 """
49 - Set path to calibration database for test. 49 + Set test directory base path
  50 +
  51 + Parameters
  52 + ----------
  53 + path : str
  54 + Test directory base path
50 """ 55 """
51 - # Set path  
52 - self.caldb = path 56 + # Set test data paths
  57 + self._caldb = path + '/caldb'
  58 + self._data = path + '/data'
53 59
54 # Return 60 # Return
55 return 61 return
@@ -78,7 +84,7 @@ class Test(gammalib.GPythonTestSuite): @@ -78,7 +84,7 @@ class Test(gammalib.GPythonTestSuite):
78 Test GCTAAeff classes. 84 Test GCTAAeff classes.
79 """ 85 """
80 # Test GCTAAeff2D file constructor 86 # Test GCTAAeff2D file constructor
81 - filename = self.caldb + '/prod1_gauss.fits' 87 + filename = self._caldb + '/prod1_gauss.fits'
82 aeff = gammalib.GCTAAeff2D(filename) 88 aeff = gammalib.GCTAAeff2D(filename)
83 89
84 # Test Aeff values 90 # Test Aeff values
@@ -106,7 +112,7 @@ class Test(gammalib.GPythonTestSuite): @@ -106,7 +112,7 @@ class Test(gammalib.GPythonTestSuite):
106 ' above maximum offset angle') 112 ' above maximum offset angle')
107 113
108 # Test GCTAAeffPerfTable file constructor 114 # Test GCTAAeffPerfTable file constructor
109 - filename = self.caldb + '/cta_dummy_irf.dat' 115 + filename = self._caldb + '/cta_dummy_irf.dat'
110 aeff = gammalib.GCTAAeffPerfTable(filename) 116 aeff = gammalib.GCTAAeffPerfTable(filename)
111 117
112 # Test Aeff values 118 # Test Aeff values
@@ -116,7 +122,7 @@ class Test(gammalib.GPythonTestSuite): @@ -116,7 +122,7 @@ class Test(gammalib.GPythonTestSuite):
116 self.test_value(aeff(1.0, 0.01745), 15838314971.2, 0.1) 122 self.test_value(aeff(1.0, 0.01745), 15838314971.2, 0.1)
117 123
118 # Test GCTAAeffArf file constructor 124 # Test GCTAAeffArf file constructor
119 - filename = self.caldb + '/dc1/arf.fits' 125 + filename = self._caldb + '/dc1/arf.fits'
120 aeff = gammalib.GCTAAeffArf(filename) 126 aeff = gammalib.GCTAAeffArf(filename)
121 127
122 # Test Aeff values 128 # Test Aeff values
@@ -134,7 +140,7 @@ class Test(gammalib.GPythonTestSuite): @@ -134,7 +140,7 @@ class Test(gammalib.GPythonTestSuite):
134 Test GCTAPsf classes. 140 Test GCTAPsf classes.
135 """ 141 """
136 # Test GCTAPsf2D file constructor 142 # Test GCTAPsf2D file constructor
137 - filename = self.caldb + '/prod1_gauss.fits' 143 + filename = self._caldb + '/prod1_gauss.fits'
138 psf = gammalib.GCTAPsf2D(filename) 144 psf = gammalib.GCTAPsf2D(filename)
139 145
140 # Test PSF values 146 # Test PSF values
@@ -146,7 +152,7 @@ class Test(gammalib.GPythonTestSuite): @@ -146,7 +152,7 @@ class Test(gammalib.GPythonTestSuite):
146 self.test_value(psf(0.001, 1.0, 0.01745), 111075.0692681, 1.0e-6) 152 self.test_value(psf(0.001, 1.0, 0.01745), 111075.0692681, 1.0e-6)
147 153
148 # Test GCTAPsfKing file constructor 154 # Test GCTAPsfKing file constructor
149 - filename = self.caldb + '/prod1_king.fits' 155 + filename = self._caldb + '/prod1_king.fits'
150 psf = gammalib.GCTAPsfKing(filename) 156 psf = gammalib.GCTAPsfKing(filename)
151 157
152 # Test PSF values 158 # Test PSF values
@@ -158,7 +164,7 @@ class Test(gammalib.GPythonTestSuite): @@ -158,7 +164,7 @@ class Test(gammalib.GPythonTestSuite):
158 self.test_value(psf(0.001, 1.0, 0.01745), 80272.5530008, 1.0e-6) 164 self.test_value(psf(0.001, 1.0, 0.01745), 80272.5530008, 1.0e-6)
159 165
160 # Test GCTAPsfPerfTable file constructor 166 # Test GCTAPsfPerfTable file constructor
161 - filename = self.caldb + '/cta_dummy_irf.dat' 167 + filename = self._caldb + '/cta_dummy_irf.dat'
162 psf = gammalib.GCTAPsfPerfTable(filename) 168 psf = gammalib.GCTAPsfPerfTable(filename)
163 169
164 # Test PSF values 170 # Test PSF values
@@ -170,7 +176,7 @@ class Test(gammalib.GPythonTestSuite): @@ -170,7 +176,7 @@ class Test(gammalib.GPythonTestSuite):
170 self.test_value(psf(0.001, 1.0, 0.01745), 22272.4258111, 1.0e-6) 176 self.test_value(psf(0.001, 1.0, 0.01745), 22272.4258111, 1.0e-6)
171 177
172 # Test GCTAPsfVector file constructor 178 # Test GCTAPsfVector file constructor
173 - filename = self.caldb + '/dc1/psf_magic.fits' 179 + filename = self._caldb + '/dc1/psf_magic.fits'
174 psf = gammalib.GCTAPsfVector(filename) 180 psf = gammalib.GCTAPsfVector(filename)
175 181
176 # Print 182 # Print
@@ -190,7 +196,7 @@ class Test(gammalib.GPythonTestSuite): @@ -190,7 +196,7 @@ class Test(gammalib.GPythonTestSuite):
190 Test GCTAEdisp classes. 196 Test GCTAEdisp classes.
191 """ 197 """
192 # Test GCTAEdispRmf file constructor 198 # Test GCTAEdispRmf file constructor
193 - filename = self.caldb + '/dc1/rmf.fits' 199 + filename = self._caldb + '/dc1/rmf.fits'
194 edisp = gammalib.GCTAEdispRmf(filename) 200 edisp = gammalib.GCTAEdispRmf(filename)
195 201
196 # Test energy dispersion values 202 # Test energy dispersion values
@@ -198,7 +204,7 @@ class Test(gammalib.GPythonTestSuite): @@ -198,7 +204,7 @@ class Test(gammalib.GPythonTestSuite):
198 self.test_value(edisp(math.log10(1),math.log10(30)), 0.0, 1.0e-9) 204 self.test_value(edisp(math.log10(1),math.log10(30)), 0.0, 1.0e-9)
199 205
200 # Test GCTAEdispPerfTable file constructor 206 # Test GCTAEdispPerfTable file constructor
201 - filename = self.caldb + '/cta_dummy_irf.dat' 207 + filename = self._caldb + '/cta_dummy_irf.dat'
202 edisp = gammalib.GCTAEdispPerfTable(filename) 208 edisp = gammalib.GCTAEdispPerfTable(filename)
203 209
204 # Test energy dispersion values 210 # Test energy dispersion values
@@ -210,7 +216,7 @@ class Test(gammalib.GPythonTestSuite): @@ -210,7 +216,7 @@ class Test(gammalib.GPythonTestSuite):
210 self.test_value(edisp(1.001, 1.0, 0.0), 18.0463571212, 1.0e-6) 216 self.test_value(edisp(1.001, 1.0, 0.0), 18.0463571212, 1.0e-6)
211 217
212 # Test GCTAResponseIrf file constructor 218 # Test GCTAResponseIrf file constructor
213 - db = gammalib.GCaldb(self.caldb) 219 + db = gammalib.GCaldb(self._caldb)
214 irf = 'cta_dummy_irf' 220 irf = 'cta_dummy_irf'
215 rsp = gammalib.GCTAResponseIrf(irf, db) 221 rsp = gammalib.GCTAResponseIrf(irf, db)
216 222
@@ -237,7 +243,7 @@ class Test(gammalib.GPythonTestSuite): @@ -237,7 +243,7 @@ class Test(gammalib.GPythonTestSuite):
237 Test response classes 243 Test response classes
238 """ 244 """
239 # Load 1DC CTA observation (ARF, PSF, RMF) 245 # Load 1DC CTA observation (ARF, PSF, RMF)
240 - filename = self.caldb + '/../data/irf_1dc.xml' 246 + filename = self._data + '/irf_1dc.xml'
241 obs = gammalib.GObservations(filename) 247 obs = gammalib.GObservations(filename)
242 248
243 # Return 249 # Return
@@ -266,7 +272,7 @@ class Test(gammalib.GPythonTestSuite): @@ -266,7 +272,7 @@ class Test(gammalib.GPythonTestSuite):
266 gammalib.GEnergy(10.0, 'TeV')) 272 gammalib.GEnergy(10.0, 'TeV'))
267 273
268 # Create On/Off observations from CTA observations 274 # Create On/Off observations from CTA observations
269 - filename = self.caldb + '/../data/irf_unbinned.xml' 275 + filename = self._data + '/irf_unbinned.xml'
270 inobs = gammalib.GObservations(filename) 276 inobs = gammalib.GObservations(filename)
271 outobs = gammalib.GObservations() 277 outobs = gammalib.GObservations()
272 for run in inobs: 278 for run in inobs:
@@ -274,7 +280,7 @@ class Test(gammalib.GPythonTestSuite): @@ -274,7 +280,7 @@ class Test(gammalib.GPythonTestSuite):
274 outobs.append(onoff) 280 outobs.append(onoff)
275 281
276 # Load model container and attach it to the observations 282 # Load model container and attach it to the observations
277 - models = gammalib.GModels(self.caldb + '/../data/onoff_model.xml') 283 + models = gammalib.GModels(self._data + '/onoff_model.xml')
278 outobs.models(models) 284 outobs.models(models)
279 285
280 # Perform maximum likelihood fit 286 # Perform maximum likelihood fit
inst/lat/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for lat module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Darwin support 22 # Darwin support
4 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 23 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
inst/lat/test/test_LAT.cpp
@@ -29,8 +29,9 @@ @@ -29,8 +29,9 @@
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 #include <stdlib.h> 31 #include <stdlib.h>
32 -#include <iostream>  
33 #include <unistd.h> 32 #include <unistd.h>
  33 +#include <iostream>
  34 +#include <cstdlib> // getenv
34 #include "GLATLib.hpp" 35 #include "GLATLib.hpp"
35 #include "GTools.hpp" 36 #include "GTools.hpp"
36 #include "test_LAT.hpp" 37 #include "test_LAT.hpp"
@@ -40,11 +41,12 @@ @@ -40,11 +41,12 @@
40 /* __ Globals ____________________________________________________________ */ 41 /* __ Globals ____________________________________________________________ */
41 42
42 /* __ Constants __________________________________________________________ */ 43 /* __ Constants __________________________________________________________ */
43 -const std::string datadir = PACKAGE_SOURCE"/inst/lat/test/data";  
44 -const std::string lat_caldb = PACKAGE_SOURCE"/inst/lat/caldb";  
45 -const std::string dirPass6 = PACKAGE_SOURCE"/inst/lat/test/data/p6v3";  
46 -const std::string dirPass7 = PACKAGE_SOURCE"/inst/lat/test/data/p7v6";  
47 -const std::string dirPass8 = PACKAGE_SOURCE"/inst/lat/test/data/p8v2"; 44 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  45 +const std::string datadir = srcdir + "/inst/lat/test/data";
  46 +const std::string lat_caldb = srcdir + "/inst/lat/caldb";
  47 +const std::string dirPass6 = srcdir + "/inst/lat/test/data/p6v3";
  48 +const std::string dirPass7 = srcdir + "/inst/lat/test/data/p7v6";
  49 +const std::string dirPass8 = srcdir + "/inst/lat/test/data/p8v2";
48 50
49 51
50 /***********************************************************************//** 52 /***********************************************************************//**
inst/mwl/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for com module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Darwin support 22 # Darwin support
4 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ 23 MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
inst/mwl/test/test_MWL.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * test_MWL.cpp - Test multi-wavelength classes * 2 * test_MWL.cpp - Test multi-wavelength classes *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 #endif 30 #endif
31 #include <stdlib.h> 31 #include <stdlib.h>
32 #include <iostream> 32 #include <iostream>
  33 +#include <cstdlib> // getenv
33 #include "GMWLLib.hpp" 34 #include "GMWLLib.hpp"
34 #include "test_MWL.hpp" 35 #include "test_MWL.hpp"
35 36
@@ -38,12 +39,13 @@ @@ -38,12 +39,13 @@
38 /* __ Globals ____________________________________________________________ */ 39 /* __ Globals ____________________________________________________________ */
39 40
40 /* __ Constants __________________________________________________________ */ 41 /* __ Constants __________________________________________________________ */
41 -const std::string datadir = PACKAGE_SOURCE"/inst/mwl/test/data";  
42 -const std::string lat_crab_model = datadir+"/crab.xml";  
43 -const std::string lat_crab_fits = datadir+"/crab.fits";  
44 -const std::string crab_model = datadir+"/crab_mwl.xml";  
45 -const std::string crab_fits = datadir+"/crab_mwl.fits";  
46 -const std::string mwl_xml = datadir+"/obs_mwl.xml"; 42 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  43 +const std::string datadir = srcdir + "/inst/mwl/test/data";
  44 +const std::string lat_crab_model = datadir + "/crab.xml";
  45 +const std::string lat_crab_fits = datadir + "/crab.fits";
  46 +const std::string crab_model = datadir + "/crab_mwl.xml";
  47 +const std::string crab_fits = datadir + "/crab_mwl.fits";
  48 +const std::string mwl_xml = datadir + "/obs_mwl.xml";
47 49
48 50
49 /***********************************************************************//** 51 /***********************************************************************//**
@@ -55,8 +57,10 @@ void TestGMWL::set(void) @@ -55,8 +57,10 @@ void TestGMWL::set(void)
55 name("GMWL"); 57 name("GMWL");
56 58
57 // Append tests to test suite 59 // Append tests to test suite
58 - append(static_cast<pfunction>(&TestGMWL::test_obs), "Test observation handling");  
59 - append(static_cast<pfunction>(&TestGMWL::test_optimizer), "Test optimizer"); 60 + append(static_cast<pfunction>(&TestGMWL::test_obs),
  61 + "Test observation handling");
  62 + append(static_cast<pfunction>(&TestGMWL::test_optimizer),
  63 + "Test optimizer");
60 64
61 // Return 65 // Return
62 return; 66 return;
pyext/Makefile.am
@@ -150,7 +150,7 @@ if IS_ELCAPITAN @@ -150,7 +150,7 @@ if IS_ELCAPITAN
150 echo "Post process module "$$f; \ 150 echo "Post process module "$$f; \
151 install_name_tool -change $(libdir)/libgamma.2.dylib @rpath/libgamma.2.dylib $$f; \ 151 install_name_tool -change $(libdir)/libgamma.2.dylib @rpath/libgamma.2.dylib $$f; \
152 install_name_tool -add_rpath $(libdir) $$f; \ 152 install_name_tool -add_rpath $(libdir) $$f; \
153 - install_name_tool -add_rpath $(abs_top_srcdir)/src/.libs $$f; \ 153 + install_name_tool -add_rpath $(abs_top_builddir)/src/.libs $$f; \
154 done 154 done
155 endif 155 endif
156 156
@@ -176,14 +176,14 @@ swig: $(BUILT_SOURCES) @@ -176,14 +176,14 @@ swig: $(BUILT_SOURCES)
176 176
177 # General rule for core modules 177 # General rule for core modules
178 %_wrap.cpp %.py: %.i 178 %_wrap.cpp %.py: %.i
179 - if $(SWIGCOMPILE) -MMD -MF "$*.Tpi" -o $@ -outdir gammalib $<; \ 179 + if $(SWIGCOMPILE) -MMD -MF "$*.Tpi" -I$(top_srcdir)/pyext -o $@ -outdir gammalib $<; \
180 then mv -f "$*.Tpi" "$*.Pi"; else rm -f "$*.Tpi"; exit 1; fi 180 then mv -f "$*.Tpi" "$*.Pi"; else rm -f "$*.Tpi"; exit 1; fi
181 181
182 # Rule for MWL module 182 # Rule for MWL module
183 if WITH_INST_MWL 183 if WITH_INST_MWL
184 gammalib/mwl.py: gammalib/mwl_wrap.cpp 184 gammalib/mwl.py: gammalib/mwl_wrap.cpp
185 gammalib/mwl_wrap.cpp: $(top_srcdir)/inst/mwl/pyext/mwl.i 185 gammalib/mwl_wrap.cpp: $(top_srcdir)/inst/mwl/pyext/mwl.i
186 - if $(SWIGCOMPILE) -MMD -MF "gammalib/mwl.Tpi" -o gammalib/mwl_wrap.cpp -outdir gammalib $<; \ 186 + if $(SWIGCOMPILE) -MMD -MF "gammalib/mwl.Tpi" -I$(top_srcdir)/pyext -o gammalib/mwl_wrap.cpp -outdir gammalib $<; \
187 then mv -f "gammalib/mwl.Tpi" "gammalib/mwl.Pi"; else rm -f "gammalib/mwl.Tpi"; exit 1; fi 187 then mv -f "gammalib/mwl.Tpi" "gammalib/mwl.Pi"; else rm -f "gammalib/mwl.Tpi"; exit 1; fi
188 endif 188 endif
189 189
@@ -191,7 +191,7 @@ endif @@ -191,7 +191,7 @@ endif
191 if WITH_INST_CTA 191 if WITH_INST_CTA
192 gammalib/cta.py: gammalib/cta_wrap.cpp 192 gammalib/cta.py: gammalib/cta_wrap.cpp
193 gammalib/cta_wrap.cpp: $(top_srcdir)/inst/cta/pyext/cta.i 193 gammalib/cta_wrap.cpp: $(top_srcdir)/inst/cta/pyext/cta.i
194 - if $(SWIGCOMPILE) -MMD -MF "gammalib/cta.Tpi" -o gammalib/cta_wrap.cpp -outdir gammalib $<; \ 194 + if $(SWIGCOMPILE) -MMD -MF "gammalib/cta.Tpi" -I$(top_srcdir)/pyext -o gammalib/cta_wrap.cpp -outdir gammalib $<; \
195 then mv -f "gammalib/cta.Tpi" "gammalib/cta.Pi"; else rm -f "gammalib/cta.Tpi"; exit 1; fi 195 then mv -f "gammalib/cta.Tpi" "gammalib/cta.Pi"; else rm -f "gammalib/cta.Tpi"; exit 1; fi
196 endif 196 endif
197 197
@@ -199,7 +199,7 @@ endif @@ -199,7 +199,7 @@ endif
199 if WITH_INST_LAT 199 if WITH_INST_LAT
200 gammalib/lat.py: gammalib/lat_wrap.cpp 200 gammalib/lat.py: gammalib/lat_wrap.cpp
201 gammalib/lat_wrap.cpp: $(top_srcdir)/inst/lat/pyext/lat.i 201 gammalib/lat_wrap.cpp: $(top_srcdir)/inst/lat/pyext/lat.i
202 - if $(SWIGCOMPILE) -MMD -MF "gammalib/lat.Tpi" -o gammalib/lat_wrap.cpp -outdir gammalib $<; \ 202 + if $(SWIGCOMPILE) -MMD -MF "gammalib/lat.Tpi" -I$(top_srcdir)/pyext -o gammalib/lat_wrap.cpp -outdir gammalib $<; \
203 then mv -f "gammalib/lat.Tpi" "gammalib/lat.Pi"; else rm -f "gammalib/lat.Tpi"; exit 1; fi 203 then mv -f "gammalib/lat.Tpi" "gammalib/lat.Pi"; else rm -f "gammalib/lat.Tpi"; exit 1; fi
204 endif 204 endif
205 205
@@ -207,7 +207,7 @@ endif @@ -207,7 +207,7 @@ endif
207 if WITH_INST_COM 207 if WITH_INST_COM
208 gammalib/com.py: gammalib/com_wrap.cpp 208 gammalib/com.py: gammalib/com_wrap.cpp
209 gammalib/com_wrap.cpp: $(top_srcdir)/inst/com/pyext/com.i 209 gammalib/com_wrap.cpp: $(top_srcdir)/inst/com/pyext/com.i
210 - if $(SWIGCOMPILE) -MMD -MF "gammalib/com.Tpi" -o gammalib/com_wrap.cpp -outdir gammalib $<; \ 210 + if $(SWIGCOMPILE) -MMD -MF "gammalib/com.Tpi" -I$(top_srcdir)/pyext -o gammalib/com_wrap.cpp -outdir gammalib $<; \
211 then mv -f "gammalib/com.Tpi" "gammalib/com.Pi"; else rm -f "gammalib/com.Tpi"; exit 1; fi 211 then mv -f "gammalib/com.Tpi" "gammalib/com.Pi"; else rm -f "gammalib/com.Tpi"; exit 1; fi
212 endif 212 endif
213 213
src/Makefile.am
1 -## Process this file with automake to produce Makefile.in  
2 -  
3 -# we use srcdir/src for "private" includes  
4 -# we use srcdir/include for the static global include files  
5 -# we use builddir/src for the generated include files to get found 1 +#############################################################################
  2 +# Makefile.am for source module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
6 21
7 INCLUDES = -I$(top_srcdir)/include \ 22 INCLUDES = -I$(top_srcdir)/include \
8 -I$(top_builddir)/src \ 23 -I$(top_builddir)/src \
src/app/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for app module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/base/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for base module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/fits/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for fits module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/linalg/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for linalg module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/model/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for model module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/numerics/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for numerics module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/obs/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for obs module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/opt/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for opt module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/sky/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for sky module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/support/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for support module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/test/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for test module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/vo/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for vo module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/xml/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for xml module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
src/xspec/Makefile.am
1 -## Process this file with automake to produce Makefile.in 1 +#############################################################################
  2 +# Makefile.am for xspec module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
2 21
3 # Set include directories 22 # Set include directories
4 INCLUDES = -I$(top_srcdir)/include \ 23 INCLUDES = -I$(top_srcdir)/include \
test/Makefile.am
1 -## Process this file with automake to produce Makefile.in  
2 -  
3 -# we use srcdir/src for "private" includes  
4 -# we use srcdir/include for the static global include files  
5 -# we use builddir/src for the generated include files to get found 1 +#############################################################################
  2 +# Makefile.am for unit test module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
6 21
7 # Optional instrument specific tests 22 # Optional instrument specific tests
8 if WITH_INST_MWL 23 if WITH_INST_MWL
@@ -12,7 +27,7 @@ if WITH_INST_MWL @@ -12,7 +27,7 @@ if WITH_INST_MWL
12 test_MWL_SOURCES = $(top_srcdir)/inst/mwl/test/test_MWL.cpp 27 test_MWL_SOURCES = $(top_srcdir)/inst/mwl/test/test_MWL.cpp
13 test_MWL_LDFLAGS = @LDFLAGS@ 28 test_MWL_LDFLAGS = @LDFLAGS@
14 test_MWL_CPPFLAGS = @CPPFLAGS@ 29 test_MWL_CPPFLAGS = @CPPFLAGS@
15 - test_MWL_LDADD = $(top_srcdir)/src/libgamma.la 30 + test_MWL_LDADD = $(top_builddir)/src/libgamma.la
16 endif 31 endif
17 if WITH_INST_CTA 32 if WITH_INST_CTA
18 INST_CTA = test_CTA 33 INST_CTA = test_CTA
@@ -21,7 +36,7 @@ if WITH_INST_CTA @@ -21,7 +36,7 @@ if WITH_INST_CTA
21 test_CTA_SOURCES = $(top_srcdir)/inst/cta/test/test_CTA.cpp 36 test_CTA_SOURCES = $(top_srcdir)/inst/cta/test/test_CTA.cpp
22 test_CTA_LDFLAGS = @LDFLAGS@ 37 test_CTA_LDFLAGS = @LDFLAGS@
23 test_CTA_CPPFLAGS = @CPPFLAGS@ 38 test_CTA_CPPFLAGS = @CPPFLAGS@
24 - test_CTA_LDADD = $(top_srcdir)/src/libgamma.la 39 + test_CTA_LDADD = $(top_builddir)/src/libgamma.la
25 endif 40 endif
26 if WITH_INST_LAT 41 if WITH_INST_LAT
27 INST_LAT = test_LAT 42 INST_LAT = test_LAT
@@ -30,7 +45,7 @@ if WITH_INST_LAT @@ -30,7 +45,7 @@ if WITH_INST_LAT
30 test_LAT_SOURCES = $(top_srcdir)/inst/lat/test/test_LAT.cpp 45 test_LAT_SOURCES = $(top_srcdir)/inst/lat/test/test_LAT.cpp
31 test_LAT_LDFLAGS = @LDFLAGS@ 46 test_LAT_LDFLAGS = @LDFLAGS@
32 test_LAT_CPPFLAGS = @CPPFLAGS@ 47 test_LAT_CPPFLAGS = @CPPFLAGS@
33 - test_LAT_LDADD = $(top_srcdir)/src/libgamma.la 48 + test_LAT_LDADD = $(top_builddir)/src/libgamma.la
34 endif 49 endif
35 if WITH_INST_COM 50 if WITH_INST_COM
36 INST_COM = test_COM 51 INST_COM = test_COM
@@ -39,7 +54,7 @@ if WITH_INST_COM @@ -39,7 +54,7 @@ if WITH_INST_COM
39 test_COM_SOURCES = $(top_srcdir)/inst/com/test/test_COM.cpp 54 test_COM_SOURCES = $(top_srcdir)/inst/com/test/test_COM.cpp
40 test_COM_LDFLAGS = @LDFLAGS@ 55 test_COM_LDFLAGS = @LDFLAGS@
41 test_COM_CPPFLAGS = @CPPFLAGS@ 56 test_COM_CPPFLAGS = @CPPFLAGS@
42 - test_COM_LDADD = $(top_srcdir)/src/libgamma.la 57 + test_COM_LDADD = $(top_builddir)/src/libgamma.la
43 endif 58 endif
44 59
45 # Optional python bindings 60 # Optional python bindings
@@ -82,7 +97,8 @@ check_PROGRAMS = test_GSupport \ @@ -82,7 +97,8 @@ check_PROGRAMS = test_GSupport \
82 # Set test environment (needed for linking with cfitsio and readline) 97 # Set test environment (needed for linking with cfitsio and readline)
83 TESTS_ENVIRONMENT = @RUNSHARED@=$(top_builddir)/src/.libs$(TEST_ENV_DIR):$(@RUNSHARED@) \ 98 TESTS_ENVIRONMENT = @RUNSHARED@=$(top_builddir)/src/.libs$(TEST_ENV_DIR):$(@RUNSHARED@) \
84 $(TEST_PYTHON_ENV) \ 99 $(TEST_PYTHON_ENV) \
85 - PACKAGE_SOURCE=$(PACKAGE_SOURCE) 100 + TESTS_SRCDIR=$(abs_top_srcdir) \
  101 + TESTS_BUILDDIR=$(abs_top_builddir)
86 102
87 # Tests (these are the tests to be executed) 103 # Tests (these are the tests to be executed)
88 TESTS = test_GSupport \ 104 TESTS = test_GSupport \
@@ -111,83 +127,82 @@ EXTRA_DIST = data reports testinst \ @@ -111,83 +127,82 @@ EXTRA_DIST = data reports testinst \
111 test_GSupport_SOURCES = test_GSupport.cpp test_GSupport.hpp 127 test_GSupport_SOURCES = test_GSupport.cpp test_GSupport.hpp
112 test_GSupport_LDFLAGS = @LDFLAGS@ 128 test_GSupport_LDFLAGS = @LDFLAGS@
113 test_GSupport_CPPFLAGS = @CPPFLAGS@ 129 test_GSupport_CPPFLAGS = @CPPFLAGS@
114 -test_GSupport_LDADD = $(top_srcdir)/src/libgamma.la 130 +test_GSupport_LDADD = $(top_builddir)/src/libgamma.la
115 # 131 #
116 test_GVector_SOURCES = test_GVector.cpp test_GVector.hpp 132 test_GVector_SOURCES = test_GVector.cpp test_GVector.hpp
117 test_GVector_LDFLAGS = @LDFLAGS@ 133 test_GVector_LDFLAGS = @LDFLAGS@
118 test_GVector_CPPFLAGS = @CPPFLAGS@ 134 test_GVector_CPPFLAGS = @CPPFLAGS@
119 -test_GVector_LDADD = $(top_srcdir)/src/libgamma.la 135 +test_GVector_LDADD = $(top_builddir)/src/libgamma.la
120 # 136 #
121 test_GMatrix_SOURCES = test_GMatrix.cpp test_GMatrix.hpp 137 test_GMatrix_SOURCES = test_GMatrix.cpp test_GMatrix.hpp
122 test_GMatrix_LDFLAGS = @LDFLAGS@ 138 test_GMatrix_LDFLAGS = @LDFLAGS@
123 test_GMatrix_CPPFLAGS = @CPPFLAGS@ 139 test_GMatrix_CPPFLAGS = @CPPFLAGS@
124 -test_GMatrix_LDADD = $(top_srcdir)/src/libgamma.la 140 +test_GMatrix_LDADD = $(top_builddir)/src/libgamma.la
125 # 141 #
126 test_GMatrixSparse_SOURCES = test_GMatrixSparse.cpp test_GMatrixSparse.hpp 142 test_GMatrixSparse_SOURCES = test_GMatrixSparse.cpp test_GMatrixSparse.hpp
127 test_GMatrixSparse_LDFLAGS = @LDFLAGS@ 143 test_GMatrixSparse_LDFLAGS = @LDFLAGS@
128 test_GMatrixSparse_CPPFLAGS = @CPPFLAGS@ 144 test_GMatrixSparse_CPPFLAGS = @CPPFLAGS@
129 -test_GMatrixSparse_LDADD = $(top_srcdir)/src/libgamma.la 145 +test_GMatrixSparse_LDADD = $(top_builddir)/src/libgamma.la
130 # 146 #
131 test_GMatrixSymmetric_SOURCES = test_GMatrixSymmetric.cpp test_GMatrixSymmetric.hpp 147 test_GMatrixSymmetric_SOURCES = test_GMatrixSymmetric.cpp test_GMatrixSymmetric.hpp
132 test_GMatrixSymmetric_LDFLAGS = @LDFLAGS@ 148 test_GMatrixSymmetric_LDFLAGS = @LDFLAGS@
133 test_GMatrixSymmetric_CPPFLAGS = @CPPFLAGS@ 149 test_GMatrixSymmetric_CPPFLAGS = @CPPFLAGS@
134 -test_GMatrixSymmetric_LDADD = $(top_srcdir)/src/libgamma.la 150 +test_GMatrixSymmetric_LDADD = $(top_builddir)/src/libgamma.la
135 # 151 #
136 test_GNumerics_SOURCES = test_GNumerics.cpp test_GNumerics.hpp 152 test_GNumerics_SOURCES = test_GNumerics.cpp test_GNumerics.hpp
137 test_GNumerics_LDFLAGS = @LDFLAGS@ 153 test_GNumerics_LDFLAGS = @LDFLAGS@
138 test_GNumerics_CPPFLAGS = @CPPFLAGS@ 154 test_GNumerics_CPPFLAGS = @CPPFLAGS@
139 -test_GNumerics_LDADD = $(top_srcdir)/src/libgamma.la 155 +test_GNumerics_LDADD = $(top_builddir)/src/libgamma.la
140 # 156 #
141 test_GFits_SOURCES = test_GFits.cpp test_GFits.hpp 157 test_GFits_SOURCES = test_GFits.cpp test_GFits.hpp
142 test_GFits_LDFLAGS = @LDFLAGS@ 158 test_GFits_LDFLAGS = @LDFLAGS@
143 test_GFits_CPPFLAGS = @CPPFLAGS@ 159 test_GFits_CPPFLAGS = @CPPFLAGS@
144 -test_GFits_LDADD = $(top_srcdir)/src/libgamma.la 160 +test_GFits_LDADD = $(top_builddir)/src/libgamma.la
145 # 161 #
146 test_GXml_SOURCES = test_GXml.cpp test_GXml.hpp 162 test_GXml_SOURCES = test_GXml.cpp test_GXml.hpp
147 test_GXml_LDFLAGS = @LDFLAGS@ 163 test_GXml_LDFLAGS = @LDFLAGS@
148 test_GXml_CPPFLAGS = @CPPFLAGS@ 164 test_GXml_CPPFLAGS = @CPPFLAGS@
149 -test_GXml_LDADD = $(top_srcdir)/src/libgamma.la 165 +test_GXml_LDADD = $(top_builddir)/src/libgamma.la
150 # 166 #
151 test_GVO_SOURCES = test_GVO.cpp test_GVO.hpp 167 test_GVO_SOURCES = test_GVO.cpp test_GVO.hpp
152 test_GVO_LDFLAGS = @LDFLAGS@ 168 test_GVO_LDFLAGS = @LDFLAGS@
153 test_GVO_CPPFLAGS = @CPPFLAGS@ 169 test_GVO_CPPFLAGS = @CPPFLAGS@
154 -test_GVO_LDADD = $(top_srcdir)/src/libgamma.la 170 +test_GVO_LDADD = $(top_builddir)/src/libgamma.la
155 # 171 #
156 test_GXspec_SOURCES = test_GXspec.cpp test_GXspec.hpp 172 test_GXspec_SOURCES = test_GXspec.cpp test_GXspec.hpp
157 test_GXspec_LDFLAGS = @LDFLAGS@ 173 test_GXspec_LDFLAGS = @LDFLAGS@
158 test_GXspec_CPPFLAGS = @CPPFLAGS@ 174 test_GXspec_CPPFLAGS = @CPPFLAGS@
159 -test_GXspec_LDADD = $(top_srcdir)/src/libgamma.la 175 +test_GXspec_LDADD = $(top_builddir)/src/libgamma.la
160 # 176 #
161 test_GApplication_SOURCES = test_GApplication.cpp test_GApplication.hpp 177 test_GApplication_SOURCES = test_GApplication.cpp test_GApplication.hpp
162 test_GApplication_LDFLAGS = @LDFLAGS@ 178 test_GApplication_LDFLAGS = @LDFLAGS@
163 test_GApplication_CPPFLAGS = @CPPFLAGS@ 179 test_GApplication_CPPFLAGS = @CPPFLAGS@
164 -test_GApplication_LDADD = $(top_srcdir)/src/libgamma.la 180 +test_GApplication_LDADD = $(top_builddir)/src/libgamma.la
165 # 181 #
166 test_GModel_SOURCES = test_GModel.cpp test_GModel.hpp 182 test_GModel_SOURCES = test_GModel.cpp test_GModel.hpp
167 test_GModel_LDFLAGS = @LDFLAGS@ 183 test_GModel_LDFLAGS = @LDFLAGS@
168 test_GModel_CPPFLAGS = @CPPFLAGS@ 184 test_GModel_CPPFLAGS = @CPPFLAGS@
169 -test_GModel_LDADD = $(top_srcdir)/src/libgamma.la 185 +test_GModel_LDADD = $(top_builddir)/src/libgamma.la
170 # 186 #
171 test_GSky_SOURCES = test_GSky.cpp test_GSky.hpp 187 test_GSky_SOURCES = test_GSky.cpp test_GSky.hpp
172 test_GSky_LDFLAGS = @LDFLAGS@ 188 test_GSky_LDFLAGS = @LDFLAGS@
173 test_GSky_CPPFLAGS = @CPPFLAGS@ 189 test_GSky_CPPFLAGS = @CPPFLAGS@
174 -test_GSky_LDADD = $(top_srcdir)/src/libgamma.la 190 +test_GSky_LDADD = $(top_builddir)/src/libgamma.la
175 # 191 #
176 test_GOptimizer_SOURCES = test_GOptimizer.cpp test_GOptimizer.hpp 192 test_GOptimizer_SOURCES = test_GOptimizer.cpp test_GOptimizer.hpp
177 test_GOptimizer_LDFLAGS = @LDFLAGS@ 193 test_GOptimizer_LDFLAGS = @LDFLAGS@
178 test_GOptimizer_CPPFLAGS = @CPPFLAGS@ 194 test_GOptimizer_CPPFLAGS = @CPPFLAGS@
179 -test_GOptimizer_LDADD = $(top_srcdir)/src/libgamma.la 195 +test_GOptimizer_LDADD = $(top_builddir)/src/libgamma.la
180 # 196 #
181 test_GObservation_SOURCES = test_GObservation.cpp test_GObservation.hpp 197 test_GObservation_SOURCES = test_GObservation.cpp test_GObservation.hpp
182 test_GObservation_LDFLAGS = @LDFLAGS@ 198 test_GObservation_LDFLAGS = @LDFLAGS@
183 test_GObservation_CPPFLAGS = @CPPFLAGS@ 199 test_GObservation_CPPFLAGS = @CPPFLAGS@
184 -test_GObservation_LDADD = $(top_srcdir)/src/libgamma.la 200 +test_GObservation_LDADD = $(top_builddir)/src/libgamma.la
185 201
186 # Add Valgrind rule 202 # Add Valgrind rule
187 # 203 #
188 valgrind: 204 valgrind:
189 - @export PACKAGE_SOURCE=$(PACKAGE_SOURCE) ; \  
190 - if type valgrind >/dev/null 2>&1; then \ 205 + @if type valgrind >/dev/null 2>&1; then \
191 cd .. ; \ 206 cd .. ; \
192 ln -s test/data data ; \ 207 ln -s test/data data ; \
193 mkdir reports ; \ 208 mkdir reports ; \
test/reports/Makefile.am 0 → 100644
  1 +#############################################################################
  2 +# Makefile.am for unit test reports module #
  3 +# ------------------------------------------------------------------------- #
  4 +# Copyright (C) 2016 Juergen Knoedlseder #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# This program is free software: you can redistribute it and/or modify #
  8 +# it under the terms of the GNU General Public License as published by #
  9 +# the Free Software Foundation, either version 3 of the License, or #
  10 +# (at your option) any later version. #
  11 +# #
  12 +# This program is distributed in the hope that it will be useful, #
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  15 +# GNU General Public License for more details. #
  16 +# #
  17 +# You should have received a copy of the GNU General Public License #
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>. #
  19 +# #
  20 +#############################################################################
test/test_GApplication.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * test_GApplication.cpp - test GApplication classes * 2 * test_GApplication.cpp - test GApplication classes *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2015 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -42,10 +42,14 @@ void TestGApplication::set(void) @@ -42,10 +42,14 @@ void TestGApplication::set(void)
42 name("GApplication"); 42 name("GApplication");
43 43
44 // Append tests 44 // Append tests
45 - append(static_cast<pfunction>(&TestGApplication::test_constructor), "Test GLog constructor");  
46 - append(static_cast<pfunction>(&TestGApplication::test_stream_logger), "Test stream logger");  
47 - append(static_cast<pfunction>(&TestGApplication::test_C_logger), "Test C logger");  
48 - append(static_cast<pfunction>(&TestGApplication::test_GApplicationPar), "Test GApplicationPar class"); 45 + append(static_cast<pfunction>(&TestGApplication::test_constructor),
  46 + "Test GLog constructor");
  47 + append(static_cast<pfunction>(&TestGApplication::test_stream_logger),
  48 + "Test stream logger");
  49 + append(static_cast<pfunction>(&TestGApplication::test_C_logger),
  50 + "Test C logger");
  51 + append(static_cast<pfunction>(&TestGApplication::test_GApplicationPar),
  52 + "Test GApplicationPar class");
49 53
50 // Return 54 // Return
51 return; 55 return;
test/test_GFits.py
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # 18 #
19 # ========================================================================== 19 # ==========================================================================
  20 +import os
20 import math 21 import math
21 import gammalib 22 import gammalib
22 23
@@ -58,8 +59,11 @@ class Test(gammalib.GPythonTestSuite): @@ -58,8 +59,11 @@ class Test(gammalib.GPythonTestSuite):
58 """ 59 """
59 Test GFile class interface. 60 Test GFile class interface.
60 """ 61 """
  62 + # Get test data directory
  63 + datadir = os.environ['TESTS_SRCDIR'] + '/test/data/'
  64 +
61 # Set test file names 65 # Set test file names
62 - file = gammalib.GFilename("data/file.fits") 66 + file = gammalib.GFilename(datadir+'file.fits')
63 67
64 # Test loading of FITS file 68 # Test loading of FITS file
65 self.test_try("Test GFits file load constructor") 69 self.test_try("Test GFits file load constructor")
test/test_GModel.cpp
@@ -28,10 +28,11 @@ @@ -28,10 +28,11 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
  31 +#include <stdlib.h>
31 #include <iostream> 32 #include <iostream>
32 #include <ostream> 33 #include <ostream>
33 #include <stdexcept> 34 #include <stdexcept>
34 -#include <stdlib.h> 35 +#include <cstdlib> // getenv
35 #include "test_GModel.hpp" 36 #include "test_GModel.hpp"
36 #include "GTools.hpp" 37 #include "GTools.hpp"
37 38
@@ -44,32 +45,39 @@ void TestGModel::set(void) @@ -44,32 +45,39 @@ void TestGModel::set(void)
44 // Set name 45 // Set name
45 name("GModel"); 46 name("GModel");
46 47
  48 + // Set test data directory
  49 + std::string datadir = std::string(std::getenv("TESTS_SRCDIR")) +
  50 + "/test/data/";
  51 +
47 // Set attributes 52 // Set attributes
48 - m_map_file = "data/cena_lobes_parkes.fits";  
49 - m_cube_file = "data/test_cube.fits";  
50 - m_xml_file = "data/crab.xml";  
51 - m_xml_model_point_const = "data/model_point_const.xml";  
52 - m_xml_model_point_gauss = "data/model_point_gauss.xml";  
53 - m_xml_model_point_plaw = "data/model_point_plaw.xml";  
54 - m_xml_model_point_plaw2 = "data/model_point_plaw2.xml";  
55 - m_xml_model_point_eplaw = "data/model_point_eplaw.xml";  
56 - m_xml_model_point_bplaw = "data/model_point_bplaw.xml";  
57 - m_xml_model_point_supeplaw = "data/model_point_supeplaw.xml";  
58 - m_xml_model_point_logparabola = "data/model_point_logparabola.xml";  
59 - m_xml_model_point_nodes = "data/model_point_nodes.xml";  
60 - m_xml_model_point_filefct = "data/model_point_filefct.xml";  
61 - m_xml_model_diffuse_const = "data/model_diffuse_const.xml";  
62 - m_xml_model_diffuse_cube = "data/model_diffuse_cube.xml";  
63 - m_xml_model_diffuse_map = "data/model_diffuse_map.xml";  
64 - m_xml_model_radial_disk = "data/model_radial_disk.xml";  
65 - m_xml_model_radial_gauss = "data/model_radial_gauss.xml";  
66 - m_xml_model_radial_shell = "data/model_radial_shell.xml";  
67 - m_xml_model_elliptical_disk = "data/model_elliptical_disk.xml";  
68 - m_xml_model_elliptical_gauss = "data/model_elliptical_gauss.xml"; 53 + m_map_file = datadir + "cena_lobes_parkes.fits";
  54 + m_cube_file = datadir + "test_cube.fits";
  55 + m_filefct = datadir + "filefunction.txt";
  56 + m_xml_file = datadir + "crab.xml";
  57 + m_xml_model_point_const = datadir + "model_point_const.xml";
  58 + m_xml_model_point_gauss = datadir + "model_point_gauss.xml";
  59 + m_xml_model_point_plaw = datadir + "model_point_plaw.xml";
  60 + m_xml_model_point_plaw2 = datadir + "model_point_plaw2.xml";
  61 + m_xml_model_point_eplaw = datadir + "model_point_eplaw.xml";
  62 + m_xml_model_point_bplaw = datadir + "model_point_bplaw.xml";
  63 + m_xml_model_point_supeplaw = datadir + "model_point_supeplaw.xml";
  64 + m_xml_model_point_logparabola = datadir + "model_point_logparabola.xml";
  65 + m_xml_model_point_nodes = datadir + "model_point_nodes.xml";
  66 + m_xml_model_point_filefct = datadir + "model_point_filefct.xml";
  67 + m_xml_model_diffuse_const = datadir + "model_diffuse_const.xml";
  68 + m_xml_model_diffuse_cube = datadir + "model_diffuse_cube.xml";
  69 + m_xml_model_diffuse_map = datadir + "model_diffuse_map.xml";
  70 + m_xml_model_radial_disk = datadir + "model_radial_disk.xml";
  71 + m_xml_model_radial_gauss = datadir + "model_radial_gauss.xml";
  72 + m_xml_model_radial_shell = datadir + "model_radial_shell.xml";
  73 + m_xml_model_elliptical_disk = datadir + "model_elliptical_disk.xml";
  74 + m_xml_model_elliptical_gauss = datadir + "model_elliptical_gauss.xml";
69 75
70 // Append tests 76 // Append tests
71 - append(static_cast<pfunction>(&TestGModel::test_model_par), "Test GModelPar");  
72 - append(static_cast<pfunction>(&TestGModel::test_sky_model), "Test GModelSky"); 77 + append(static_cast<pfunction>(&TestGModel::test_model_par),
  78 + "Test GModelPar");
  79 + append(static_cast<pfunction>(&TestGModel::test_sky_model),
  80 + "Test GModelSky");
73 81
74 // Append spatial model tests 82 // Append spatial model tests
75 append(static_cast<pfunction>(&TestGModel::test_point_source), 83 append(static_cast<pfunction>(&TestGModel::test_point_source),
@@ -94,20 +102,32 @@ void TestGModel::set(void) @@ -94,20 +102,32 @@ void TestGModel::set(void)
94 "Test spatial model XML I/O"); 102 "Test spatial model XML I/O");
95 103
96 // Append spectral model tests 104 // Append spectral model tests
97 - append(static_cast<pfunction>(&TestGModel::test_const), "Test GModelSpectralConst");  
98 - append(static_cast<pfunction>(&TestGModel::test_gauss), "Test GModelSpectralGauss");  
99 - append(static_cast<pfunction>(&TestGModel::test_plaw), "Test GModelSpectralPlaw");  
100 - append(static_cast<pfunction>(&TestGModel::test_plaw2), "Test GModelSpectralPlaw2");  
101 - append(static_cast<pfunction>(&TestGModel::test_eplaw), "Test GModelSpectralExpPlaw");  
102 - append(static_cast<pfunction>(&TestGModel::test_supeplaw), "Test GModelSpectralSuperExpPlaw");  
103 - append(static_cast<pfunction>(&TestGModel::test_bplaw), "Test GModelSpectralBrokenPlaw");  
104 - append(static_cast<pfunction>(&TestGModel::test_logparabola), "Test GModelSpectralLogParabola");  
105 - append(static_cast<pfunction>(&TestGModel::test_nodes), "Test GModelSpectralNodes");  
106 - append(static_cast<pfunction>(&TestGModel::test_filefct), "Test GModelSpectralFunc");  
107 - append(static_cast<pfunction>(&TestGModel::test_spectral_model), "Test spectral model XML I/O"); 105 + append(static_cast<pfunction>(&TestGModel::test_const),
  106 + "Test GModelSpectralConst");
  107 + append(static_cast<pfunction>(&TestGModel::test_gauss),
  108 + "Test GModelSpectralGauss");
  109 + append(static_cast<pfunction>(&TestGModel::test_plaw),
  110 + "Test GModelSpectralPlaw");
  111 + append(static_cast<pfunction>(&TestGModel::test_plaw2),
  112 + "Test GModelSpectralPlaw2");
  113 + append(static_cast<pfunction>(&TestGModel::test_eplaw),
  114 + "Test GModelSpectralExpPlaw");
  115 + append(static_cast<pfunction>(&TestGModel::test_supeplaw),
  116 + "Test GModelSpectralSuperExpPlaw");
  117 + append(static_cast<pfunction>(&TestGModel::test_bplaw),
  118 + "Test GModelSpectralBrokenPlaw");
  119 + append(static_cast<pfunction>(&TestGModel::test_logparabola),
  120 + "Test GModelSpectralLogParabola");
  121 + append(static_cast<pfunction>(&TestGModel::test_nodes),
  122 + "Test GModelSpectralNodes");
  123 + append(static_cast<pfunction>(&TestGModel::test_filefct),
  124 + "Test GModelSpectralFunc");
  125 + append(static_cast<pfunction>(&TestGModel::test_spectral_model),
  126 + "Test spectral model XML I/O");
108 127
109 // Append temporal model tests 128 // Append temporal model tests
110 - append(static_cast<pfunction>(&TestGModel::test_temp_const), "Test GModelTemporalConst"); 129 + append(static_cast<pfunction>(&TestGModel::test_temp_const),
  130 + "Test GModelTemporalConst");
111 131
112 // Append genereric model tests 132 // Append genereric model tests
113 append(static_cast<pfunction>(&TestGModel::test_model), "Test GModel"); 133 append(static_cast<pfunction>(&TestGModel::test_model), "Test GModel");
@@ -116,7 +136,8 @@ void TestGModel::set(void) @@ -116,7 +136,8 @@ void TestGModel::set(void)
116 append(static_cast<pfunction>(&TestGModel::test_models), "Test GModels"); 136 append(static_cast<pfunction>(&TestGModel::test_models), "Test GModels");
117 137
118 // Append model registry tests 138 // Append model registry tests
119 - append(static_cast<pfunction>(&TestGModel::test_model_registry), "Test model registries"); 139 + append(static_cast<pfunction>(&TestGModel::test_model_registry),
  140 + "Test model registries");
120 141
121 // Return 142 // Return
122 return; 143 return;
@@ -2110,70 +2131,45 @@ void TestGModel::test_nodes(void) @@ -2110,70 +2131,45 @@ void TestGModel::test_nodes(void)
2110 void TestGModel::test_filefct(void) 2131 void TestGModel::test_filefct(void)
2111 { 2132 {
2112 // Test void constructor 2133 // Test void constructor
2113 - test_try("Test void constructor");  
2114 - try {  
2115 - GModelSpectralFunc model;  
2116 - test_assert(model.type() == "FileFunction",  
2117 - "Model type \"FileFunction\" expected.");  
2118 - test_try_success();  
2119 - }  
2120 - catch (std::exception &e) {  
2121 - test_try_failure(e);  
2122 - } 2134 + GModelSpectralFunc model1;
  2135 + test_assert(model1.type() == "FileFunction", "Check model type");
2123 2136
2124 // Test value constructor 2137 // Test value constructor
2125 - test_try("Test value constructor");  
2126 - try {  
2127 - GModelSpectralFunc model("data/filefunction.txt", 2.0);  
2128 - test_assert(model.filename().url() == "data/filefunction.txt",  
2129 - "Expected \"data/filefunction.txt\"");  
2130 - test_value(model.norm(), 2.0);  
2131 - test_try_success();  
2132 - }  
2133 - catch (std::exception &e) {  
2134 - test_try_failure(e);  
2135 - } 2138 + GModelSpectralFunc model2(m_filefct, 2.0);
  2139 + test_assert(model2.filename().url() == m_filefct,
  2140 + "Check file function data file name");
  2141 + test_value(model2.norm(), 2.0);
2136 2142
2137 - // Test XML constructor and value  
2138 - test_try("Test XML constructor, value and gradients");  
2139 - try {  
2140 - // Test XML constructor  
2141 - GXml xml(m_xml_model_point_filefct);  
2142 - GXmlElement* element = xml.element(0)->element(0)->element("spectrum", 0);  
2143 - GModelSpectralFunc model(*element);  
2144 - test_value(model.size(), 1);  
2145 - test_assert(model.type() == "FileFunction", "Expected \"FileFunction\"");  
2146 - test_assert(model.filename().url() == "data/filefunction.txt",  
2147 - "Expected \"data/filefunction.txt\"");  
2148 - test_value(model.norm(), 1.0);  
2149 -  
2150 - // Test filename method  
2151 - model.filename("data/filefunction.txt");  
2152 - test_assert(model.filename().url() == "data/filefunction.txt",  
2153 - "Expected \"data/filefunction.txt\"");  
2154 -  
2155 - // Test norm method  
2156 - model.norm(3.0);  
2157 - test_value(model.norm(), 3.0);  
2158 -  
2159 - // Test operator access  
2160 - const char* strarray[] = {"Normalization"};  
2161 - for (int i = 0; i < 1; ++i) {  
2162 - std::string keyname(strarray[i]);  
2163 - model[keyname].remove_range(); // To allow setting of any value  
2164 - model[keyname].value(2.1);  
2165 - model[keyname].error(1.9);  
2166 - model[keyname].gradient(0.8);  
2167 - test_value(model[keyname].value(), 2.1);  
2168 - test_value(model[keyname].error(), 1.9);  
2169 - test_value(model[keyname].gradient(), 0.8);  
2170 - } 2143 + // Test XML constructor
  2144 + GXml xml(m_xml_model_point_filefct);
  2145 + GXmlElement* element = xml.element(0)->element(0)->element("spectrum", 0);
  2146 + GModelSpectralFunc model3(*element);
  2147 + test_value(model3.size(), 1);
  2148 + test_assert(model3.type() == "FileFunction", "Check model type");
  2149 + test_assert(model3.filename().url() == m_filefct,
  2150 + "Check file function data file name");
  2151 + test_value(model3.norm(), 1.0);
  2152 +
  2153 + // Test filename method
  2154 + model3.filename(m_filefct);
  2155 + test_assert(model3.filename().url() == m_filefct,
  2156 + "Check file function data file name");
  2157 +
  2158 + // Test norm method
  2159 + model3.norm(3.0);
  2160 + test_value(model3.norm(), 3.0);
2171 2161
2172 - // Success if we reached this point  
2173 - test_try_success();  
2174 - }  
2175 - catch (std::exception &e) {  
2176 - test_try_failure(e); 2162 + // Test operator access
  2163 + const char* strarray[] = {"Normalization"};
  2164 + for (int i = 0; i < 1; ++i) {
  2165 + std::string keyname(strarray[i]);
  2166 + model3[keyname].remove_range(); // To allow setting of any value
  2167 + model3[keyname].value(2.1);
  2168 + model3[keyname].error(1.9);
  2169 + model3[keyname].gradient(0.8);
  2170 + test_value(model3[keyname].value(), 2.1);
  2171 + test_value(model3[keyname].error(), 1.9);
  2172 + test_value(model3[keyname].gradient(), 0.8);
2177 } 2173 }
2178 2174
2179 // Exit test 2175 // Exit test
@@ -2744,20 +2740,20 @@ int main(void) @@ -2744,20 +2740,20 @@ int main(void)
2744 GTestSuites testsuite("GModel"); 2740 GTestSuites testsuite("GModel");
2745 2741
2746 // Initialise success flag 2742 // Initialise success flag
2747 - bool was_successful=true; 2743 + bool success = true;
2748 2744
2749 // Create a test suite 2745 // Create a test suite
2750 TestGModel test; 2746 TestGModel test;
2751 2747
2752 - // Append to the container 2748 + // Append test to the container
2753 testsuite.append(test); 2749 testsuite.append(test);
2754 2750
2755 - // Run  
2756 - was_successful=testsuite.run(); 2751 + // Run the testsuites
  2752 + success = testsuite.run();
2757 2753
2758 // Save xml report 2754 // Save xml report
2759 testsuite.save("reports/GModel.xml"); 2755 testsuite.save("reports/GModel.xml");
2760 2756
2761 // Return 2757 // Return
2762 - return was_successful ? 0:1; 2758 + return success ? 0:1;
2763 } 2759 }
test/test_GModel.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * test_GModel.hpp - Test model module * 2 * test_GModel.hpp - Test model module *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2015 by Jean-Baptiste Cayrou * 4 + * copyright (C) 2012-2016 by Jean-Baptiste Cayrou *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -82,6 +82,7 @@ private: @@ -82,6 +82,7 @@ private:
82 // Private attributes 82 // Private attributes
83 std::string m_map_file; 83 std::string m_map_file;
84 std::string m_cube_file; 84 std::string m_cube_file;
  85 + std::string m_filefct;
85 std::string m_xml_file; 86 std::string m_xml_file;
86 std::string m_xml_model_point_const; 87 std::string m_xml_model_point_const;
87 std::string m_xml_model_point_gauss; 88 std::string m_xml_model_point_gauss;
test/test_GSky.cpp
@@ -43,6 +43,10 @@ @@ -43,6 +43,10 @@
43 #define G_WCS_FORTH_BACK_PIXEL_DEBUG 43 #define G_WCS_FORTH_BACK_PIXEL_DEBUG
44 #define G_WCS_COPY_DEBUG 44 #define G_WCS_COPY_DEBUG
45 45
  46 +/* __ Constants __________________________________________________________ */
  47 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  48 +const std::string sky_region = srcdir + "/test/data/test_circle_region.reg";
  49 +
46 50
47 /***********************************************************************//** 51 /***********************************************************************//**
48 * @brief Set parameters and tests 52 * @brief Set parameters and tests
@@ -1383,16 +1387,13 @@ void TestGSky::test_GSkyRegionCircle_logic(void) @@ -1383,16 +1387,13 @@ void TestGSky::test_GSkyRegionCircle_logic(void)
1383 ***************************************************************************/ 1387 ***************************************************************************/
1384 void TestGSky::test_GSkyRegions_io(void) 1388 void TestGSky::test_GSkyRegions_io(void)
1385 { 1389 {
1386 - // Set filenames  
1387 - const std::string filename = "data/test_circle_region.reg";  
1388 -  
1389 // Allocate regions 1390 // Allocate regions
1390 GSkyRegions regions; 1391 GSkyRegions regions;
1391 1392
1392 // Test regions loading 1393 // Test regions loading
1393 test_try("Test regions loading"); 1394 test_try("Test regions loading");
1394 try { 1395 try {
1395 - regions.load(filename); 1396 + regions.load(sky_region);
1396 test_try_success(); 1397 test_try_success();
1397 } 1398 }
1398 catch (std::exception &e) { 1399 catch (std::exception &e) {
test/test_GSky.py
@@ -17,9 +17,9 @@ @@ -17,9 +17,9 @@
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # 18 #
19 # ========================================================================== 19 # ==========================================================================
20 -import gammalib  
21 import os 20 import os
22 import math 21 import math
  22 +import gammalib
23 23
24 24
25 # =========== # 25 # =========== #
@@ -387,9 +387,12 @@ class Test(gammalib.GPythonTestSuite): @@ -387,9 +387,12 @@ class Test(gammalib.GPythonTestSuite):
387 Test txt files taken from: 387 Test txt files taken from:
388 See https://github.com/astropy/coordinates-benchmark 388 See https://github.com/astropy/coordinates-benchmark
389 """ 389 """
  390 + # Get test data directory
  391 + datadir = os.environ['TESTS_SRCDIR'] + '/test/data/'
  392 +
390 # Set parameters 393 # Set parameters
391 - fk5_filename = "data/initial_coords.txt"  
392 - galactic_filename = "data/fk5_to_galactic.txt" 394 + fk5_filename = datadir + 'initial_coords.txt'
  395 + galactic_filename = datadir + 'fk5_to_galactic.txt'
393 fk5_coordinates = loadtxt(fk5_filename) 396 fk5_coordinates = loadtxt(fk5_filename)
394 galactic_coordinates = loadtxt(galactic_filename) 397 galactic_coordinates = loadtxt(galactic_filename)
395 coordinates = zip(fk5_coordinates, galactic_coordinates) 398 coordinates = zip(fk5_coordinates, galactic_coordinates)
test/test_GSupport.cpp
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
31 -#include <cstdlib> // getenv 31 +#include <cstdlib> // getenv
32 #include <vector> 32 #include <vector>
33 #include "GTools.hpp" 33 #include "GTools.hpp"
34 #include "test_GSupport.hpp" 34 #include "test_GSupport.hpp"
@@ -39,6 +39,10 @@ @@ -39,6 +39,10 @@
39 39
40 /* __ Debug definitions __________________________________________________ */ 40 /* __ Debug definitions __________________________________________________ */
41 41
  42 +/* __ Constants __________________________________________________________ */
  43 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  44 +const std::string csv_file = srcdir + "/test/data/csv.dat";
  45 +
42 46
43 /***********************************************************************//** 47 /***********************************************************************//**
44 * @brief Set parameters and tests 48 * @brief Set parameters and tests
@@ -49,14 +53,22 @@ void TestGSupport::set(void){ @@ -49,14 +53,22 @@ void TestGSupport::set(void){
49 name("GSupport"); 53 name("GSupport");
50 54
51 // Append tests 55 // Append tests
52 - append(static_cast<pfunction>(&TestGSupport::test_tools), "Test GTools");  
53 - append(static_cast<pfunction>(&TestGSupport::test_expand_env), "Test Environment variable");  
54 - append(static_cast<pfunction>(&TestGSupport::test_node_array), "Test GNodeArray");  
55 - append(static_cast<pfunction>(&TestGSupport::test_bilinear), "Test GBilinear");  
56 - append(static_cast<pfunction>(&TestGSupport::test_url_file), "Test GUrlFile");  
57 - append(static_cast<pfunction>(&TestGSupport::test_url_string), "Test GUrlString");  
58 - append(static_cast<pfunction>(&TestGSupport::test_filename), "Test GFilename");  
59 - append(static_cast<pfunction>(&TestGSupport::test_csv), "Test GCsv"); 56 + append(static_cast<pfunction>(&TestGSupport::test_tools),
  57 + "Test GTools");
  58 + append(static_cast<pfunction>(&TestGSupport::test_expand_env),
  59 + "Test Environment variable");
  60 + append(static_cast<pfunction>(&TestGSupport::test_node_array),
  61 + "Test GNodeArray");
  62 + append(static_cast<pfunction>(&TestGSupport::test_bilinear),
  63 + "Test GBilinear");
  64 + append(static_cast<pfunction>(&TestGSupport::test_url_file),
  65 + "Test GUrlFile");
  66 + append(static_cast<pfunction>(&TestGSupport::test_url_string),
  67 + "Test GUrlString");
  68 + append(static_cast<pfunction>(&TestGSupport::test_filename),
  69 + "Test GFilename");
  70 + append(static_cast<pfunction>(&TestGSupport::test_csv),
  71 + "Test GCsv");
60 72
61 // Return 73 // Return
62 return; 74 return;
@@ -878,7 +890,7 @@ void TestGSupport::test_csv(void) @@ -878,7 +890,7 @@ void TestGSupport::test_csv(void)
878 test_value(csv2.nrows(), 3); 890 test_value(csv2.nrows(), 3);
879 891
880 // Test filename constructor 892 // Test filename constructor
881 - GCsv csv3("data/csv.dat", ","); 893 + GCsv csv3(csv_file, ",");
882 test_value(csv3.size(), 12); 894 test_value(csv3.size(), 12);
883 test_value(csv3.ncols(), 3); 895 test_value(csv3.ncols(), 3);
884 test_value(csv3.nrows(), 4); 896 test_value(csv3.nrows(), 4);
@@ -971,6 +983,8 @@ int main(void) @@ -971,6 +983,8 @@ int main(void)
971 983
972 // Create and append test suite 984 // Create and append test suite
973 TestGSupport test; 985 TestGSupport test;
  986 +
  987 + // Append test to the container
974 testsuites.append(test); 988 testsuites.append(test);
975 989
976 // Run the testsuites 990 // Run the testsuites
test/test_GXml.cpp
@@ -28,9 +28,12 @@ @@ -28,9 +28,12 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
  31 +#include <cstdlib> // getenv
31 #include "test_GXml.hpp" 32 #include "test_GXml.hpp"
32 #include "GTools.hpp" 33 #include "GTools.hpp"
33 34
  35 +/* __ Constants __________________________________________________________ */
  36 +
34 37
35 /***********************************************************************//** 38 /***********************************************************************//**
36 * @brief Set parameters and tests 39 * @brief Set parameters and tests
@@ -40,8 +43,11 @@ void TestGXml::set(void) @@ -40,8 +43,11 @@ void TestGXml::set(void)
40 // Test name 43 // Test name
41 name("GXml"); 44 name("GXml");
42 45
  46 + // Set srcdir
  47 + std::string srcdir = std::getenv("TESTS_SRCDIR");
  48 +
43 // Set XML filename 49 // Set XML filename
44 - m_xml_file = "data/test.xml"; 50 + m_xml_file = srcdir + "/test/data/test.xml";
45 51
46 // Append tests 52 // Append tests
47 append(static_cast<pfunction>(&TestGXml::test_GXml_attributes), 53 append(static_cast<pfunction>(&TestGXml::test_GXml_attributes),
test/test_GXspec.cpp
@@ -28,12 +28,14 @@ @@ -28,12 +28,14 @@
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include <config.h> 29 #include <config.h>
30 #endif 30 #endif
  31 +#include <cstdlib> // getenv
31 #include "test_GXspec.hpp" 32 #include "test_GXspec.hpp"
32 #include "GTools.hpp" 33 #include "GTools.hpp"
33 34
34 35
35 /* __ Constants __________________________________________________________ */ 36 /* __ Constants __________________________________________________________ */
36 -const std::string rmfname = PACKAGE_SOURCE"/test/data/rmf.fits"; 37 +const std::string srcdir = std::getenv("TESTS_SRCDIR");
  38 +const std::string rmfname = srcdir + "/test/data/rmf.fits";
37 39
38 40
39 /***********************************************************************//** 41 /***********************************************************************//**
test/test_examples.py
@@ -18,9 +18,9 @@ @@ -18,9 +18,9 @@
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # 19 #
20 # ========================================================================== 20 # ==========================================================================
21 -import gammalib  
22 -import sys  
23 import os 21 import os
  22 +import sys
  23 +import gammalib
24 24
25 25
26 # =============================================== # 26 # =============================================== #
@@ -33,14 +33,14 @@ class Test(gammalib.GPythonTestSuite): @@ -33,14 +33,14 @@ class Test(gammalib.GPythonTestSuite):
33 # Constructor 33 # Constructor
34 def __init__(self): 34 def __init__(self):
35 """ 35 """
36 - Constructor. 36 + Constructor
37 """ 37 """
38 # Call base class constructor 38 # Call base class constructor
39 gammalib.GPythonTestSuite.__init__(self) 39 gammalib.GPythonTestSuite.__init__(self)
40 40
41 # Examples directory 41 # Examples directory
42 - self._cpp_dir = '../examples/cpp/'  
43 - self._python_dir = '../examples/python/' 42 + self._cpp_dir = os.environ['TESTS_BUILDDIR'] + '/examples/cpp/'
  43 + self._python_dir = os.environ['TESTS_SRCDIR'] + '/examples/python/'
44 44
45 # Return 45 # Return
46 return 46 return
@@ -127,8 +127,6 @@ class Test(gammalib.GPythonTestSuite): @@ -127,8 +127,6 @@ class Test(gammalib.GPythonTestSuite):
127 # Execute binary 127 # Execute binary
128 self._execute_binary('createfits') 128 self._execute_binary('createfits')
129 129
130 - #TODO: Do any testing  
131 -  
132 # Return 130 # Return
133 return 131 return
134 132
@@ -140,8 +138,6 @@ class Test(gammalib.GPythonTestSuite): @@ -140,8 +138,6 @@ class Test(gammalib.GPythonTestSuite):
140 # Execute binary 138 # Execute binary
141 self._execute_binary('createskymap') 139 self._execute_binary('createskymap')
142 140
143 - #TODO: Do any testing  
144 -  
145 # Return 141 # Return
146 return 142 return
147 143
@@ -153,8 +149,6 @@ class Test(gammalib.GPythonTestSuite): @@ -153,8 +149,6 @@ class Test(gammalib.GPythonTestSuite):
153 # Execute binary 149 # Execute binary
154 self._execute_binary('createxml') 150 self._execute_binary('createxml')
155 151
156 - #TODO: Do any testing  
157 -  
158 # Return 152 # Return
159 return 153 return
160 154
@@ -166,8 +160,6 @@ class Test(gammalib.GPythonTestSuite): @@ -166,8 +160,6 @@ class Test(gammalib.GPythonTestSuite):
166 # Execute binary 160 # Execute binary
167 self._execute_binary('interpolate') 161 self._execute_binary('interpolate')
168 162
169 - #TODO: Do any testing  
170 -  
171 # Return 163 # Return
172 return 164 return
173 165
@@ -179,8 +171,6 @@ class Test(gammalib.GPythonTestSuite): @@ -179,8 +171,6 @@ class Test(gammalib.GPythonTestSuite):
179 # Execute binary 171 # Execute binary
180 self._execute_binary('numerics') 172 self._execute_binary('numerics')
181 173
182 - #TODO: Do any testing  
183 -  
184 # Return 174 # Return
185 return 175 return
186 176
@@ -192,8 +182,6 @@ class Test(gammalib.GPythonTestSuite): @@ -192,8 +182,6 @@ class Test(gammalib.GPythonTestSuite):
192 # Execute binary 182 # Execute binary
193 self._execute_binary('optimize') 183 self._execute_binary('optimize')
194 184
195 - #TODO: Do any testing  
196 -  
197 # Return 185 # Return
198 return 186 return
199 187
@@ -205,8 +193,6 @@ class Test(gammalib.GPythonTestSuite): @@ -205,8 +193,6 @@ class Test(gammalib.GPythonTestSuite):
205 # Execute binary 193 # Execute binary
206 self._execute_binary('readmodel') 194 self._execute_binary('readmodel')
207 195
208 - #TODO: Do any testing  
209 -  
210 # Return 196 # Return
211 return 197 return
212 198
@@ -218,8 +204,6 @@ class Test(gammalib.GPythonTestSuite): @@ -218,8 +204,6 @@ class Test(gammalib.GPythonTestSuite):
218 # Execute python script 204 # Execute python script
219 self._execute_python('matrix_howto') 205 self._execute_python('matrix_howto')
220 206
221 - #TODO: Do any testing  
222 -  
223 # Return 207 # Return
224 return 208 return
225 209
@@ -231,8 +215,6 @@ class Test(gammalib.GPythonTestSuite): @@ -231,8 +215,6 @@ class Test(gammalib.GPythonTestSuite):
231 # Execute python script 215 # Execute python script
232 self._execute_python('models_howto') 216 self._execute_python('models_howto')
233 217
234 - #TODO: Do any testing  
235 -  
236 # Return 218 # Return
237 return 219 return
238 220
@@ -244,8 +226,6 @@ class Test(gammalib.GPythonTestSuite): @@ -244,8 +226,6 @@ class Test(gammalib.GPythonTestSuite):
244 # Execute python script 226 # Execute python script
245 self._execute_python('xml_howto') 227 self._execute_python('xml_howto')
246 228
247 - #TODO: Do any testing  
248 -  
249 # Return 229 # Return
250 return 230 return
251 231
@@ -257,8 +237,6 @@ class Test(gammalib.GPythonTestSuite): @@ -257,8 +237,6 @@ class Test(gammalib.GPythonTestSuite):
257 # Execute python script 237 # Execute python script
258 self._execute_python('xml_html_create') 238 self._execute_python('xml_html_create')
259 239
260 - #TODO: Do any testing  
261 -  
262 # Return 240 # Return
263 return 241 return
264 242
test/test_examples.sh.in
@@ -22,4 +22,4 @@ @@ -22,4 +22,4 @@
22 # 22 #
23 # Run the examples test 23 # Run the examples test
24 # ===================== 24 # =====================
25 -@PYTHON_COVERAGE@./test_examples.py 25 +@PYTHON_COVERAGE@@srcdir@/test_examples.py
test/test_python.py
@@ -18,9 +18,9 @@ @@ -18,9 +18,9 @@
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # 19 #
20 # ========================================================================== 20 # ==========================================================================
21 -import gammalib  
22 -import sys  
23 import os 21 import os
  22 +import sys
  23 +import gammalib
24 sys.path.append(os.path.dirname(os.path.abspath(__file__))) 24 sys.path.append(os.path.dirname(os.path.abspath(__file__)))
25 import test_GApplication 25 import test_GApplication
26 import test_GLinalg 26 import test_GLinalg
@@ -70,7 +70,7 @@ except: @@ -70,7 +70,7 @@ except:
70 # ================== # 70 # ================== #
71 def test(installed=False): 71 def test(installed=False):
72 """ 72 """
73 - Perform unit testing for Python interface. 73 + Perform unit testing for Python interface
74 """ 74 """
75 # Allocate test suites 75 # Allocate test suites
76 suites = gammalib.GTestSuites('Python interface testing') 76 suites = gammalib.GTestSuites('Python interface testing')
@@ -131,7 +131,7 @@ def test(installed=False): @@ -131,7 +131,7 @@ def test(installed=False):
131 suite_cta = test_CTA.Test() 131 suite_cta = test_CTA.Test()
132 suite_cta.set() 132 suite_cta.set()
133 if installed: 133 if installed:
134 - suite_cta.caldb_path('cta/caldb') 134 + suite_cta.testdir('cta') # Test data for installed test
135 suites.append(suite_cta) 135 suites.append(suite_cta)
136 136
137 # Optionally handle LAT suite 137 # Optionally handle LAT suite
test/test_python.sh.in
@@ -27,4 +27,4 @@ rm -rf .coverage @@ -27,4 +27,4 @@ rm -rf .coverage
27 # 27 #
28 # Run the Python test 28 # Run the Python test
29 # =================== 29 # ===================
30 -@PYTHON_COVERAGE@./test_python.py 30 +@PYTHON_COVERAGE@@srcdir@/test_python.py