[PPL-devel] [GIT] ppl/ppl(master): Let OCaml tests also link with the pwl library, if configured.
Enea Zaffanella
zaffanella at cs.unipr.it
Mon Mar 30 15:02:54 CEST 2009
Module: ppl/ppl
Branch: master
Commit: 3a4ca18a89472ed184229e24b82b29229d86163b
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3a4ca18a89472ed184229e24b82b29229d86163b
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Mon Mar 30 16:01:01 2009 +0200
Let OCaml tests also link with the pwl library, if configured.
---
interfaces/OCaml/Makefile.am | 11 ++++++++-
interfaces/OCaml/tests/Makefile.am | 22 ++++++++++++-------
interfaces/OCaml/tests/test1.ml | 41 ++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/interfaces/OCaml/Makefile.am b/interfaces/OCaml/Makefile.am
index 9f88c7f..26fce87 100644
--- a/interfaces/OCaml/Makefile.am
+++ b/interfaces/OCaml/Makefile.am
@@ -148,8 +148,16 @@ ppl_ocaml_Constraints_Product_NNC_Polyhedron_Grid.cc \
ppl_ocaml_Constraints_Product_Grid_C_Polyhedron.cc \
ppl_ocaml_Constraints_Product_Grid_NNC_Polyhedron.cc
+if BUILD_WATCHDOG_LIBRARY
+
+WATCHDOG_LIBRARY = $(top_builddir)/Watchdog/src/libpwl.la
+WATCHDOG_INCLUDE_OPTIONS = -I$(top_builddir)/Watchdog/src
+
+endif BUILD_WATCHDOG_LIBRARY
+
libppl_ocaml_a_LIBADD = \
- at required_instantiations_ocaml_cxx_objects@
+ at required_instantiations_ocaml_cxx_objects@ \
+$(WATCHDOG_LIBRARY)
libppl_ocaml_a_DEPENDENCIES = \
@required_instantiations_ocaml_cxx_objects@
@@ -174,6 +182,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/interfaces \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
+$(WATCHDOG_INCLUDE_OPTIONS) \
@extra_includes@
interface_generator_dependencies = \
diff --git a/interfaces/OCaml/tests/Makefile.am b/interfaces/OCaml/tests/Makefile.am
index 7892220..f6047ca 100644
--- a/interfaces/OCaml/tests/Makefile.am
+++ b/interfaces/OCaml/tests/Makefile.am
@@ -74,13 +74,19 @@ OCAMLOPT_LINK_FLAGS = $(OCAMLC_LINK_FLAGS)
if ENABLE_SHARED
-BUILT_PPL = \
-$(top_builddir)/src/.libs/libppl$(SHREXT)
+BUILT_PPL_FLAGS = -cclib $(top_builddir)/src/.libs/libppl$(SHREXT)
+
+if BUILD_WATCHDOG_LIBRARY
+BUILT_PWL_FLAGS = -cclib $(top_builddir)/Watchdog/src/.libs/libpwl$(SHREXT)
+endif BUILD_WATCHDOG_LIBRARY
else !ENABLE_SHARED
-BUILT_PPL = \
-$(top_builddir)/src/.libs/libppl.$(LIBEXT)
+BUILT_PPL_FLAGS = -cclib $(top_builddir)/src/.libs/libppl.$(LIBEXT)
+
+if BUILD_WATCHDOG_LIBRARY
+BUILT_PWL_FLAGS = -cclib $(top_builddir)/Watchdog/src/.libs/libpwl.$(LIBEXT)
+endif BUILD_WATCHDOG_LIBRARY
endif !ENABLE_SHARED
@@ -115,7 +121,7 @@ test1_SOURCES = test1.ml
test1$(EXEEXT): test1.cmo ../ppl_ocaml.cma
$(OCAMLC_ENV) ocamlc -o $@ \
-cc "$(CXX)" $(OCAMLC_COMPILE_FLAGS) \
- -cclib $(BUILT_PPL) $(OCAMLC_LINK_FLAGS) \
+ $(BUILT_PPL_FLAGS) $(BUILT_PWL_FLAGS) $(OCAMLC_LINK_FLAGS) \
ppl_ocaml.cma $<
test1_opt_SOURCES = test1.ml
@@ -123,7 +129,7 @@ test1_opt_SOURCES = test1.ml
test1_opt$(EXEEXT): test1.cmx ../ppl_ocaml.cmxa
$(OCAMLOPT_ENV) ocamlopt -o $@ \
-cc "$(CXX)" $(OCAMLOPT_COMPILE_FLAGS) \
- -cclib $(BUILT_PPL) $(OCAMLOPT_LINK_FLAGS) \
+ $(BUILT_PPL_FLAGS) $(BUILT_PWL_FLAGS) $(OCAMLC_LINK_FLAGS) \
ppl_ocaml.cmxa $<
@@ -141,14 +147,14 @@ ppl_ocaml_generated_test$(EXEEXT): \
ppl_ocaml_generated_test.cmo ../ppl_ocaml.cma
$(OCAMLC_ENV) ocamlc -o $@ \
-cc "$(CXX)" $(OCAMLC_COMPILE_FLAGS) \
- -cclib $(BUILT_PPL) $(OCAMLC_LINK_FLAGS) \
+ $(BUILT_PPL_FLAGS) $(BUILT_PWL_FLAGS) $(OCAMLC_LINK_FLAGS) \
ppl_ocaml.cma $<
ppl_ocaml_generated_test_opt$(EXEEXT): \
ppl_ocaml_generated_test.cmx ../ppl_ocaml.cmxa
$(OCAMLOPT_ENV) ocamlopt -o $@ \
-cc "$(CXX)" $(OCAMLOPT_COMPILE_FLAGS) \
- -cclib $(BUILT_PPL) $(OCAMLOPT_LINK_FLAGS) \
+ $(BUILT_PPL_FLAGS) $(BUILT_PWL_FLAGS) $(OCAMLC_LINK_FLAGS) \
ppl_ocaml.cmxa $<
MOSTLYCLEANFILES = \
diff --git a/interfaces/OCaml/tests/test1.ml b/interfaces/OCaml/tests/test1.ml
index 19caca4..3366c85 100644
--- a/interfaces/OCaml/tests/test1.ml
+++ b/interfaces/OCaml/tests/test1.ml
@@ -219,6 +219,47 @@ let congruence1 = (e2, e2 , (Z.from_int 1));;
let congruences1 = [e3, e2 , (Z.from_int 20)];;
let grid_generator1 = Grid_Point (e3, (Z.from_int 1));;
+(* Testing timeouts *)
+let lower = Coefficient(Gmp.Z.of_int 0)
+in let upper = Coefficient(Gmp.Z.of_int 1)
+in let rec hypercube_cs dim =
+ begin
+ if dim < 0 then []
+ else
+ Greater_Or_Equal(Variable dim, lower)
+ :: Less_Or_Equal(Variable dim, upper)
+ :: hypercube_cs (dim-1)
+ end
+in let rec compute_timeout_hypercube dim_in dim_out =
+ if dim_in < dim_out then
+ let ph = ppl_new_C_Polyhedron_from_constraints (hypercube_cs dim_in)
+ in begin
+(* FIXME.
+ try
+ let () = ppl_Polyhedron_get_minimized_constraints ph;
+ ppl_delete_Polyhedron ph
+ with x ->
+ raise x;
+*)
+ compute_timeout_hypercube (dim_in + 1) dim_out
+ end
+in begin
+ try
+ ppl_set_timeout 100;
+ compute_timeout_hypercube 0 2;
+ ppl_reset_timeout;
+ print_string_if_noisy "ppl_reset_timeout test succeeded\n";
+ with x ->
+ print_string_if_noisy "ppl_reset_timeout test seems to be failed!\n";
+ try
+ ppl_set_timeout 100;
+ compute_timeout_hypercube 0 100;
+ ppl_reset_timeout;
+ print_string_if_noisy "ppl_set_timeout test seems to be failed!\n";
+ with x ->
+ print_string_if_noisy "ppl_set_timeout test succeded\n";
+ end;;
+
let mip1 = ppl_new_MIP_Problem 10 constraints1 e3 Maximization;;
let objective_func = ppl_MIP_Problem_objective_function mip1;;
print_string_if_noisy "\n";;
More information about the PPL-devel
mailing list