diff options
Diffstat (limited to 'test/core_deps.mk')
-rw-r--r-- | test/core_deps.mk | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/core_deps.mk b/test/core_deps.mk index 1dbf7b8..1d7eefc 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1476,3 +1476,54 @@ core-deps-test: init {ok, Deps} = application:get_key($(APP), applications), \ false = lists:member(triq, Deps), \ halt()" + +# Checks that the cache is populate and reused +core-deps-cache-creation: init + $i "Bootstrap a new OTP library named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + $t tmp=`mktemp` && { echo 'DEPS += cowlib' && echo 'CACHE_DEPS=1' && cat $(APP)/Makefile; } >> $$tmp && mv $$tmp $(APP)/Makefile + $i "Check that the Cache Directory doesn't exist yet" + $t test ! -d $(CACHE_DIR) + $i "Pull down & Cache the deps" + $t $(MAKE) -C $(APP) deps + $i "Check that the Cache Directory has been created" + $t test -d $(CACHE_DIR) + $i "Check that cowlib was cloned" + $t test -d $(CACHE_DIR)/gits/cowlib + $t $(MAKE) -C $(APP) distclean + $i "Check that cowlib is still in the cache" + $t test -d $(CACHE_DIR)/gits/cowlib + $i "Break cowlib git link so we're forced to use the cache" + $t echo 'dep_cowlib = git bad_url master' >> $(APP)/Makefile + $i "Pull down the deps from the cache" + $t $(MAKE) -C $(APP) deps + $i "Check that cowlib was cloned" + $t test -d $(CACHE_DIR)/gits/cowlib + +# Checks that 2 apps can reuse the cache +# with different versions of the same dep +core-deps-cache-reuse: init + $i "Bootstrap a new OTP library named $(APP)_1" + $t mkdir $(APP)_1/ + $t cp ../erlang.mk $(APP)_1/ + $t $(MAKE) -C $(APP)_1 -f erlang.mk bootstrap-lib $v + $t tmp=`mktemp` && { echo 'DEPS += cowlib' && echo 'dep_cowlib = git $$(pkg_cowlib_repo) 1.0.0' && echo 'CACHE_DEPS=1' && cat $(APP)_1/Makefile; } >> $$tmp && mv $$tmp $(APP)_1/Makefile + $i "Bootstrap a new OTP library named $(APP)_2" + $t mkdir $(APP)_2/ + $t cp ../erlang.mk $(APP)_2/ + $t $(MAKE) -C $(APP)_2 -f erlang.mk bootstrap-lib $v + $t tmp=`mktemp` && { echo 'DEPS += cowlib' && echo 'dep_cowlib = git $$(pkg_cowlib_repo) 2.0.0' && echo 'CACHE_DEPS=1' && cat $(APP)_2/Makefile; } >> $$tmp && mv $$tmp $(APP)_2/Makefile + $i "Clone & Cache deps in $(APP)_1" + $t $(MAKE) -C $(APP)_1 deps + $i "Check that the Cache Directory has been created" + $t test -d $(CACHE_DIR) + $i "Check that cowlib was cloned" + $t test -d $(CACHE_DIR)/gits/cowlib + $i "Clone & Re-use cached deps in $(APP)_2" + $t $(MAKE) -C $(APP)_2 deps + $i "Check that $(APP)_1 cloned cowlib 1.x.x" + $t test "$$(cat $(APP)_1/deps/cowlib/.git/HEAD)" = "d544a494af4dbc810fc9c15eaf5cc050cced1501" + $i "Check that $(APP)_2 cloned cowlib 2.x.x" + $t test "$$(cat $(APP)_2/deps/cowlib/.git/HEAD)" = "bd37be4d3b065600c3b76b492535e76e5d413fc1"
\ No newline at end of file |