branch: elpa/emacsql
commit 80130c3a65395fe2865e0245a5affcebde8da35d
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    Add test/Makefile
    
    For consistency with other packages I maintain.
---
 Makefile      | 17 +++++++----------
 default.mk    |  5 +----
 test/Makefile | 27 +++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 2893fe3360c..df02172de97 100644
--- a/Makefile
+++ b/Makefile
@@ -33,8 +33,7 @@ clean-lisp:
 clean-docs:
        @$(MAKE) -C docs clean
 clean-test:
-       @printf " Cleaning test/*...\n"
-       @rm -rf $(TEST_ELCS)
+       @$(MAKE) -C test clean
 
 $(PKG)-autoloads.el: $(ELS)
        @printf " Creating $@\n"
@@ -49,15 +48,13 @@ $(PKG)-autoloads.el: $(ELS)
   (update-directory-autoloads default-directory))" \
        2>&1 | sed "/^Package autoload is deprecated$$/d"
 
-test: all $(TEST_ELCS)
-       @printf "Running compiler tests...\n"
-       @$(EMACS_BATCH) -L tests \
-       -l test/emacsql-compiler-tests.elc -f ert-run-tests-batch-and-exit
-       @printf "Running connector tests...\n"
-       @$(EMACS_BATCH) -L tests \
-       -l test/emacsql-external-tests.elc -f ert-run-tests-batch-and-exit
-
 stats:
        @$(MAKE) -C docs stats
 stats-upload:
        @$(MAKE) -C docs stats-upload
+
+test: lisp
+       @$(MAKE) -C test test
+
+test-interactive:
+       @$(MAKE) -C test test-interactive
diff --git a/default.mk b/default.mk
index 4cf6ea4afb1..fbd8602ccc1 100644
--- a/default.mk
+++ b/default.mk
@@ -14,10 +14,6 @@ ELS  += $(PKG)-psql.el
 ELS  += $(PKG)-pg.el
 ELCS  = $(ELS:.el=.elc)
 
-TEST_ELS  = test/emacsql-compiler-tests.el
-TEST_ELS += test/emacsql-external-tests.el
-TEST_ELCS = $(TEST_ELS:.el=.elc)
-
 DEPS  = pg
 DEPS += peg
 DEPS += sqlite3
@@ -36,6 +32,7 @@ endif
 EMACS       ?= emacs
 EMACS_Q_ARG ?= -Q
 EMACS_BATCH ?= $(EMACS) $(EMACS_Q_ARG) --batch $(EMACS_ARGS) $(LOAD_PATH)
+EMACS_INTR  ?= $(EMACS) $(EMACS_Q_ARG) $(EMACS_ARGS) $(LOAD_PATH)
 
 ifeq ($(CI), true)
 override GITSTATS = ../_gitstats/gitstats
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 00000000000..fabaab4596a
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,27 @@
+-include ../config.mk
+include ../default.mk
+
+LOAD_PATH += -L ../
+
+TEST_ELS  = emacsql-compiler-tests.el
+TEST_ELS += emacsql-external-tests.el
+TEST_ELCS = $(TEST_ELS:.el=.elc)
+
+test: lisp
+       @printf "Running compiler tests...\n"
+       @$(EMACS_BATCH) -l emacsql-compiler-tests.elc -f 
ert-run-tests-batch-and-exit
+       @printf "Running connector tests...\n"
+       @$(EMACS_BATCH) -l emacsql-external-tests.elc -f 
ert-run-tests-batch-and-exit
+
+test-interactive:
+       @$(EMACS_INTR) $(addprefix -l ,$(TEST_ELS)) --eval "(ert t)"
+
+lisp: $(addprefix ../,$(ELCS)) $(TEST_ELCS)
+
+%.elc: %.el
+       @printf "Compiling $<\n"
+       @$(EMACS_BATCH) --funcall batch-byte-compile $<
+
+clean:
+       @printf " Cleaning test/*...\n"
+       @rm -rf $(TEST_ELCS)

Reply via email to