From d38f538c8e3fb285fb3c66b87eb68eba4ed074c3 Mon Sep 17 00:00:00 2001 From: Sebastian Weddmark Olsson Date: Mon, 2 Dec 2024 01:25:15 +0100 Subject: [PATCH] Update mochiweb and meck (#286) --- .github/workflows/test.yaml | 8 ++++---- Makefile | 27 ++++++++++++++----------- lib/edts_dialyzer/src/edts_dialyzer.erl | 20 +++++++++++++++--- test_data/manual/Dockerfile.otp26 | 9 ++++----- test_data/manual/Dockerfile.otp27 | 20 ++++++++++++++++++ 5 files changed, 60 insertions(+), 24 deletions(-) create mode 100644 test_data/manual/Dockerfile.otp27 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5e110f80..bcf41095 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -45,10 +45,10 @@ jobs: rebar3: "3.16.1" - otp: "25.3.2.15" rebar3: "3.22.1" - # - otp: "26.2.5.5" - # rebar3: "3.22.1" - # - otp: "27.1.2" - # rebar3: "3.22.1" + - otp: "26.2.5.5" + rebar3: "3.22.1" + - otp: "27.1.2" + rebar3: "3.22.1" steps: - name: Install Emacs uses: purcell/setup-emacs@master diff --git a/Makefile b/Makefile index af210c31..7c1a9750 100644 --- a/Makefile +++ b/Makefile @@ -29,10 +29,10 @@ rel/releases: deps/mochiweb/src: $(GIT) clone "https://github.com/mochi/mochiweb" deps/mochiweb - cd deps/mochiweb && $(GIT) checkout --detach 835b107a4da4550080d032623ff6ae9a18d02c37 + cd deps/mochiweb && $(GIT) checkout --detach 611254eb941e502227f221667389b98fd8e72d6f deps/meck/src: $(GIT) clone "https://github.com/eproxus/meck" deps/meck - cd deps/meck && $(GIT) checkout --detach cc47aab4b64a46a5409c1a93353d44a367b41454 + cd deps/meck && $(GIT) checkout --detach 59d61d87b42408779e7863b6e8544325bcf90efd deps/mochiweb: deps/mochiweb/src deps/mochiweb/ebin deps/meck: deps/meck/src deps/meck/ebin @@ -68,7 +68,8 @@ erlang.plt: $(DIALYZER) --quiet --build_plt --output_plt $@ --apps \ erts kernel stdlib mnesia crypto sasl eunit \ syntax_tools compiler tools debugger dialyzer \ - wx runtime_tools + wx runtime_tools ssl public_key asn1 inets xmerl \ + parsetools edts.plt: erlang.plt $(DIALYZER) --add_to_plt --plt erlang.plt -r lib/ deps/ --output_plt $@ @@ -78,17 +79,17 @@ manual-tests: $(OTP_TESTS) byte-compilation-test .PHONY: integration-tests integration-tests: all test-projects - $(EMACS) -Q --batch \ - -L $(ERLANG_EMACS_LIB) \ - -l test_data/load-tests.el \ + $(EMACS) --quick --batch \ + --directory $(ERLANG_EMACS_LIB) \ + --load test_data/load-tests.el \ --debug-init \ - -f edts-test-run-suites-batch-and-exit + --funcall edts-test-run-suites-batch-and-exit .PHONY: ert ert: test-projects - $(EMACS) -Q --batch \ - -L $(ERLANG_EMACS_LIB) \ - -l test_data/load-tests.el \ + $(EMACS) --quick --batch \ + --directory $(ERLANG_EMACS_LIB) \ + --load test_data/load-tests.el \ --debug-init \ --eval "(ert-run-tests-batch-and-exit '(not (tag edts-test-suite)))" @@ -108,8 +109,10 @@ byte-compilation-test: -u $(shell id -u) \ silex/emacs \ /bin/bash -c \ - 'emacs -Q --batch -L ${PWD} -l test_data/package-install-deps.el \ - -f batch-byte-compile *.el elisp/edts/*.el lib/**/*.el' + 'emacs --quick --batch \ + --directory ${PWD} \ + --load test_data/package-install-deps.el \ + --funcall batch-byte-compile *.el elisp/edts/*.el lib/**/*.el' .PHONY: $(OTP_TESTS) $(OTP_TESTS): diff --git a/lib/edts_dialyzer/src/edts_dialyzer.erl b/lib/edts_dialyzer/src/edts_dialyzer.erl index 0fb36f50..1ce5e55d 100644 --- a/lib/edts_dialyzer/src/edts_dialyzer.erl +++ b/lib/edts_dialyzer/src/edts_dialyzer.erl @@ -168,9 +168,7 @@ create_plt(BasePlt0, OutPlt, Files) -> BasePlt = case BasePlt0 of undefined -> - try dialyzer_plt:get_default_plt() - catch throw:{dialyzer_error, _} -> undefined - end; + try_get_default_plt(); _ when is_list(BasePlt0) -> BasePlt0 end, VarOpts = @@ -181,6 +179,22 @@ create_plt(BasePlt0, OutPlt, Files) -> dialyzer:run(BaseOpts ++ VarOpts). +-ifndef(OTP_RELEASE). % OTP-19 and lesser +-def(OTP_RELEASE, 1). +-endif. + +-if(?OTP_RELEASE >= 26). +try_get_default_plt() -> + try dialyzer_iplt:get_default_iplt_filename() + catch throw:{dialyzer_error, _} -> undefined + end. +-else. +try_get_default_plt() -> + try dialyzer_plt:get_default_plt() + catch throw:{dialyzer_error, _} -> undefined + end. +-endif. + get_included_files(Plt) -> {ok, Info} = dialyzer:plt_info(Plt), {files, Files} = lists:keyfind(files, 1, Info), diff --git a/test_data/manual/Dockerfile.otp26 b/test_data/manual/Dockerfile.otp26 index ef1cb7f3..00367514 100644 --- a/test_data/manual/Dockerfile.otp26 +++ b/test_data/manual/Dockerfile.otp26 @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:20.04 SHELL ["/bin/bash", "-c"] @@ -11,7 +11,7 @@ RUN apt-get -q update && \ rm -rf /var/lib/apt/lists/* ENV ERLANG_VERSION=26.0.2 \ - ERLANG_EMACS_LIB="/usr/lib/erlang/lib/tools-3.5.3/emacs" + ERLANG_EMACS_LIB="/usr/lib/erlang/lib/tools-3.6/emacs" RUN . /etc/os-release && \ export FILE="esl-erlang_${ERLANG_VERSION}-1~ubuntu~${VERSION_CODENAME}_amd64.deb" && \ @@ -23,6 +23,5 @@ WORKDIR /edts COPY . . -RUN make -# && \ - # make test +RUN make && \ + make test diff --git a/test_data/manual/Dockerfile.otp27 b/test_data/manual/Dockerfile.otp27 new file mode 100644 index 00000000..ce532fab --- /dev/null +++ b/test_data/manual/Dockerfile.otp27 @@ -0,0 +1,20 @@ +FROM erlang:27.1.2 + +SHELL ["/bin/bash", "-c"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get -q update && \ + apt-get -yq install \ + wget \ + emacs git && \ + rm -rf /var/lib/apt/lists/* + +ENV ERLANG_EMACS_LIB="/usr/local/lib/erlang/lib/tools-4.1/emacs" + +WORKDIR /edts + +COPY . . + +RUN make && \ + make test