From cc3599a0a4f3a32adca1f5ecc85f18f9577c4c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Thu, 30 Mar 2017 10:57:44 +0200 Subject: [PATCH] rabbit_ct_broker_helpers: Execute `make test-dist` once only We use the `$SKIP_MAKE_TEST_DIST` environment variable to record the fact that the command was already executed. We use an environment variable and not a configuration parameter because it spans multiple testsuites out-of-the-box. Because `make test-dist` was executed each time a broker/cluster was started, this change should save quite some time in testsuites which start many brokers/clusters. The caller can use the same variable to disable `make test-dist` entirely. [#141300123] --- .../src/rabbit_ct_broker_helpers.erl | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl b/deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl index 73637ac20a..1af263da81 100644 --- a/deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl +++ b/deps/rabbitmq_ct_helpers/src/rabbit_ct_broker_helpers.erl @@ -150,10 +150,24 @@ teardown_steps() -> ]. run_make_dist(Config) -> - SrcDir = ?config(current_srcdir, Config), - case rabbit_ct_helpers:make(Config, SrcDir, ["test-dist"]) of - {ok, _} -> Config; - _ -> {skip, "Failed to run \"make test-dist\""} + case os:getenv("SKIP_MAKE_TEST_DIST") of + false -> + SrcDir = ?config(current_srcdir, Config), + case rabbit_ct_helpers:make(Config, SrcDir, ["test-dist"]) of + {ok, _} -> + %% The caller can set $SKIP_MAKE_TEST_DIST to + %% manually skip this step which can be time + %% consuming. But we also use this variable to + %% record the fact we went through it already so we + %% save redundant calls. + os:putenv("SKIP_MAKE_TEST_DIST", "true"), + Config; + _ -> + {skip, "Failed to run \"make test-dist\""} + end; + _ -> + ct:pal(?LOW_IMPORTANCE, "(skip `$MAKE test-dist`)", []), + Config end. start_rabbitmq_nodes(Config) ->