diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-08-02 20:38:37 -0400 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2017-08-03 10:31:50 -0400 |
commit | 673616a3e351e7b97472aadc10c3c131cf358b8a (patch) | |
tree | 3dbfec34f348789f708a47f8809679097658cbf2 | |
parent | f4d1e144a4be92b0c7225a22557c26bdb429bbda (diff) | |
download | gitano-673616a3e351e7b97472aadc10c3c131cf358b8a.tar.gz |
Test from an installation
This corrects an oversight in our testing framework where we were
using a local build of Gitano rather than an "installation" for
test purposes. This should result in fewer cases of missed modules,
plugins, skeleton entries, etc.
-rw-r--r-- | Makefile | 54 | ||||
-rw-r--r-- | testing/.gitignore | 1 | ||||
-rw-r--r-- | testing/gitano-test-tool.in | 2 |
3 files changed, 42 insertions, 15 deletions
@@ -72,6 +72,18 @@ MAN1S := gitano-setup.1 PLUGINS := rsync.lua archive.lua git-annex.lua +TEST_PLUGINS := testing-hooks.lua demo.lua + +UNSUPPORTED_PLUGINS := git-multimail.lua + +COVERAGE := no + +ifeq ($(COVERAGE),yes) + +MODS := $(MODS) gitano.coverage + +endif + MOD_DIRS := gitano MOD_FILES := $(patsubst %,%.lua,$(subst .,/,$(MODS))) SRC_MOD_FILES := $(patsubst %,lib/%,$(MOD_FILES)) @@ -89,8 +101,6 @@ TESTS := $(patsubst %,testing/%.yarn,$(TESTS)) GEN_BIN := utils/install-lua-bin RUN_GEN_BIN := $(LUA) $(GEN_BIN) $(LUA) -COVERAGE := no - ifeq ($(COVERAGE),yes) define GEN_LOCAL_BIN @@ -101,14 +111,14 @@ endef ifeq ($(COVER_GTT),yes) define GEN_LOCAL_TESTING_BIN -$(RUN_GEN_BIN) $(shell pwd) $(shell pwd)/bin $(shell pwd)/lib $(shell pwd)/plugins $1 $2 $(shell pwd)/extras/luacov/src $(shell pwd)/.coverage/ +$(RUN_GEN_BIN) $(shell pwd)/testing/inst/share/gitano $(shell pwd)/testing/inst/lib/gitano/bin $(shell pwd)/testing/inst/share/lua/5.1 $(shell pwd)/testing/inst/lib/gitano/plugins $1 $2 $(shell pwd)/extras/luacov/src $(shell pwd)/.coverage/ chmod 755 $2 endef else define GEN_LOCAL_TESTING_BIN -$(RUN_GEN_BIN) $(shell pwd) $(shell pwd)/bin $(shell pwd)/lib $(shell pwd)/plugins $1 $2 +$(RUN_GEN_BIN) $(shell pwd)/testing/inst/share/gitano $(shell pwd)/testing/inst/lib/gitano/bin $(shell pwd)/testing/inst/share/lua/5.1 $(shell pwd)/testing/inst/lib/gitano/plugins $1 $2 chmod 755 $2 endef @@ -122,19 +132,27 @@ chmod 755 $2 endef define GEN_LOCAL_TESTING_BIN -$(RUN_GEN_BIN) $(shell pwd) $(shell pwd)/bin $(shell pwd)/lib $(shell pwd)/plugins $1 $2 +$(RUN_GEN_BIN) $(shell pwd)/testing/inst/share/gitano $(shell pwd)/testing/inst/lib/gitano/bin $(shell pwd)/testing/inst/share/lua/5.1 $(shell pwd)/testing/inst/lib/gitano/plugins $1 $2 chmod 755 $2 endef endif +ifeq ($(COVERAGE),yes) define GEN_INSTALL_BIN -$(RUN_GEN_BIN) $(SHARE_PATH) $(LIB_BIN_PATH) $(LUA_MOD_PATH) $(PLUGIN_PATH) $1 $2 +$(RUN_GEN_BIN) $(SHARE_PATH) $(LIB_BIN_PATH) $(LUA_MOD_PATH) $(PLUGIN_PATH) $1 $2 $(shell pwd)/extras/luacov/src $(shell pwd)/.coverage/ chmod 755 $2 endef +else +define GEN_INSTALL_BIN +$(RUN_GEN_BIN) $(SHARE_PATH) $(LIB_BIN_PATH) $(LUA_MOD_PATH) $(PLUGIN_PATH) $1 $2 +chmod 755 $2 + +endef +endif define GEN_INSTALL_MAN cp $1 $2 @@ -178,6 +196,8 @@ cleanbins: @$(RM) $(LOCAL_BINS) $(LOCAL_MODS) @echo "CLEAN: test binaries" @$(RM) $(TEST_BINS) + @echo "CLEAN: test install" + @$(RM) -r testing/inst distclean: clean @find . -name "*~" -delete @@ -259,13 +279,22 @@ ifeq ($(HTTP_FIRST_TEST_PORT),) HTTP_FIRST_TEST_PORT = 8080 endif +test-install: + @$(RM) -r testing/inst + @$(MAKE) PREFIX="$(shell pwd)/testing/inst" \ + SYSCONF_DIR="$(shell pwd)/testing/inst/etc" \ + install >/dev/null + @for P in $(TEST_PLUGINS); do \ + cp plugins/$$P "$(shell pwd)/testing/inst/etc/gitano/plugins/"; \ + done + plugin-check: - $(LUAC) -p $(patsubst %,plugins/%,$(PLUGINS)) - for PLUGIN in $(patsubst %,plugins/%,$(PLUGINS)); do \ + $(LUAC) -p $(patsubst %,plugins/%,$(PLUGINS) $(TEST_PLUGINS) $(UNSUPPORTED_PLUGINS)) + for PLUGIN in $(patsubst %,plugins/%,$(PLUGINS) $(TEST_PLUGINS)); do \ env LUA_PATH="$(shell pwd)/lib/?.lua;;" $(LUA) $$PLUGIN; \ done -basictest: local plugin-check $(TEST_BINS) +basictest: local plugin-check $(TEST_BINS) test-install @echo "Running basic yarns in '$(TEST_PROTO)' mode" @echo "Set TEST_PROTO if you want to change that" @$(YARN) \ @@ -277,7 +306,7 @@ basictest: local plugin-check $(TEST_BINS) test: local plugin-check sshtests httptests -sshtests: $(TEST_BINS) +sshtests: $(TEST_BINS) test-install @echo "Running full yarns in 'ssh' mode" @$(YARN) \ --env GTT="$$(pwd)/testing/gitano-test-tool" \ @@ -287,7 +316,7 @@ sshtests: $(TEST_BINS) testing/library.yarn $(TESTS) ifeq ($(SKIP_HTTP_TESTS),) -httptests: $(TEST_BINS) +httptests: $(TEST_BINS) test-install @echo "Running full yarns in 'http' mode" @$(YARN) \ --env GTT="$$(pwd)/testing/gitano-test-tool" \ @@ -301,9 +330,6 @@ httptests: @echo "WARNING: Cannot guarantee Gitano will work in HTTP mode." endif -testing/%: testing/%.in $(GEN_BIN) - $(call GEN_LOCAL_BIN,$<,$@) - check: test coverage-report: diff --git a/testing/.gitignore b/testing/.gitignore index bf632a4..d69b28b 100644 --- a/testing/.gitignore +++ b/testing/.gitignore @@ -1 +1,2 @@ gitano-test-tool +inst diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in index f375e8c..ea8acc0 100644 --- a/testing/gitano-test-tool.in +++ b/testing/gitano-test-tool.in @@ -286,7 +286,7 @@ function cmd_setupstandard(owning_user, master_key, bypass_key) fh:close() run_program { "gitano-setup", clodname, - exe = gitano.config.lib_bin_path() .. "/gitano-setup", + exe = gitano.config.lib_bin_path() .. "/../../../bin/gitano-setup", env = { HOME = user_home(owning_user) } } if os.getenv("GTT_PROTO") == "http" then |