Fix rabbitmq_cli test compilation under elixir 1.15

This commit is contained in:
Rin Kuryloski 2023-07-03 18:06:53 +02:00
parent 9c66e73266
commit 2c5e9a5775
4 changed files with 49 additions and 25 deletions

View File

@ -175,6 +175,12 @@ defmodule RabbitMQCtl.MixfileBase do
:dialyxir,
path: Path.join(deps_dir, "dialyxir"), runtime: false
},
{
:rabbit,
path: Path.join(deps_dir, "rabbit"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
override: true
},
{
:temp,
path: Path.join(deps_dir, "temp")

View File

@ -38,19 +38,35 @@ def deps_dir_contents(ctx, deps, dir):
files = []
for dep in deps:
lib_info = dep[ErlangAppInfo]
for src in lib_info.include + lib_info.beam + lib_info.srcs:
files_by_path = {}
for src in lib_info.include + lib_info.srcs:
if not src.is_directory:
rp = additional_file_dest_relative_path(dep.label, src)
files_by_path[rp] = src
else:
fail("unexpected directory in", lib_info)
for rp, src in files_by_path.items():
f = ctx.actions.declare_file(path_join(
dir,
lib_info.app_name,
rp,
))
ctx.actions.symlink(
output = f,
target_file = src,
)
files.extend([f, src])
for beam in lib_info.beam:
if not beam.is_directory:
f = ctx.actions.declare_file(path_join(
dir,
lib_info.app_name,
rp,
))
dir, lib_info.app_name, "ebin", beam.basename))
ctx.actions.symlink(
output = f,
target_file = src,
target_file = beam,
)
files.extend([src, f])
files.extend([f, beam])
else:
fail("unexpected directory in", lib_info)
return files
def _impl(ctx):

View File

@ -100,19 +100,9 @@ export ERL_COMPILER_OPTIONS=deterministic
for archive in {archives}; do
"${{ABS_ELIXIR_HOME}}"/bin/mix archive.install --force $INITIAL_DIR/$archive
done
for d in {precompiled_deps}; do
mkdir -p _build/${{MIX_ENV}}/lib/$d
ln -s ${{DEPS_DIR}}/$d/ebin _build/${{MIX_ENV}}/lib/$d
ln -s ${{DEPS_DIR}}/$d/include _build/${{MIX_ENV}}/lib/$d
done
"${{ABS_ELIXIR_HOME}}"/bin/mix deps.compile
"${{ABS_ELIXIR_HOME}}"/bin/mix compile
# due to https://github.com/elixir-lang/elixir/issues/7699 we
# "run" the tests, but skip them all, in order to trigger
# compilation of all *_test.exs files before we actually run them
"${{ABS_ELIXIR_HOME}}"/bin/mix test --exclude test
export TEST_TMPDIR=${{TEST_UNDECLARED_OUTPUTS_DIR}}
# we need a running broker with certain plugins for this to pass
@ -174,11 +164,6 @@ for %%a in ({archives}) do (
set ARCH=%ARCH:/=\\%
"{elixir_home}\\bin\\mix" archive.install --force %ARCH% || goto :error
)
for %%d in ({precompiled_deps}) do (
mkdir _build\\%MIX_ENV%\\lib\\%%d
robocopy %DEPS_DIR%\\%%d\\ebin _build\\%MIX_ENV%\\lib\\%%d /E /NFL /NDL /NJH /NJS /nc /ns /np
robocopy %DEPS_DIR%\\%%d\\include _build\\%MIX_ENV%\\lib\\%%d /E /NFL /NDL /NJH /NJS /nc /ns /np
)
"{elixir_home}\\bin\\mix" deps.compile || goto :error
"{elixir_home}\\bin\\mix" compile || goto :error

View File

@ -4,16 +4,33 @@
##
## Copyright (c) 2007-2023 VMware, Inc. or its affiliates. All rights reserved.
four_hours = 240 * 60 * 1000
ten_minutes = 10 * 60 * 1000
ExUnit.configure(
exclude: [disabled: true],
module_load_timeout: four_hours,
timeout: four_hours
module_load_timeout: ten_minutes,
timeout: ten_minutes
)
ExUnit.start()
# Elixir 1.15 compiler optimizations seem to require that we explicitly add to the code path
true = Code.append_path(Path.join([System.get_env("DEPS_DIR"), "rabbit_common", "ebin"]))
true = Code.append_path(Path.join([System.get_env("DEPS_DIR"), "rabbit", "ebin"]))
true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "amqp", "ebin"]))
true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "json", "ebin"]))
true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "x509", "ebin"]))
if function_exported?(Mix, :ensure_application!, 1) do
Mix.ensure_application!(:mnesia)
Mix.ensure_application!(:os_mon)
Mix.ensure_application!(:public_key)
Mix.ensure_application!(:runtime_tools)
Mix.ensure_application!(:sasl)
Mix.ensure_application!(:xmerl)
end
defmodule TestHelper do
import ExUnit.Assertions
alias RabbitMQ.CLI.Plugins.Helpers, as: PluginHelpers