Fix ocaml-ppxlib tests failing due to ocaml-sexplib0-0.15.0 (#5541)

This commit is contained in:
Olivia Crain 2023-05-22 08:41:32 -07:00 коммит произвёл GitHub
Родитель 9c25531329
Коммит 0923e30d32
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 94 добавлений и 11 удалений

Просмотреть файл

@ -11,7 +11,7 @@
Summary: Base library and tools for ppx rewriters
Name: ocaml-%{srcname}
Version: 0.24.0
Release: 2%{?dist}
Release: 3%{?dist}
License: MIT
Vendor: Microsoft Corporation
Distribution: Mariner
@ -19,6 +19,7 @@ URL: https://github.com/ocaml-ppx/ppxlib
Source0: https://github.com/ocaml-ppx/ppxlib/releases/download/%{version}/%{srcname}-%{version}.tbz
# We do not have 'stdlib-shims'.
Patch0: %{name}-stdlib-shims.patch
Patch1: test-fix-sexplib0-0.15.0.patch
BuildRequires: ocaml >= 4.04.1
BuildRequires: ocaml-base-devel
@ -29,7 +30,7 @@ BuildRequires: ocaml-findlib
BuildRequires: ocaml-migrate-parsetree-devel >= 2.1.0
BuildRequires: ocaml-ppx-derivers-devel >= 1.0
BuildRequires: ocaml-re-devel >= 1.9.0
BuildRequires: ocaml-sexplib0-devel
BuildRequires: ocaml-sexplib0-devel >= 0.15.0
BuildRequires: ocaml-stdio-devel
%if %{with doc}
@ -104,16 +105,8 @@ find %{buildroot}%{_libdir}/ocaml -name \*.cmxs -exec chmod a+x {} \+
# We do not want to install the test binaries
rm -fr %{buildroot}%{_bindir}
# FIXME: On arm only, building the tests fails:
# /usr/bin/ld: src/.cinaps/.cinaps.eobjs/native/dune__exe__Cinaps.o: relocation R_ARM_THM_MOVW_ABS_NC against `camlCinaps_runtime' can not be used when making a shared object; recompile with -fPIC
# src/.cinaps/.cinaps.eobjs/native/dune__exe__Cinaps.o: in function `.L297': :(.text+0xdec): dangerous relocation: unsupported relocation
# <many more such warnings>
#
# Disable the tests on arm until we can figure out what is going wrong.
%ifnarch %{arm}
%check
dune runtest
%endif
%files
%doc CHANGES.md HISTORY.md README.md
@ -165,10 +158,14 @@ dune runtest
%endif
%changelog
* Fri May 19 2023 Olivia Crain <oliviacrain@microsoft.com> - 0.24.0-3
- Add upstream patch to fix tests with ocaml-sexplib0-0.15.0
- Remove %%{arm} arch gating on tests (not supported by Mariner)
* Thu Mar 31 2022 Pawel Winogrodzki <pawelwi@microsoft.com> - 0.24.0-2
- Cleaning-up spec. License verified.
* Tue Jan 18 2022 Thomas Crain <thcrain@microsoft.com> - 0.24.0-1
* Tue Jan 18 2022 Olivia Crain <oliviacrain@microsoft.com> - 0.24.0-1
- Upgrade to latest version
- License verified

Просмотреть файл

@ -0,0 +1,86 @@
From 99a8134486f3f5ffc5360034b7bd4ce3ada27112 Mon Sep 17 00:00:00 2001
From: Kate <kit.ty.kate@disroot.org>
Date: Fri, 5 Aug 2022 21:56:46 +0100
Subject: [PATCH] Upgrade the tests to sexplib0.v0.15
Signed-off-by: Kate <kit.ty.kate@disroot.org>
Signed-off-by: Olivia Crain <oliviacrain@microsoft.com>
---
test/base/test.ml | 6 +++---
test/driver/exception_handling/run.t | 10 +++++-----
test/ppx_import_support/test.ml | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/test/base/test.ml b/test/base/test.ml
index 7cf282a5..77c27e52 100644
--- a/test/base/test.ml
+++ b/test/base/test.ml
@@ -106,17 +106,17 @@ let _ = convert_longident "Base.( land )"
let _ = convert_longident "A(B)"
[%%expect{|
-Exception: (Invalid_argument "Ppxlib.Longident.parse: \"A(B)\"")
+Exception: Invalid_argument "Ppxlib.Longident.parse: \"A(B)\"".
|}]
let _ = convert_longident "A.B(C)"
[%%expect{|
-Exception: (Invalid_argument "Ppxlib.Longident.parse: \"A.B(C)\"")
+Exception: Invalid_argument "Ppxlib.Longident.parse: \"A.B(C)\"".
|}]
let _ = convert_longident ")"
[%%expect{|
-Exception: (Invalid_argument "Ppxlib.Longident.parse: \")\"")
+Exception: Invalid_argument "Ppxlib.Longident.parse: \")\"".
|}]
let _ = Ppxlib.Code_path.(file_path @@ top_level ~file_path:"dir/main.ml")
diff --git a/test/driver/exception_handling/run.t b/test/driver/exception_handling/run.t
index f0a5cc6f..d303b148 100644
--- a/test/driver/exception_handling/run.t
+++ b/test/driver/exception_handling/run.t
@@ -102,10 +102,10 @@ and the whole AST is prepended with an error extension node.
$ echo "let _ = [%gen_raise_exc] + [%gen_raise_exc]" > impl.ml
$ ./extender.exe impl.ml
- Fatal error: exception (Failure "A raised exception")
+ Fatal error: exception Failure("A raised exception")
[2]
$ ./extender.exe -embed-errors impl.ml
- Fatal error: exception (Failure "A raised exception")
+ Fatal error: exception Failure("A raised exception")
[2]
In the case of derivers
@@ -113,14 +113,14 @@ and the whole AST is prepended with an error extension node.
$ echo "type a = int" > impl.ml
$ echo "type b = int [@@deriving deriver_raised_exception]" >> impl.ml
$ ./deriver.exe -embed-errors impl.ml
- Fatal error: exception (Failure "A raised exception")
+ Fatal error: exception Failure("A raised exception")
[2]
In the case of whole file transformations:
$ ./whole_file_exception.exe impl.ml
- Fatal error: exception (Failure "An exception in a whole file transform")
+ Fatal error: exception Failure("An exception in a whole file transform")
[2]
$ ./whole_file_exception.exe -embed-errors impl.ml
- Fatal error: exception (Failure "An exception in a whole file transform")
+ Fatal error: exception Failure("An exception in a whole file transform")
[2]
diff --git a/test/ppx_import_support/test.ml b/test/ppx_import_support/test.ml
index e32d39b0..66fd12bf 100644
--- a/test/ppx_import_support/test.ml
+++ b/test/ppx_import_support/test.ml
@@ -108,6 +108,6 @@ let id_for_core_types =
(fun ~ctxt:_ core_type -> core_type)
[%%expect{|
Exception:
-(Failure
- "Some ppx-es tried to register conflicting transformations: Extension 'id' on type declarations matches extension 'id'")
+Failure
+ "Some ppx-es tried to register conflicting transformations: Extension 'id' on type declarations matches extension 'id'".
|}]