From 72de6872ea200635dd93491c05bdbb82c237bb7b Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Thu, 11 Jun 2020 13:35:03 +0200 Subject: [PATCH] Config flag whether xerces-c is available in Storm --- cmake/CMakeLists.txt | 6 ++++++ cmake/config.py.in | 1 + setup.py | 1 + tests/configurations.py | 2 ++ tests/gspn/test_gspn.py | 3 ++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0d90e2e..0b796a1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -55,6 +55,12 @@ else() set(STORM_CLN_RF_BOOL "False") endif() +if(STORM_HAVE_XERCES) + set(STORM_XERCES_BOOL "True") +else() + set(STORM_XERCES_BOOL "False") +endif() + if(HAVE_STORM_DFT) set(HAVE_STORM_DFT_BOOL "True") else() diff --git a/cmake/config.py.in b/cmake/config.py.in index 905b57b..ec22d05 100644 --- a/cmake/config.py.in +++ b/cmake/config.py.in @@ -4,6 +4,7 @@ STORM_DIR = "@STORM_DIR@" STORM_VERSION = "@STORM_VERSION@" STORM_CLN_EA = @STORM_CLN_EA_BOOL@ STORM_CLN_RF = @STORM_CLN_RF_BOOL@ +STORM_XERCES = @STORM_XERCES_BOOL@ HAVE_STORM_DFT = @HAVE_STORM_DFT_BOOL@ HAVE_STORM_GSPN = @HAVE_STORM_GSPN_BOOL@ HAVE_STORM_PARS = @HAVE_STORM_PARS_BOOL@ diff --git a/setup.py b/setup.py index 559d5de..11c3519 100755 --- a/setup.py +++ b/setup.py @@ -153,6 +153,7 @@ class CMakeBuild(build_ext): f.write("RationalFunction = pycarl.{}.RationalFunction\n".format(rfpackage)) f.write("FactorizedRationalFunction = pycarl.{}.FactorizedRationalFunction\n".format(rfpackage)) f.write("\n") + f.write("storm_with_xerces = {}\n".format(cmake_conf.STORM_XERCES)) f.write("storm_with_dft = {}\n".format(use_dft)) f.write("storm_with_gspn = {}\n".format(use_gspn)) f.write("storm_with_pars = {}\n".format(use_pars)) diff --git a/tests/configurations.py b/tests/configurations.py index a6c1377..cfe3cda 100644 --- a/tests/configurations.py +++ b/tests/configurations.py @@ -3,6 +3,7 @@ import pytest import stormpy._config as config # Skip not supported functionality +has_xml = config.storm_with_xerces has_dft = config.storm_with_dft has_gspn = config.storm_with_gspn has_pars = config.storm_with_pars @@ -15,6 +16,7 @@ try: except ImportError: has_numpy = False +xml = pytest.mark.skipif(not has_xml, reason="No support for XML via xerces") dft = pytest.mark.skipif(not has_dft, reason="No support for DFTs") gspn = pytest.mark.skipif(not has_gspn, reason="No support for GSPNs") pars = pytest.mark.skipif(not has_pars, reason="No support for parametric model checking") diff --git a/tests/gspn/test_gspn.py b/tests/gspn/test_gspn.py index a89142e..3446c4d 100644 --- a/tests/gspn/test_gspn.py +++ b/tests/gspn/test_gspn.py @@ -2,7 +2,7 @@ import os import stormpy -from configurations import gspn +from configurations import gspn, xml @gspn @@ -211,6 +211,7 @@ class TestGSPNBuilder: tt_0 = gspn_import.get_timed_transition("tt_0") assert tt_0.get_id() == id_tt_0 + @xml def test_export_to_pnml(self, tmpdir): builder = stormpy.gspn.GSPNBuilder() builder.set_name("gspn_test")