Commit 5c3b23c9f390cd3d5e4d8b5bbba3f011fbf0d7ce
1 parent
39a4656a
Introduce environment variables for test data
Showing
18 changed files
with
115 additions
and
104 deletions
inst/com/test/test_COM.cpp
| ... | ... | @@ -39,16 +39,15 @@ |
| 39 | 39 | /* __ Globals ____________________________________________________________ */ |
| 40 | 40 | |
| 41 | 41 | /* __ Constants __________________________________________________________ */ |
| 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"; | |
| 45 | -const std::string com_iaq = "ENERG(1.0-3.0)MeV"; // 1-3 MeV | |
| 46 | -const std::string com_dre = datadir+"/m50439_dre.fits"; // 1-3 MeV | |
| 47 | -const std::string com_drb = datadir+"/m34997_drg.fits"; | |
| 48 | -const std::string com_drg = datadir+"/m34997_drg.fits"; | |
| 49 | -const std::string com_drx = datadir+"/m32171_drx.fits"; | |
| 50 | -const std::string com_obs = datadir+"/obs.xml"; | |
| 51 | -const std::string com_model = datadir+"/crab.xml"; | |
| 42 | +const std::string datadir = std::getenv("TEST_COM_DATA"); | |
| 43 | +const std::string com_caldb = datadir + "/../../caldb"; | |
| 44 | +const std::string com_iaq = "ENERG(1.0-3.0)MeV"; // 1-3 MeV | |
| 45 | +const std::string com_dre = datadir+"/m50439_dre.fits"; // 1-3 MeV | |
| 46 | +const std::string com_drb = datadir+"/m34997_drg.fits"; | |
| 47 | +const std::string com_drg = datadir+"/m34997_drg.fits"; | |
| 48 | +const std::string com_drx = datadir+"/m32171_drx.fits"; | |
| 49 | +const std::string com_obs = datadir+"/obs.xml"; | |
| 50 | +const std::string com_model = datadir+"/crab.xml"; | |
| 52 | 51 | |
| 53 | 52 | |
| 54 | 53 | /***********************************************************************//** | ... | ... |
inst/cta/test/data/irf_1dc.xml
| 1 | 1 | <observation_list title="observation library"> |
| 2 | 2 | <observation name="Crab" id="000001" instrument="CTA"> |
| 3 | 3 | <parameter name="CountsCube" file="crab_cntmap.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"/> | |
| 4 | + <parameter name="EffectiveArea" file="$(TEST_CTA_DATA)/../caldb/dc1/arf.fits"/> | |
| 5 | + <parameter name="PointSpreadFunction" file="$(TEST_CTA_DATA)/../caldb/dc1/psf_magic.fits"/> | |
| 6 | + <parameter name="EnergyDispersion" file="$(TEST_CTA_DATA)/../caldb/dc1/rmf.fits"/> | |
| 7 | 7 | <parameter name="Background" file=""/> |
| 8 | 8 | </observation> |
| 9 | 9 | </observation_list> | ... | ... |
inst/cta/test/data/irf_binned.xml
| 1 | 1 | <observation_list title="observation library"> |
| 2 | 2 | <observation name="Crab" id="000001" instrument="CTA"> |
| 3 | 3 | <parameter name="CountsCube" file="crab_cntmap.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"/> | |
| 4 | + <parameter name="EffectiveArea" file="$(TEST_CTA_DATA)/../../caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/> | |
| 5 | + <parameter name="PointSpreadFunction" file="$(TEST_CTA_DATA)/../../caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/> | |
| 6 | + <parameter name="EnergyDispersion" file="$(TEST_CTA_DATA)/../../caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/> | |
| 7 | + <parameter name="Background" file="$(TEST_CTA_DATA)/../../caldb/data/cta/e/bcf/IFAE20120510_50h/irf_file.fits"/> | |
| 8 | 8 | </observation> |
| 9 | 9 | </observation_list> | ... | ... |
inst/cta/test/data/irf_unbinned.xml
| 1 | 1 | <observation_list title="observation library"> |
| 2 | 2 | <observation name="Crab" id="000001" instrument="CTA"> |
| 3 | 3 | <parameter name="EventList" file="crab_events.fits"/> |
| 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"/> | |
| 4 | + <parameter name="EffectiveArea" file="$(TEST_CTA_DATA)/../caldb/cta_dummy_irf.dat"/> | |
| 5 | + <parameter name="PointSpreadFunction" file="$(TEST_CTA_DATA)/../caldb/cta_dummy_irf.dat"/> | |
| 6 | + <parameter name="EnergyDispersion" file="$(TEST_CTA_DATA)/../caldb/cta_dummy_irf.dat"/> | |
| 7 | + <parameter name="Background" file="$(TEST_CTA_DATA)/../caldb/cta_dummy_irf.dat"/> | |
| 8 | 8 | </observation> |
| 9 | 9 | </observation_list> | ... | ... |
inst/cta/test/test_CTA.cpp
| ... | ... | @@ -47,10 +47,9 @@ |
| 47 | 47 | /* __ Globals ____________________________________________________________ */ |
| 48 | 48 | |
| 49 | 49 | /* __ Constants __________________________________________________________ */ |
| 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"; | |
| 50 | +const std::string datadir = std::getenv("TEST_CTA_DATA"); | |
| 51 | +const std::string caldbdir = datadir + "/../caldb"; | |
| 52 | +const std::string cta_caldb = datadir + "/../../caldb"; | |
| 54 | 53 | const std::string cta_irf = "cta_dummy_irf"; |
| 55 | 54 | const std::string cta_events = datadir+"/crab_events.fits"; |
| 56 | 55 | const std::string cta_events_gti = datadir+"/crab_events_gti.fits[EVENTS2]"; | ... | ... |
inst/cta/test/test_CTA.py
| ... | ... | @@ -37,25 +37,9 @@ class Test(gammalib.GPythonTestSuite): |
| 37 | 37 | # Call base class constructor |
| 38 | 38 | gammalib.GPythonTestSuite.__init__(self) |
| 39 | 39 | |
| 40 | - # Set directory base path | |
| 41 | - self.testdir(os.path.dirname(os.path.abspath(__file__))) | |
| 42 | - | |
| 43 | - # Return | |
| 44 | - return | |
| 45 | - | |
| 46 | - # Set test directory base path | |
| 47 | - def testdir(self, path): | |
| 48 | - """ | |
| 49 | - Set test directory base path | |
| 50 | - | |
| 51 | - Parameters | |
| 52 | - ---------- | |
| 53 | - path : str | |
| 54 | - Test directory base path | |
| 55 | - """ | |
| 56 | - # Set test data paths | |
| 57 | - self._caldb = path + '/caldb' | |
| 58 | - self._data = path + '/data' | |
| 40 | + # Set test directories | |
| 41 | + self._data = os.environ['TEST_CTA_DATA'] | |
| 42 | + self._caldb = self._data + '/../caldb' | |
| 59 | 43 | |
| 60 | 44 | # Return |
| 61 | 45 | return | ... | ... |
inst/lat/test/test_LAT.cpp
| ... | ... | @@ -41,12 +41,11 @@ |
| 41 | 41 | /* __ Globals ____________________________________________________________ */ |
| 42 | 42 | |
| 43 | 43 | /* __ Constants __________________________________________________________ */ |
| 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"; | |
| 44 | +const std::string datadir = std::getenv("TEST_LAT_DATA"); | |
| 45 | +const std::string lat_caldb = datadir + "/../../caldb"; | |
| 46 | +const std::string dirPass6 = datadir + "/p6v3"; | |
| 47 | +const std::string dirPass7 = datadir + "/p7v6"; | |
| 48 | +const std::string dirPass8 = datadir + "/p8v2"; | |
| 50 | 49 | |
| 51 | 50 | |
| 52 | 51 | /***********************************************************************//** |
| ... | ... | @@ -73,9 +72,12 @@ void TestGLATResponse::set(void) |
| 73 | 72 | name("GLATResponse"); |
| 74 | 73 | |
| 75 | 74 | // Append tests to test suite |
| 76 | - append(static_cast<pfunction>(&TestGLATResponse::test_response_p6), "Test P6 response"); | |
| 77 | - append(static_cast<pfunction>(&TestGLATResponse::test_response_p7), "Test P7 response"); | |
| 78 | - append(static_cast<pfunction>(&TestGLATResponse::test_response_p8), "Test P8 response"); | |
| 75 | + append(static_cast<pfunction>(&TestGLATResponse::test_response_p6), | |
| 76 | + "Test P6 response"); | |
| 77 | + append(static_cast<pfunction>(&TestGLATResponse::test_response_p7), | |
| 78 | + "Test P7 response"); | |
| 79 | + append(static_cast<pfunction>(&TestGLATResponse::test_response_p8), | |
| 80 | + "Test P8 response"); | |
| 79 | 81 | |
| 80 | 82 | // Return |
| 81 | 83 | return; | ... | ... |
inst/mwl/test/test_MWL.cpp
| ... | ... | @@ -39,8 +39,7 @@ |
| 39 | 39 | /* __ Globals ____________________________________________________________ */ |
| 40 | 40 | |
| 41 | 41 | /* __ Constants __________________________________________________________ */ |
| 42 | -const std::string srcdir = std::getenv("TESTS_SRCDIR"); | |
| 43 | -const std::string datadir = srcdir + "/inst/mwl/test/data"; | |
| 42 | +const std::string datadir = std::getenv("TEST_MWL_DATA"); | |
| 44 | 43 | const std::string lat_crab_model = datadir + "/crab.xml"; |
| 45 | 44 | const std::string lat_crab_fits = datadir + "/crab.fits"; |
| 46 | 45 | const std::string crab_model = datadir + "/crab_mwl.xml"; | ... | ... |
test/Makefile.am
| ... | ... | @@ -24,20 +24,24 @@ SUBDIRS = reports |
| 24 | 24 | |
| 25 | 25 | # Optional instrument specific tests |
| 26 | 26 | if WITH_INST_MWL |
| 27 | - INST_MWL = $(top_builddir)/inst/mwl/test/test_MWL | |
| 28 | - TEST_MWL = :$(top_srcdir)/inst/mwl/test | |
| 27 | + INST_MWL = $(top_builddir)/inst/mwl/test/test_MWL | |
| 28 | + TEST_MWL = :$(top_srcdir)/inst/mwl/test | |
| 29 | + TEST_MWL_ENV = TEST_MWL_DATA=$(top_srcdir)/inst/mwl/test/data | |
| 29 | 30 | endif |
| 30 | 31 | if WITH_INST_CTA |
| 31 | - INST_CTA = $(top_builddir)/inst/cta/test/test_CTA | |
| 32 | - TEST_CTA = :$(top_srcdir)/inst/cta/test | |
| 32 | + INST_CTA = $(top_builddir)/inst/cta/test/test_CTA | |
| 33 | + TEST_CTA = :$(top_srcdir)/inst/cta/test | |
| 34 | + TEST_CTA_ENV = TEST_CTA_DATA=$(top_srcdir)/inst/cta/test/data | |
| 33 | 35 | endif |
| 34 | 36 | if WITH_INST_LAT |
| 35 | - INST_LAT = $(top_builddir)/inst/lat/test/test_LAT | |
| 36 | - TEST_LAT = :$(top_srcdir)/inst/lat/test | |
| 37 | + INST_LAT = $(top_builddir)/inst/lat/test/test_LAT | |
| 38 | + TEST_LAT = :$(top_srcdir)/inst/lat/test | |
| 39 | + TEST_LAT_ENV = TEST_LAT_DATA=$(top_srcdir)/inst/lat/test/data | |
| 37 | 40 | endif |
| 38 | 41 | if WITH_INST_COM |
| 39 | - INST_COM = $(top_builddir)/inst/com/test/test_COM | |
| 40 | - TEST_COM = :$(top_srcdir)/inst/com/test | |
| 42 | + INST_COM = $(top_builddir)/inst/com/test/test_COM | |
| 43 | + TEST_COM = :$(top_srcdir)/inst/com/test | |
| 44 | + TEST_COM_ENV = TEST_COM_DATA=$(top_srcdir)/inst/com/test/data | |
| 41 | 45 | endif |
| 42 | 46 | |
| 43 | 47 | # Optional python bindings |
| ... | ... | @@ -75,8 +79,13 @@ check_PROGRAMS = test_GSupport \ |
| 75 | 79 | # Set test environment (needed for linking with cfitsio and readline) |
| 76 | 80 | TESTS_ENVIRONMENT = @RUNSHARED@=$(top_builddir)/src/.libs$(TEST_ENV_DIR):$(@RUNSHARED@) \ |
| 77 | 81 | $(TEST_PYTHON_ENV) \ |
| 78 | - TESTS_SRCDIR=$(abs_top_srcdir) \ | |
| 79 | - TESTS_BUILDDIR=$(abs_top_builddir) | |
| 82 | + TEST_SRCDIR=$(abs_top_srcdir) \ | |
| 83 | + TEST_BUILDDIR=$(abs_top_builddir) \ | |
| 84 | + TEST_DATA=$(abs_top_srcdir)/test/data \ | |
| 85 | + $(TEST_MWL_ENV) \ | |
| 86 | + $(TEST_CTA_ENV) \ | |
| 87 | + $(TEST_LAT_ENV) \ | |
| 88 | + $(TEST_COM_ENV) | |
| 80 | 89 | |
| 81 | 90 | # Tests (these are the tests to be executed) |
| 82 | 91 | TESTS = test_GSupport \ |
| ... | ... | @@ -219,3 +228,11 @@ clean-local: |
| 219 | 228 | rm -rf $(builddir)/*.reg |
| 220 | 229 | rm -rf $(builddir)/*.dat |
| 221 | 230 | rm -rf $(builddir)/reports/*.xml |
| 231 | + | |
| 232 | +# Tests to be done on installed version | |
| 233 | +if WITH_PYTHON | |
| 234 | +installcheck-local: | |
| 235 | + @export GAMMALIB=$(DESTDIR)$(prefix); \ | |
| 236 | + . $(GAMMALIB)/bin/gammalib-init.sh; \ | |
| 237 | + python -c 'import gammalib; gammalib.test()' | |
| 238 | +endif | ... | ... |
test/test_GFits.py
| ... | ... | @@ -60,7 +60,7 @@ class Test(gammalib.GPythonTestSuite): |
| 60 | 60 | Test GFile class interface. |
| 61 | 61 | """ |
| 62 | 62 | # Get test data directory |
| 63 | - datadir = os.environ['TESTS_SRCDIR'] + '/test/data/' | |
| 63 | + datadir = os.environ['TEST_DATA'] + '/' | |
| 64 | 64 | |
| 65 | 65 | # Set test file names |
| 66 | 66 | file = gammalib.GFilename(datadir+'file.fits') | ... | ... |
test/test_GModel.cpp
| ... | ... | @@ -46,32 +46,31 @@ void TestGModel::set(void) |
| 46 | 46 | name("GModel"); |
| 47 | 47 | |
| 48 | 48 | // Set test data directory |
| 49 | - std::string datadir = std::string(std::getenv("TESTS_SRCDIR")) + | |
| 50 | - "/test/data/"; | |
| 49 | + std::string datadir = std::getenv("TEST_DATA"); | |
| 51 | 50 | |
| 52 | 51 | // Set attributes |
| 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"; | |
| 52 | + m_map_file = datadir + "/cena_lobes_parkes.fits"; | |
| 53 | + m_cube_file = datadir + "/test_cube.fits"; | |
| 54 | + m_filefct = datadir + "/filefunction.txt"; | |
| 55 | + m_xml_file = datadir + "/crab.xml"; | |
| 56 | + m_xml_model_point_const = datadir + "/model_point_const.xml"; | |
| 57 | + m_xml_model_point_gauss = datadir + "/model_point_gauss.xml"; | |
| 58 | + m_xml_model_point_plaw = datadir + "/model_point_plaw.xml"; | |
| 59 | + m_xml_model_point_plaw2 = datadir + "/model_point_plaw2.xml"; | |
| 60 | + m_xml_model_point_eplaw = datadir + "/model_point_eplaw.xml"; | |
| 61 | + m_xml_model_point_bplaw = datadir + "/model_point_bplaw.xml"; | |
| 62 | + m_xml_model_point_supeplaw = datadir + "/model_point_supeplaw.xml"; | |
| 63 | + m_xml_model_point_logparabola = datadir + "/model_point_logparabola.xml"; | |
| 64 | + m_xml_model_point_nodes = datadir + "/model_point_nodes.xml"; | |
| 65 | + m_xml_model_point_filefct = datadir + "/model_point_filefct.xml"; | |
| 66 | + m_xml_model_diffuse_const = datadir + "/model_diffuse_const.xml"; | |
| 67 | + m_xml_model_diffuse_cube = datadir + "/model_diffuse_cube.xml"; | |
| 68 | + m_xml_model_diffuse_map = datadir + "/model_diffuse_map.xml"; | |
| 69 | + m_xml_model_radial_disk = datadir + "/model_radial_disk.xml"; | |
| 70 | + m_xml_model_radial_gauss = datadir + "/model_radial_gauss.xml"; | |
| 71 | + m_xml_model_radial_shell = datadir + "/model_radial_shell.xml"; | |
| 72 | + m_xml_model_elliptical_disk = datadir + "/model_elliptical_disk.xml"; | |
| 73 | + m_xml_model_elliptical_gauss = datadir + "/model_elliptical_gauss.xml"; | |
| 75 | 74 | |
| 76 | 75 | // Append tests |
| 77 | 76 | append(static_cast<pfunction>(&TestGModel::test_model_par), | ... | ... |
test/test_GSky.cpp
| ... | ... | @@ -44,8 +44,8 @@ |
| 44 | 44 | #define G_WCS_COPY_DEBUG |
| 45 | 45 | |
| 46 | 46 | /* __ Constants __________________________________________________________ */ |
| 47 | -const std::string srcdir = std::getenv("TESTS_SRCDIR"); | |
| 48 | -const std::string sky_region = srcdir + "/test/data/test_circle_region.reg"; | |
| 47 | +const std::string datadir = std::getenv("TEST_DATA"); | |
| 48 | +const std::string sky_region = datadir + "/test_circle_region.reg"; | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | /***********************************************************************//** | ... | ... |
test/test_GSky.py
| ... | ... | @@ -388,7 +388,7 @@ class Test(gammalib.GPythonTestSuite): |
| 388 | 388 | See https://github.com/astropy/coordinates-benchmark |
| 389 | 389 | """ |
| 390 | 390 | # Get test data directory |
| 391 | - datadir = os.environ['TESTS_SRCDIR'] + '/test/data/' | |
| 391 | + datadir = os.environ['TEST_DATA'] + '/' | |
| 392 | 392 | |
| 393 | 393 | # Set parameters |
| 394 | 394 | fk5_filename = datadir + 'initial_coords.txt' | ... | ... |
test/test_GSupport.cpp
| ... | ... | @@ -40,8 +40,8 @@ |
| 40 | 40 | /* __ Debug definitions __________________________________________________ */ |
| 41 | 41 | |
| 42 | 42 | /* __ Constants __________________________________________________________ */ |
| 43 | -const std::string srcdir = std::getenv("TESTS_SRCDIR"); | |
| 44 | -const std::string csv_file = srcdir + "/test/data/csv.dat"; | |
| 43 | +const std::string datadir = std::getenv("TEST_DATA"); | |
| 44 | +const std::string csv_file = datadir + "/csv.dat"; | |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | /***********************************************************************//** | ... | ... |
test/test_GXml.cpp
| ... | ... | @@ -43,11 +43,11 @@ void TestGXml::set(void) |
| 43 | 43 | // Test name |
| 44 | 44 | name("GXml"); |
| 45 | 45 | |
| 46 | - // Set srcdir | |
| 47 | - std::string srcdir = std::getenv("TESTS_SRCDIR"); | |
| 46 | + // Set datadir | |
| 47 | + std::string datadir = std::getenv("TEST_DATA"); | |
| 48 | 48 | |
| 49 | 49 | // Set XML filename |
| 50 | - m_xml_file = srcdir + "/test/data/test.xml"; | |
| 50 | + m_xml_file = datadir + "/test.xml"; | |
| 51 | 51 | |
| 52 | 52 | // Append tests |
| 53 | 53 | append(static_cast<pfunction>(&TestGXml::test_GXml_attributes), | ... | ... |
test/test_GXspec.cpp
| ... | ... | @@ -34,8 +34,8 @@ |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | /* __ Constants __________________________________________________________ */ |
| 37 | -const std::string srcdir = std::getenv("TESTS_SRCDIR"); | |
| 38 | -const std::string rmfname = srcdir + "/test/data/rmf.fits"; | |
| 37 | +const std::string datadir = std::getenv("TEST_DATA"); | |
| 38 | +const std::string rmfname = datadir + "/rmf.fits"; | |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /***********************************************************************//** | ... | ... |
test/test_examples.py
| ... | ... | @@ -39,8 +39,8 @@ class Test(gammalib.GPythonTestSuite): |
| 39 | 39 | gammalib.GPythonTestSuite.__init__(self) |
| 40 | 40 | |
| 41 | 41 | # Examples directory |
| 42 | - self._cpp_dir = os.environ['TESTS_BUILDDIR'] + '/examples/cpp/' | |
| 43 | - self._python_dir = os.environ['TESTS_SRCDIR'] + '/examples/python/' | |
| 42 | + self._cpp_dir = os.environ['TEST_BUILDDIR'] + '/examples/cpp/' | |
| 43 | + self._python_dir = os.environ['TEST_SRCDIR'] + '/examples/python/' | |
| 44 | 44 | |
| 45 | 45 | # Return |
| 46 | 46 | return | ... | ... |
test/test_python.py
| ... | ... | @@ -22,6 +22,8 @@ import os |
| 22 | 22 | import sys |
| 23 | 23 | import gammalib |
| 24 | 24 | sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
| 25 | + | |
| 26 | +# Import test modules | |
| 25 | 27 | import test_GApplication |
| 26 | 28 | import test_GLinalg |
| 27 | 29 | import test_GModel |
| ... | ... | @@ -72,6 +74,14 @@ def test(installed=False): |
| 72 | 74 | """ |
| 73 | 75 | Perform unit testing for Python interface |
| 74 | 76 | """ |
| 77 | + # Set environment variables first | |
| 78 | + if installed: | |
| 79 | + os.environ['TEST_DATA'] = 'data' | |
| 80 | + os.environ['TEST_COM_DATA'] = 'com/data' | |
| 81 | + os.environ['TEST_CTA_DATA'] = 'cta/data' | |
| 82 | + os.environ['TEST_LAT_DATA'] = 'lat/data' | |
| 83 | + os.environ['TEST_MWL_DATA'] = 'mwl/data' | |
| 84 | + | |
| 75 | 85 | # Allocate test suites |
| 76 | 86 | suites = gammalib.GTestSuites('Python interface testing') |
| 77 | 87 | |
| ... | ... | @@ -130,8 +140,8 @@ def test(installed=False): |
| 130 | 140 | if has_cta: |
| 131 | 141 | suite_cta = test_CTA.Test() |
| 132 | 142 | suite_cta.set() |
| 133 | - if installed: | |
| 134 | - suite_cta.testdir('cta') # Test data for installed test | |
| 143 | + #if installed: | |
| 144 | + # suite_cta.testdir('cta') # Test data for installed test | |
| 135 | 145 | suites.append(suite_cta) |
| 136 | 146 | |
| 137 | 147 | # Optionally handle LAT suite |
| ... | ... | @@ -198,6 +208,8 @@ def test(installed=False): |
| 198 | 208 | # If we have a non-installed version then save test results |
| 199 | 209 | if not installed: |
| 200 | 210 | suites.save('reports/python.xml') |
| 211 | + else: | |
| 212 | + suites.save('/Users/jurgen/git/gammalib/gammalib/build/python_installed.xml') | |
| 201 | 213 | |
| 202 | 214 | # Set return code |
| 203 | 215 | if success: | ... | ... |