diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index d0200de666..ff1e49e194 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -91,7 +91,7 @@ jobs: - run: opam install lwt_react lwt --deps-only --with-test - - run: opam install lwt_ppx lwt_ppx_let --deps-only --with-test + - run: opam install lwt_ppx --deps-only --with-test if: ${{ matrix.ppx == true }} - run: opam exec -- dune build --only-packages lwt_react,lwt @@ -104,9 +104,6 @@ jobs: - run: opam exec -- dune runtest --only-packages lwt_ppx if: ${{ matrix.ppx == true }} - - run: opam exec -- make ppx_let-test - if: ${{ matrix.ppx == true }} - lint-opam: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index c019ef2d6d..f47edb20ff 100644 --- a/.gitignore +++ b/.gitignore @@ -30,8 +30,3 @@ lib/ # Wikidoc output. /docs/api/ - -# Junk from packaging tests. -*.cm* -*.o -a.out diff --git a/Makefile b/Makefile index 29ef2277e1..7a40d9062e 100644 --- a/Makefile +++ b/Makefile @@ -44,32 +44,6 @@ doc-api-html: build doc-api-wiki: build $(MAKE) -C docs api/wiki/index.wiki -# Packaging tests. These are run with Lwt installed by OPAM, typically during -# CI. To run locally, run the install-for-packaging-test target first. -.PHONY: packaging-test -packaging-test: - ocamlfind query lwt - for TEST in `ls -d test/packaging/*/*` ; \ - do \ - $(MAKE) -wC $$TEST || exit 1 ; \ - echo ; \ - echo ; \ - done - -.PHONY: install-for-packaging-test -install-for-packaging-test: clean - opam pin add --yes --no-action lwt . - opam pin add --yes --no-action lwt_ppx . - opam pin add --yes --no-action lwt_react . - opam reinstall --yes lwt lwt_ppx lwt_react - -.PHONY: uninstall-after-packaging-test -uninstall-after-packaging-test: - opam remove --yes lwt lwt_ppx lwt_react - opam pin remove --yes lwt - opam pin remove --yes lwt_ppx - opam pin remove --yes lwt_react - # ppx_let integration test. .PHONY : ppx_let-test ppx_let-test : @@ -81,10 +55,6 @@ clean : dune clean rm -fr docs/api rm -f src/unix/discover_arguments - for TEST in `ls -d test/packaging/*/*` ; \ - do \ - $(MAKE) -wC $$TEST clean ; \ - done rm -rf _coverage/ EXPECTED_FILES := \ diff --git a/dune-project b/dune-project index 782590fc2b..c7f9767e8c 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 1.12) +(lang dune 2.0) (name lwt) @@ -12,21 +12,13 @@ (source (github ocsigen/lwt)) (documentation "https://ocsigen.org/lwt") -(package - (name lwt_ppx_let) - (synopsis "Dummy package context for ppx_let tests") - (description "Internal package used to partition ppx_let tests.") - (depends - (ocaml (>= 4.08)) - (ppx_let :with-test) - lwt)) - (package (name lwt_ppx) (synopsis "PPX syntax for Lwt, providing something similar to async/await from JavaScript") (depends (ocaml (>= 4.08)) (ppxlib (>= 0.16.0)) + (ppx_let :with-test) lwt)) (package diff --git a/lwt.opam b/lwt.opam index cb65673fe5..f2cb21e1bc 100644 --- a/lwt.opam +++ b/lwt.opam @@ -20,7 +20,7 @@ homepage: "https://github.com/ocsigen/lwt" doc: "https://ocsigen.org/lwt" bug-reports: "https://github.com/ocsigen/lwt/issues" depends: [ - "dune" {>= "1.12"} + "dune" {>= "2.0"} "ocaml" {>= "4.08"} "cppo" {build & >= "1.1.0"} "ocamlfind" {dev & >= "1.7.3-1"} @@ -54,4 +54,3 @@ build: [ "@doc" {with-doc} ] ] -available: os-family != "windows" | "ocaml-version" < "5.2" diff --git a/lwt_ppx.opam b/lwt_ppx.opam index b4a6b08fdc..4bdd4df724 100644 --- a/lwt_ppx.opam +++ b/lwt_ppx.opam @@ -11,11 +11,13 @@ homepage: "https://github.com/ocsigen/lwt" doc: "https://ocsigen.org/lwt" bug-reports: "https://github.com/ocsigen/lwt/issues" depends: [ - "dune" {>= "1.12"} + "dune" {>= "2.0"} "ocaml" {>= "4.08"} "ppxlib" {>= "0.16.0"} + "ppx_let" {with-test} "lwt" ] +dev-repo: "git+https://github.com/ocsigen/lwt.git" build: [ ["dune" "subst"] {dev} [ @@ -30,4 +32,3 @@ build: [ "@doc" {with-doc} ] ] -dev-repo: "git+https://github.com/ocsigen/lwt.git" diff --git a/lwt_ppx.opam.template b/lwt_ppx.opam.template new file mode 100644 index 0000000000..87c8e5dcde --- /dev/null +++ b/lwt_ppx.opam.template @@ -0,0 +1,14 @@ +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] diff --git a/lwt_ppx_let.opam b/lwt_ppx_let.opam deleted file mode 100644 index 7ce9fe37eb..0000000000 --- a/lwt_ppx_let.opam +++ /dev/null @@ -1,33 +0,0 @@ -# This file is generated by dune, edit dune-project instead -opam-version: "2.0" -synopsis: "Dummy package context for ppx_let tests" -description: "Internal package used to partition ppx_let tests." -maintainer: [ - "Raphaël Proust " "Anton Bachin " -] -authors: ["Jérôme Vouillon" "Jérémie Dimino"] -license: "MIT" -homepage: "https://github.com/ocsigen/lwt" -doc: "https://ocsigen.org/lwt" -bug-reports: "https://github.com/ocsigen/lwt/issues" -depends: [ - "dune" {>= "1.12"} - "ocaml" {>= "4.08"} - "ppx_let" {with-test} - "lwt" -] -build: [ - ["dune" "subst"] {dev} - [ - "dune" - "build" - "-p" - name - "-j" - jobs - "@install" - "@runtest" {with-test} - "@doc" {with-doc} - ] -] -dev-repo: "git+https://github.com/ocsigen/lwt.git" diff --git a/lwt_react.opam b/lwt_react.opam index 236db54bb5..39a9f58d93 100644 --- a/lwt_react.opam +++ b/lwt_react.opam @@ -10,12 +10,13 @@ homepage: "https://github.com/ocsigen/lwt" doc: "https://ocsigen.org/lwt" bug-reports: "https://github.com/ocsigen/lwt/issues" depends: [ - "dune" {>= "1.12"} + "dune" {>= "2.0"} "ocaml" {>= "4.08"} "cppo" {build & >= "1.1.0"} "lwt" {>= "3.0.0"} "react" {>= "1.0.0"} ] +dev-repo: "git+https://github.com/ocsigen/lwt.git" build: [ ["dune" "subst"] {dev} [ @@ -30,4 +31,3 @@ build: [ "@doc" {with-doc} ] ] -dev-repo: "git+https://github.com/ocsigen/lwt.git" diff --git a/lwt_react.opam.template b/lwt_react.opam.template new file mode 100644 index 0000000000..87c8e5dcde --- /dev/null +++ b/lwt_react.opam.template @@ -0,0 +1,14 @@ +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] diff --git a/src/unix/dune b/src/unix/dune index d5ce0459d2..830eb256af 100644 --- a/src/unix/dune +++ b/src/unix/dune @@ -51,139 +51,139 @@ let () = Jbuild_plugin.V1.send @@ {| (wrapped false) (libraries bigarray lwt ocplib-endian.bigstring threads unix) |} ^ preprocess ^ {| - (c_names - lwt_unix_stubs - lwt_libev_stubs - lwt_process_stubs - unix_readable - unix_writable - unix_madvise - unix_get_page_size - windows_get_page_size - unix_mincore - unix_read - unix_pread - windows_read - windows_pread - unix_bytes_read - windows_bytes_read - unix_write - unix_pwrite - windows_write - windows_pwrite - unix_bytes_write - windows_bytes_write - unix_readv_writev_utils - unix_iov_max - unix_writev - unix_writev_job - unix_readv - unix_readv_job - unix_send - unix_bytes_send - unix_recv - unix_bytes_recv - unix_recvfrom - unix_bytes_recvfrom - unix_sendto - unix_sendto_byte - unix_bytes_sendto - unix_bytes_sendto_byte - unix_recv_send_utils - unix_recv_msg - unix_send_msg - unix_send_msg_byte - unix_get_credentials - unix_mcast_utils - unix_mcast_set_loop - unix_mcast_set_ttl - unix_mcast_modify_membership - unix_wait4 - unix_get_cpu - unix_get_affinity - unix_set_affinity - unix_guess_blocking_job - unix_wait_mincore_job - unix_open_job - unix_read_job - unix_pread_job - windows_read_job - windows_pread_job - unix_bytes_read_job - windows_bytes_read_job - unix_write_job - windows_write_job - unix_pwrite_job - windows_pwrite_job - unix_bytes_write_job - windows_bytes_write_job - unix_stat_job_utils - unix_stat_job - unix_stat_64_job - unix_lstat_job - unix_lstat_64_job - unix_fstat_job - unix_fstat_64_job - unix_utimes_job - unix_isatty_job - unix_opendir_job - unix_closedir_job - unix_valid_dir - unix_invalidate_dir - unix_rewinddir_job - unix_readdir_job - unix_readdir_n_job - unix_readlink_job - unix_lockf_job - unix_getlogin_job - unix_get_pw_gr_nam_id_job - unix_get_network_information_utils - unix_gethostname_job - unix_gethostbyname_job - unix_gethostbyaddr_job - unix_getprotoby_getservby_job - unix_getaddrinfo_job - unix_getnameinfo_job - unix_bind_job - unix_getcwd_job - unix_termios_conversion - unix_tcgetattr_job - unix_tcsetattr_job - windows_is_socket - windows_fsync_job - windows_system_job - windows_not_available - unix_not_available - unix_access_job - unix_chdir_job - unix_chmod_job - unix_chown_job - unix_chroot_job - unix_close_job - unix_fchmod_job - unix_fchown_job - unix_fdatasync_job - unix_fsync_job - unix_ftruncate_job - unix_link_job - unix_lseek_job - unix_mkdir_job - unix_mkfifo_job - unix_rename_job - unix_rmdir_job - unix_symlink_job - unix_tcdrain_job - unix_tcflow_job - unix_tcflush_job - unix_tcsendbreak_job - unix_truncate_job - unix_unlink_job - unix_somaxconn - windows_somaxconn - unix_accept4 - ) (install_c_headers lwt_features lwt_config lwt_unix) - (c_flags -I. (:include unix_c_flags.sexp)) + (foreign_stubs + (language c) + (names + lwt_unix_stubs + lwt_libev_stubs + lwt_process_stubs + unix_readable + unix_writable + unix_madvise + unix_get_page_size + windows_get_page_size + unix_mincore + unix_read + unix_pread + windows_read + windows_pread + unix_bytes_read + windows_bytes_read + unix_write + unix_pwrite + windows_write + windows_pwrite + unix_bytes_write + windows_bytes_write + unix_readv_writev_utils + unix_iov_max + unix_writev + unix_writev_job + unix_readv + unix_readv_job + unix_send + unix_bytes_send + unix_recv + unix_bytes_recv + unix_recvfrom + unix_bytes_recvfrom + unix_sendto + unix_sendto_byte + unix_bytes_sendto + unix_bytes_sendto_byte + unix_recv_send_utils + unix_recv_msg + unix_send_msg + unix_send_msg_byte + unix_get_credentials + unix_mcast_utils + unix_mcast_set_loop + unix_mcast_set_ttl + unix_mcast_modify_membership + unix_wait4 + unix_get_cpu + unix_get_affinity + unix_set_affinity + unix_guess_blocking_job + unix_wait_mincore_job + unix_open_job + unix_read_job + unix_pread_job + windows_read_job + windows_pread_job + unix_bytes_read_job + windows_bytes_read_job + unix_write_job + windows_write_job + unix_pwrite_job + windows_pwrite_job + unix_bytes_write_job + windows_bytes_write_job + unix_stat_job_utils + unix_stat_job + unix_stat_64_job + unix_lstat_job + unix_lstat_64_job + unix_fstat_job + unix_fstat_64_job + unix_utimes_job + unix_isatty_job + unix_opendir_job + unix_closedir_job + unix_valid_dir + unix_invalidate_dir + unix_rewinddir_job + unix_readdir_job + unix_readdir_n_job + unix_readlink_job + unix_lockf_job + unix_getlogin_job + unix_get_pw_gr_nam_id_job + unix_get_network_information_utils + unix_gethostname_job + unix_gethostbyname_job + unix_gethostbyaddr_job + unix_getprotoby_getservby_job + unix_getaddrinfo_job + unix_getnameinfo_job + unix_bind_job + unix_getcwd_job + unix_termios_conversion + unix_tcgetattr_job + unix_tcsetattr_job + windows_is_socket + windows_fsync_job + windows_system_job + windows_not_available + unix_not_available + unix_access_job + unix_chdir_job + unix_chmod_job + unix_chown_job + unix_chroot_job + unix_close_job + unix_fchmod_job + unix_fchown_job + unix_fdatasync_job + unix_fsync_job + unix_ftruncate_job + unix_link_job + unix_lseek_job + unix_mkdir_job + unix_mkfifo_job + unix_rename_job + unix_rmdir_job + unix_symlink_job + unix_tcdrain_job + unix_tcflow_job + unix_tcflush_job + unix_tcsendbreak_job + unix_truncate_job + unix_unlink_job + unix_somaxconn + windows_somaxconn + unix_accept4) + (flags (:include unix_c_flags.sexp))) (c_library_flags (:include unix_c_library_flags.sexp))) - |} diff --git a/test/core/dune b/test/core/dune index e5e0e8c45c..b03d5ef183 100644 --- a/test/core/dune +++ b/test/core/dune @@ -1,10 +1,6 @@ -(executable +(test (name main) + (package lwt) (libraries lwttester) (preprocess (future_syntax)) (flags (:standard -w +A-40-42))) - -(alias - (name runtest) - (package lwt) - (action (run %{exe:main.exe}))) diff --git a/test/packaging/README.md b/test/packaging/README.md deleted file mode 100644 index e29c7ad143..0000000000 --- a/test/packaging/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Packaging tests - -This directory contains a few tiny programs that *depend* on Lwt, through one of -two build systems: Findlib or Dune. Each program is built to ensure that Lwt -packaging remains usable by Lwt users. To do this, run `make packaging-test` -from the Lwt repository root. Before that, you may want to run -`make install-for-packaging-test`. This will install Lwt and all helper -libraries into your current OPAM switch. The packaging tests are run against -this installation. diff --git a/test/packaging/dune/core/Makefile b/test/packaging/dune/core/Makefile deleted file mode 100644 index bec6ec2bbd..0000000000 --- a/test/packaging/dune/core/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY : test -test : clean - dune build user.exe --root . - _build/default/user.exe - -.PHONY : clean -clean : - dune clean --root . diff --git a/test/packaging/dune/core/dune b/test/packaging/dune/core/dune deleted file mode 100644 index bbdd2aecc9..0000000000 --- a/test/packaging/dune/core/dune +++ /dev/null @@ -1,3 +0,0 @@ -(executable - (name user) - (libraries lwt)) diff --git a/test/packaging/dune/core/user.ml b/test/packaging/dune/core/user.ml deleted file mode 100644 index 6e51afbe87..0000000000 --- a/test/packaging/dune/core/user.ml +++ /dev/null @@ -1,2 +0,0 @@ -let () = - Lwt.return_unit |> ignore diff --git a/test/packaging/dune/ppx/Makefile b/test/packaging/dune/ppx/Makefile deleted file mode 100644 index bec6ec2bbd..0000000000 --- a/test/packaging/dune/ppx/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY : test -test : clean - dune build user.exe --root . - _build/default/user.exe - -.PHONY : clean -clean : - dune clean --root . diff --git a/test/packaging/dune/ppx/dune b/test/packaging/dune/ppx/dune deleted file mode 100644 index 0f5c7809d6..0000000000 --- a/test/packaging/dune/ppx/dune +++ /dev/null @@ -1,4 +0,0 @@ -(executable - (name user) - (libraries lwt) - (preprocess (pps lwt_ppx))) diff --git a/test/packaging/dune/ppx/user.ml b/test/packaging/dune/ppx/user.ml deleted file mode 100644 index 40e73a1042..0000000000 --- a/test/packaging/dune/ppx/user.ml +++ /dev/null @@ -1,6 +0,0 @@ -let () = - let p = - let%lwt () = Lwt.return_unit in - Lwt.return_unit - in - ignore p diff --git a/test/packaging/dune/preemptive/Makefile b/test/packaging/dune/preemptive/Makefile deleted file mode 100644 index bec6ec2bbd..0000000000 --- a/test/packaging/dune/preemptive/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY : test -test : clean - dune build user.exe --root . - _build/default/user.exe - -.PHONY : clean -clean : - dune clean --root . diff --git a/test/packaging/dune/preemptive/dune b/test/packaging/dune/preemptive/dune deleted file mode 100644 index d9c5a0ef4b..0000000000 --- a/test/packaging/dune/preemptive/dune +++ /dev/null @@ -1,3 +0,0 @@ -(executable - (name user) - (libraries lwt.unix)) diff --git a/test/packaging/dune/preemptive/user.ml b/test/packaging/dune/preemptive/user.ml deleted file mode 100644 index a77c3b7644..0000000000 --- a/test/packaging/dune/preemptive/user.ml +++ /dev/null @@ -1,2 +0,0 @@ -let () = - Lwt_preemptive.simple_init |> ignore diff --git a/test/packaging/dune/unix/Makefile b/test/packaging/dune/unix/Makefile deleted file mode 100644 index bec6ec2bbd..0000000000 --- a/test/packaging/dune/unix/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY : test -test : clean - dune build user.exe --root . - _build/default/user.exe - -.PHONY : clean -clean : - dune clean --root . diff --git a/test/packaging/dune/unix/dune b/test/packaging/dune/unix/dune deleted file mode 100644 index d9c5a0ef4b..0000000000 --- a/test/packaging/dune/unix/dune +++ /dev/null @@ -1,3 +0,0 @@ -(executable - (name user) - (libraries lwt.unix)) diff --git a/test/packaging/dune/unix/user.ml b/test/packaging/dune/unix/user.ml deleted file mode 100644 index 09909fb8aa..0000000000 --- a/test/packaging/dune/unix/user.ml +++ /dev/null @@ -1,2 +0,0 @@ -let () = - Lwt_unix.stdout |> ignore diff --git a/test/packaging/ocamlfind/core/Makefile b/test/packaging/ocamlfind/core/Makefile deleted file mode 100644 index c4a4bbdce2..0000000000 --- a/test/packaging/ocamlfind/core/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY : test -test : clean - ocamlfind opt -package lwt -c user.ml - ocamlfind opt -package lwt -linkpkg user.cmx - ./a.out - -.PHONY : clean -clean : - rm -f *.cm* *.o a.out diff --git a/test/packaging/ocamlfind/core/user.ml b/test/packaging/ocamlfind/core/user.ml deleted file mode 100644 index 6e51afbe87..0000000000 --- a/test/packaging/ocamlfind/core/user.ml +++ /dev/null @@ -1,2 +0,0 @@ -let () = - Lwt.return_unit |> ignore diff --git a/test/packaging/ocamlfind/ppx/Makefile b/test/packaging/ocamlfind/ppx/Makefile deleted file mode 100644 index afabfc97b0..0000000000 --- a/test/packaging/ocamlfind/ppx/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY : test -test : clean - ocamlfind opt -package lwt_ppx -c user.ml - ocamlfind opt -package lwt -linkpkg user.cmx - ./a.out - -.PHONY : clean -clean : - rm -f *.cm* *.o a.out diff --git a/test/packaging/ocamlfind/ppx/user.ml b/test/packaging/ocamlfind/ppx/user.ml deleted file mode 100644 index 40e73a1042..0000000000 --- a/test/packaging/ocamlfind/ppx/user.ml +++ /dev/null @@ -1,6 +0,0 @@ -let () = - let p = - let%lwt () = Lwt.return_unit in - Lwt.return_unit - in - ignore p diff --git a/test/packaging/ocamlfind/preemptive/Makefile b/test/packaging/ocamlfind/preemptive/Makefile deleted file mode 100644 index 055657f0c3..0000000000 --- a/test/packaging/ocamlfind/preemptive/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY : test -test : clean - ocamlfind opt -package lwt.unix -c user.ml - ocamlfind opt -package lwt.unix -thread -linkpkg user.cmx - ./a.out - -.PHONY : clean -clean : - rm -f *.cm* *.o a.out diff --git a/test/packaging/ocamlfind/preemptive/user.ml b/test/packaging/ocamlfind/preemptive/user.ml deleted file mode 100644 index a77c3b7644..0000000000 --- a/test/packaging/ocamlfind/preemptive/user.ml +++ /dev/null @@ -1,2 +0,0 @@ -let () = - Lwt_preemptive.simple_init |> ignore diff --git a/test/packaging/ocamlfind/unix/Makefile b/test/packaging/ocamlfind/unix/Makefile deleted file mode 100644 index 6ef82babbc..0000000000 --- a/test/packaging/ocamlfind/unix/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY : test -test : clean - ocamlfind opt -package lwt.unix -c user.ml - ocamlfind opt -package lwt.unix -linkpkg -thread user.cmx - ./a.out - -.PHONY : clean -clean : - rm -f *.cm* *.o a.out diff --git a/test/packaging/ocamlfind/unix/user.ml b/test/packaging/ocamlfind/unix/user.ml deleted file mode 100644 index 09909fb8aa..0000000000 --- a/test/packaging/ocamlfind/unix/user.ml +++ /dev/null @@ -1,2 +0,0 @@ -let () = - Lwt_unix.stdout |> ignore diff --git a/test/ppx/dune b/test/ppx/dune index c90d449533..30d4d19573 100644 --- a/test/ppx/dune +++ b/test/ppx/dune @@ -1,10 +1,6 @@ -(executable +(test (name main) + (package lwt_ppx) (libraries lwttester) (preprocess (pps lwt_ppx)) (flags (:standard -warn-error -22))) - -(alias - (name runtest) - (package lwt_ppx) - (action (run %{exe:main.exe}))) diff --git a/test/ppx_expect/cases/let_1.expect b/test/ppx_expect/cases/let_1.expect deleted file mode 100644 index 522d0fa80f..0000000000 --- a/test/ppx_expect/cases/let_1.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/let_1.ml", line 2, characters 10-12: -Error: This pattern matches values of type unit - but a pattern was expected which matches values of type int diff --git a/test/ppx_expect/cases/let_1.ml b/test/ppx_expect/cases/let_1.ml deleted file mode 100644 index 91269ecb3b..0000000000 --- a/test/ppx_expect/cases/let_1.ml +++ /dev/null @@ -1,3 +0,0 @@ -let _ = - let%lwt () = Lwt.return 5 in - Lwt.return_unit;; diff --git a/test/ppx_expect/cases/let_2.expect b/test/ppx_expect/cases/let_2.expect deleted file mode 100644 index 954dda445d..0000000000 --- a/test/ppx_expect/cases/let_2.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/let_2.ml", line 3, characters 2-4: -Error: This expression has type unit but an expression was expected of type - 'a Lwt.t diff --git a/test/ppx_expect/cases/let_2.ml b/test/ppx_expect/cases/let_2.ml deleted file mode 100644 index 67c504d796..0000000000 --- a/test/ppx_expect/cases/let_2.ml +++ /dev/null @@ -1,3 +0,0 @@ -let _ = - let%lwt () = Lwt.return_unit in - ();; diff --git a/test/ppx_expect/cases/let_3.expect b/test/ppx_expect/cases/let_3.expect deleted file mode 100644 index c6bea7e51a..0000000000 --- a/test/ppx_expect/cases/let_3.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/let_3.ml", line 2, characters 33-35: -Error: This pattern matches values of type unit - but a pattern was expected which matches values of type int diff --git a/test/ppx_expect/cases/let_3.ml b/test/ppx_expect/cases/let_3.ml deleted file mode 100644 index 0173d77451..0000000000 --- a/test/ppx_expect/cases/let_3.ml +++ /dev/null @@ -1,3 +0,0 @@ -let _ = - let%lwt () = Lwt.return_unit and () = Lwt.return 5 in - Lwt.return_unit;; diff --git a/test/ppx_expect/cases/let_4.expect b/test/ppx_expect/cases/let_4.expect deleted file mode 100644 index a2abc6ad17..0000000000 --- a/test/ppx_expect/cases/let_4.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/let_4.ml", line 3, characters 14-17: -Error: This expression has type unit but an expression was expected of type - int diff --git a/test/ppx_expect/cases/let_4.ml b/test/ppx_expect/cases/let_4.ml deleted file mode 100644 index aedca6af2b..0000000000 --- a/test/ppx_expect/cases/let_4.ml +++ /dev/null @@ -1,3 +0,0 @@ -let _ = - let%lwt foo = Lwt.return_unit and bar = Lwt.return 5 in - Lwt.return (foo + bar);; diff --git a/test/ppx_expect/cases/match_1.expect b/test/ppx_expect/cases/match_1.expect deleted file mode 100644 index 6d4b4c3934..0000000000 --- a/test/ppx_expect/cases/match_1.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/match_1.ml", line 5, characters 4-6: -Error: This pattern matches values of type unit - but a pattern was expected which matches values of type int diff --git a/test/ppx_expect/cases/match_1.ml b/test/ppx_expect/cases/match_1.ml deleted file mode 100644 index 6337e6b6ce..0000000000 --- a/test/ppx_expect/cases/match_1.ml +++ /dev/null @@ -1,6 +0,0 @@ -let _ = - match%lwt - Lwt.return 5 - with - | () -> - Lwt.return_unit;; diff --git a/test/ppx_expect/cases/match_2.expect b/test/ppx_expect/cases/match_2.expect deleted file mode 100644 index 50edff2aea..0000000000 --- a/test/ppx_expect/cases/match_2.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/match_2.ml", line 3, characters 4-6: -Error: This expression has type unit but an expression was expected of type - 'a Lwt.t diff --git a/test/ppx_expect/cases/match_2.ml b/test/ppx_expect/cases/match_2.ml deleted file mode 100644 index 270c4bf669..0000000000 --- a/test/ppx_expect/cases/match_2.ml +++ /dev/null @@ -1,6 +0,0 @@ -let _ = - match%lwt - () - with - | () -> - Lwt.return_unit;; diff --git a/test/ppx_expect/cases/match_3.expect b/test/ppx_expect/cases/match_3.expect deleted file mode 100644 index c5a1aeb6d0..0000000000 --- a/test/ppx_expect/cases/match_3.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/match_3.ml", line 6, characters 4-5: -Error: This expression has type int but an expression was expected of type - 'a Lwt.t diff --git a/test/ppx_expect/cases/match_3.ml b/test/ppx_expect/cases/match_3.ml deleted file mode 100644 index a4cf199aa9..0000000000 --- a/test/ppx_expect/cases/match_3.ml +++ /dev/null @@ -1,6 +0,0 @@ -let _ = - match%lwt - Lwt.return_unit - with - | () -> - 5;; diff --git a/test/ppx_expect/cases/match_4.expect b/test/ppx_expect/cases/match_4.expect deleted file mode 100644 index a3eba242e9..0000000000 --- a/test/ppx_expect/cases/match_4.expect +++ /dev/null @@ -1,4 +0,0 @@ -File "cases/match_4.ml", line 8, characters 4-16: -Error: This expression has type int Lwt.t - but an expression was expected of type unit Lwt.t - Type int is not compatible with type unit diff --git a/test/ppx_expect/cases/match_4.ml b/test/ppx_expect/cases/match_4.ml deleted file mode 100644 index 069bf70640..0000000000 --- a/test/ppx_expect/cases/match_4.ml +++ /dev/null @@ -1,8 +0,0 @@ -let _ = - match%lwt - Lwt.return_unit - with - | () -> - Lwt.return_unit - | exception End_of_file -> - Lwt.return 5 diff --git a/test/ppx_expect/cases/match_5.expect b/test/ppx_expect/cases/match_5.expect deleted file mode 100644 index 043293640c..0000000000 --- a/test/ppx_expect/cases/match_5.expect +++ /dev/null @@ -1,2 +0,0 @@ -File "cases/match_5.ml", line 3, characters 2-61: -Error: match%lwt must contain at least one non-exception pattern. diff --git a/test/ppx_expect/cases/match_5.ml b/test/ppx_expect/cases/match_5.ml deleted file mode 100644 index 8d7416d4d5..0000000000 --- a/test/ppx_expect/cases/match_5.ml +++ /dev/null @@ -1,3 +0,0 @@ -let _ = - (* The ugly one-line match is for error message compatibility with 4.09. *) - match%lwt Lwt.return_unit with exception Exit -> Lwt.return 0 diff --git a/test/ppx_expect/cases/run_1.expect b/test/ppx_expect/cases/run_1.expect deleted file mode 100644 index 2cd1749c43..0000000000 --- a/test/ppx_expect/cases/run_1.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/run_1.ml", line 2, characters 0-26: -Warning 22: let%lwt should not be used at the module item level. -Replace let%lwt x = e by let x = Lwt_main.run (e) diff --git a/test/ppx_expect/cases/run_1.ml b/test/ppx_expect/cases/run_1.ml deleted file mode 100644 index a833e081ef..0000000000 --- a/test/ppx_expect/cases/run_1.ml +++ /dev/null @@ -1,2 +0,0 @@ -(* On one line for error message compatibility with 4.09. *) -let%lwt () = Lwt.return_unit diff --git a/test/ppx_expect/cases/run_2.expect b/test/ppx_expect/cases/run_2.expect deleted file mode 100644 index 73e8da868f..0000000000 --- a/test/ppx_expect/cases/run_2.expect +++ /dev/null @@ -1,2 +0,0 @@ -File "cases/run_2.ml", line 1, characters 4-7: -Error: Uninterpreted extension 'lwt'. diff --git a/test/ppx_expect/cases/run_2.ml b/test/ppx_expect/cases/run_2.ml deleted file mode 100644 index 6064704cec..0000000000 --- a/test/ppx_expect/cases/run_2.ml +++ /dev/null @@ -1,2 +0,0 @@ -let%lwt rec () = Lwt.return_unit -and () = Lwt.return_unit diff --git a/test/ppx_expect/cases/try_1.expect b/test/ppx_expect/cases/try_1.expect deleted file mode 100644 index 4a29abf131..0000000000 --- a/test/ppx_expect/cases/try_1.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/try_1.ml", line 3, characters 4-5: -Error: This expression has type int but an expression was expected of type - 'a Lwt.t diff --git a/test/ppx_expect/cases/try_1.ml b/test/ppx_expect/cases/try_1.ml deleted file mode 100644 index 933386459a..0000000000 --- a/test/ppx_expect/cases/try_1.ml +++ /dev/null @@ -1,4 +0,0 @@ -let _ = - try%lwt - 5 - with _ -> Lwt.return_unit;; diff --git a/test/ppx_expect/cases/try_2.expect b/test/ppx_expect/cases/try_2.expect deleted file mode 100644 index 14bf19f42f..0000000000 --- a/test/ppx_expect/cases/try_2.expect +++ /dev/null @@ -1,3 +0,0 @@ -File "cases/try_2.ml", line 4, characters 12-13: -Error: This expression has type int but an expression was expected of type - unit Lwt.t diff --git a/test/ppx_expect/cases/try_2.ml b/test/ppx_expect/cases/try_2.ml deleted file mode 100644 index 2e3e974c9d..0000000000 --- a/test/ppx_expect/cases/try_2.ml +++ /dev/null @@ -1,4 +0,0 @@ -let _ = - try%lwt - Lwt.return_unit - with _ -> 5;; diff --git a/test/ppx_expect/cases/try_3.expect b/test/ppx_expect/cases/try_3.expect deleted file mode 100644 index a8e14f7ce5..0000000000 --- a/test/ppx_expect/cases/try_3.expect +++ /dev/null @@ -1,4 +0,0 @@ -File "cases/try_3.ml", line 4, characters 12-24: -Error: This expression has type int Lwt.t - but an expression was expected of type unit Lwt.t - Type int is not compatible with type unit diff --git a/test/ppx_expect/cases/try_3.ml b/test/ppx_expect/cases/try_3.ml deleted file mode 100644 index cfb8e8a5c1..0000000000 --- a/test/ppx_expect/cases/try_3.ml +++ /dev/null @@ -1,4 +0,0 @@ -let _ = - try%lwt - Lwt.return_unit - with _ -> Lwt.return 5;; diff --git a/test/ppx_expect/dune b/test/ppx_expect/dune deleted file mode 100644 index 4d06644c62..0000000000 --- a/test/ppx_expect/dune +++ /dev/null @@ -1,9 +0,0 @@ -(executable - (name main) - (libraries lwttester)) - -; (alias -; (name runtest) -; (package lwt_ppx) -; (deps (source_tree cases)) -; (action (run %{exe:main.exe}))) diff --git a/test/ppx_expect/main.ml b/test/ppx_expect/main.ml deleted file mode 100644 index 567e46775d..0000000000 --- a/test/ppx_expect/main.ml +++ /dev/null @@ -1,80 +0,0 @@ -let test_directory = "cases" -let package_directory = "../../../install/default/lib" -let (//) = Filename.concat - -let _read_file name = - let buffer = Buffer.create 4096 in - let channel = open_in name in - - try - let rec read () = - try input_char channel |> Buffer.add_char buffer; read () - with End_of_file -> () - in - read (); - close_in channel; - - Buffer.contents buffer - - with exn -> - close_in_noerr channel; - raise exn - -let _command_failed ?status command = - match status with - | None -> Printf.sprintf "'%s' did not exit" command |> failwith - | Some v -> Printf.sprintf "'%s' failed with status %i" command v |> failwith - -let _run_int command = - match Unix.system command with - | Unix.WEXITED v -> v - | _ -> _command_failed command - -let run command = - let v = _run_int command in - if v <> 0 then _command_failed command ~status:v - -let diff reference result = - let command = Printf.sprintf "diff -au %s %s" reference result in - let status = _run_int (command ^ " > /dev/null") in - match status with - | 0 -> () - | 1 -> - let _ : int =_run_int (command ^ " > delta") in - let delta = _read_file "delta" in - Printf.eprintf "> %s:\n\n%s" command delta; - failwith "Output does not match expected" - | _ -> _command_failed command ~status - -let run_test name = - let ml_name = test_directory // name ^ ".ml" in - let expect_name = test_directory // name ^ ".expect" in - let fixed_name = test_directory // name ^ ".fixed" in - let command = - Printf.sprintf - "%s %s ocamlfind c %s -linkpkg -thread -package %s %s > %s 2>&1" - ("OCAMLPATH=" ^ package_directory) "OCAML_ERROR_STYLE=short" - "-color=never" "lwt.unix,lwt_ppx" ml_name fixed_name - in - ignore (_run_int command); - diff expect_name fixed_name - -let () = - let test_cases = - Sys.readdir test_directory - |> Array.to_list - |> List.filter (fun file -> Filename.check_suffix file ".ml") - |> List.map Filename.chop_extension - in - let only_if () = - Sys.cygwin = false && Sys.win32 = false - in - let suite = Test.suite "ppx_expect" ( - List.map (fun test_case -> - Test.test_direct test_case ~only_if (fun () -> - run_test test_case; - true - ) - ) test_cases) - in - Test.run "ppx_expect" [suite] diff --git a/test/ppx_let/dune b/test/ppx_let/dune index 71b4e5c5ba..87529263bf 100644 --- a/test/ppx_let/dune +++ b/test/ppx_let/dune @@ -1,9 +1,5 @@ -(executable +(test (name test) + (package lwt_ppx) ;; technically not part of lwt_ppx, but we want it tested and the dependency to ppxlib is already there (preprocess (pps ppx_let)) (libraries lwt lwt.unix)) - -(alias - (name runtest) - (package lwt_ppx_let) - (action (run %{exe:test.exe}))) diff --git a/test/react/dune b/test/react/dune index 7d236bf6b6..b7539ba6ee 100644 --- a/test/react/dune +++ b/test/react/dune @@ -1,8 +1,4 @@ -(executable +(test (name main) - (libraries lwt_react lwttester)) - -(alias - (name runtest) (package lwt_react) - (action (run %{exe:main.exe}))) + (libraries lwt_react lwttester)) diff --git a/test/unix/dune b/test/unix/dune index a918f6bb7c..9dc1df6431 100644 --- a/test/unix/dune +++ b/test/unix/dune @@ -18,44 +18,40 @@ (modules dummy) (libraries unix)) -(executable +(test (name main) + (package lwt) (libraries lwttester tester) - (modules main)) + (modules main) + (deps bytes_io_data %{exe:dummy.exe}) +) -(executable +(test (name ocaml_runtime_exc_1) (libraries lwt lwt.unix) (modules ocaml_runtime_exc_1)) -(executable +(test (name ocaml_runtime_exc_2) (libraries lwt lwt.unix) (modules ocaml_runtime_exc_2)) -(executable +(test (name ocaml_runtime_exc_3) (libraries lwt lwt.unix) (modules ocaml_runtime_exc_3)) -(executable +(test (name ocaml_runtime_exc_4) (libraries lwt lwt.unix) (modules ocaml_runtime_exc_4)) -(executable +(test (name ocaml_runtime_exc_5) (libraries lwt lwt.unix) (modules ocaml_runtime_exc_5)) -(executable +(test (name ocaml_runtime_exc_6) (libraries lwt lwt.unix) (modules ocaml_runtime_exc_6)) - -(alias - (name runtest) - (package lwt) - (action (run %{exe:main.exe})) - (deps bytes_io_data %{exe:dummy.exe}) -)