From 1fc316b85eb210a3dbba6fb843f4b64f56b3270d Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 13 Oct 2017 18:43:35 +0200 Subject: [PATCH] Installation fixes + safe-string compatibility --- Changelog | 6 ++++ src/Makefile | 9 +++--- test/test.ml | 2 ++ test/test_ratios.ml | 72 ++++++++++++++++++++++----------------------- 4 files changed, 49 insertions(+), 40 deletions(-) diff --git a/Changelog b/Changelog index 393f9c2..791b18b 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,9 @@ +Release 1.1 (2017-10-13): + +- Install .cmx files as well. +- Fix permissions on installed files. +- Make tests compatible with safe strings. + Release 1.0 (2017-06-04): - Fix build rule for nums.cmxs. diff --git a/src/Makefile b/src/Makefile index ab6a5b6..97dc074 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,7 +3,8 @@ OCAMLOPT=ocamlopt OCAMLDEP=ocamldep OCAMLMKLIB=ocamlmklib OCAMLFIND=ocamlfind -INSTALL=install +INSTALL_DATA=install -m 644 +INSTALL_DLL=install STDLIBDIR=$(shell $(OCAMLC) -where) include $(STDLIBDIR)/Makefile.config @@ -74,7 +75,7 @@ nat_stubs.$(O): bng.h nat.h TOINSTALL=nums.cma libnums.$(A) $(CMIS) $(CMIS:.cmi=.mli) $(CMIS:.cmi=.cmti) ifneq "$(ARCH)" "none" -TOINSTALL+=nums.cmxa nums.$(A) +TOINSTALL+=nums.cmxa nums.$(A) $(CMIS:.cmi=.cmx) endif ifeq "$(NATDYNLINK)" "true" TOINSTALL+=nums.cmxs @@ -83,9 +84,9 @@ TOINSTALL_STUBS=dllnums.$(SO) install: $(OCAMLFIND) install num META - $(INSTALL) $(TOINSTALL) $(STDLIBDIR) + $(INSTALL_DATA) $(TOINSTALL) $(STDLIBDIR) ifeq "$(SUPPORTS_SHARED_LIBRARIES)" "true" - $(INSTALL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs + $(INSTALL_DLL) $(TOINSTALL_STUBS) $(STDLIBDIR)/stublibs endif uninstall: diff --git a/test/test.ml b/test/test.ml index 431ceee..359fe80 100644 --- a/test/test.ml +++ b/test/test.ml @@ -75,6 +75,8 @@ let end_tests () = let eq = (==);; let eq_int (i: int) (j: int) = (i = j);; let eq_string (i: string) (j: string) = (i = j);; +let eq_bytes (i: bytes) (j: bytes) = (i = j);; +let eq_bytes_string (i: bytes) (j: string) = (i = Bytes.of_string j);; let eq_nativeint (i: nativeint) (j: nativeint) = (i = j);; let eq_int32 (i: int32) (j: int32) = (i = j);; let eq_int64 (i: int64) (j: int64) = (i = j);; diff --git a/test/test_ratios.ml b/test/test_ratios.ml index 7e027a1..aa5819d 100644 --- a/test/test_ratios.ml +++ b/test/test_ratios.ml @@ -965,72 +965,72 @@ msd_ratio (create_ratio (big_int_of_int 0) (big_int_of_int 0)) testing_function "round_futur_last_digit" ;; -let s = "+123456" in -test 1 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "+123456" in +test 1 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && -test 2 eq_string (s, "+123466") +test 2 eq_bytes_string (s, "+123466") ;; -let s = "123456" in -test 3 eq (round_futur_last_digit s 0 (String.length s), false) && -test 4 eq_string (s, "123466") +let s = Bytes.of_string "123456" in +test 3 eq (round_futur_last_digit s 0 (Bytes.length s), false) && +test 4 eq_bytes_string (s, "123466") ;; -let s = "-123456" in -test 5 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "-123456" in +test 5 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && -test 6 eq_string (s, "-123466") +test 6 eq_bytes_string (s, "-123466") ;; -let s = "+123496" in -test 7 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "+123496" in +test 7 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && -test 8 eq_string (s, "+123506") +test 8 eq_bytes_string (s, "+123506") ;; -let s = "123496" in -test 9 eq (round_futur_last_digit s 0 (String.length s), false) && -test 10 eq_string (s, "123506") +let s = Bytes.of_string "123496" in +test 9 eq (round_futur_last_digit s 0 (Bytes.length s), false) && +test 10 eq_bytes_string (s, "123506") ;; -let s = "-123496" in -test 11 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "-123496" in +test 11 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && -test 12 eq_string (s, "-123506") +test 12 eq_bytes_string (s, "-123506") ;; -let s = "+996" in -test 13 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "+996" in +test 13 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), true) && -test 14 eq_string (s, "+006") +test 14 eq_bytes_string (s, "+006") ;; -let s = "996" in -test 15 eq (round_futur_last_digit s 0 (String.length s), true) && -test 16 eq_string (s, "006") +let s = Bytes.of_string "996" in +test 15 eq (round_futur_last_digit s 0 (Bytes.length s), true) && +test 16 eq_bytes_string (s, "006") ;; -let s = "-996" in -test 17 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "-996" in +test 17 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), true) && -test 18 eq_string (s, "-006") +test 18 eq_bytes_string (s, "-006") ;; -let s = "+6666666" in -test 19 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "+6666666" in +test 19 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && -test 20 eq_string (s, "+6666676") +test 20 eq_bytes_string (s, "+6666676") ;; -let s = "6666666" in -test 21 eq (round_futur_last_digit s 0 (String.length s), false) && -test 22 eq_string (s, "6666676") +let s = Bytes.of_string "6666666" in +test 21 eq (round_futur_last_digit s 0 (Bytes.length s), false) && +test 22 eq_bytes_string (s, "6666676") ;; -let s = "-6666666" in -test 23 eq (round_futur_last_digit s 1 (pred (String.length s)), +let s = Bytes.of_string "-6666666" in +test 23 eq (round_futur_last_digit s 1 (pred (Bytes.length s)), false) && -test 24 eq_string (s, "-6666676") +test 24 eq_bytes_string (s, "-6666676") ;; testing_function "approx_ratio_fix"