aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/relx.mk8
-rw-r--r--test/plugin_relx.mk19
2 files changed, 25 insertions, 2 deletions
diff --git a/plugins/relx.mk b/plugins/relx.mk
index 24de0c6..58d1391 100644
--- a/plugins/relx.mk
+++ b/plugins/relx.mk
@@ -58,7 +58,13 @@ else
define get_relx_release.erl
{ok, Config} = file:consult("$(RELX_CONFIG)"),
- {release, {Name, Vsn}, _} = lists:keyfind(release, 1, Config),
+ {release, {Name, Vsn0}, _} = lists:keyfind(release, 1, Config),
+ Vsn = case Vsn0 of
+ {cmd, Cmd} -> os:cmd(Cmd);
+ semver -> "";
+ {semver, _} -> "";
+ VsnStr -> Vsn0
+ end,
io:format("~s ~s", [Name, Vsn]),
halt(0).
endef
diff --git a/test/plugin_relx.mk b/test/plugin_relx.mk
index f2d7f07..ad29669 100644
--- a/test/plugin_relx.mk
+++ b/test/plugin_relx.mk
@@ -3,7 +3,7 @@
# Sleeps when interacting with relx script are necessary after start and upgrade
# as both of those interactions are not synchronized.
-RELX_CASES = rel relup start-stop tar
+RELX_CASES = rel relup start-stop tar vsn
RELX_TARGETS = $(addprefix relx-,$(RELX_CASES))
.PHONY: relx $(RELX_TARGETS)
@@ -195,3 +195,20 @@ relx-tar: build clean
$i "Check that tarball exists"
$t test -f $(APP)/_rel/$(APP)_release/$(APP)_release-1.tar.gz
+
+relx-vsn: build clean
+
+ $i "Bootstrap a new release named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap bootstrap-rel $v
+
+ $i "Replace the vsn"
+ $t sed -i.bak s/"\"1\""/"{cmd, \"echo -n 2\"}"/ $(APP)/relx.config
+
+ $i "Build the release"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that the correct release exists"
+ $t ! test -d $(APP)/_rel/$(APP)_release/releases/1
+ $t test -d $(APP)/_rel/$(APP)_release/releases/2