From 6570538aae41c83802b8ae9c4d21e3044f5f16cd Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Wed, 7 Jan 2015 09:11:30 -0700 Subject: [PATCH] Get ready for testing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn’t really work yet, but I’m getting it together. --- .travis.yml | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 68 ++++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 .travis.yml create mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..fb078ee --- /dev/null +++ b/.travis.yml @@ -0,0 +1,164 @@ +### +### Notes +### +### The travis web interface may choke silently and fail to +### update when there are issues with the .travis.yml file. +### +### The "travis-lint" command-line tool does not catch all +### errors which may lead to silent failure. +### +### Shell-style comments in this file must have "#" as the +### *first* character of the line. +### + +### +### language +### + +# travis-lint no longer permits this value +# language: emacs-lisp + +### +### defining the build matrix +### +### ===> <=== +### ===> each variation in env/matrix will be built and tested <=== +### ===> <=== +### +### variables under env/global are available to the build process +### but don't cause the creation of a separate variation +### + +env: + matrix: +# - EMACS=xemacs21 + - EMACS=emacs22 + - EMACS=emacs23 + - EMACS=emacs24 + - EMACS=emacs-snapshot + global: + - SOME_TOKEN=some_value + +### +### allowing build failures +### + +matrix: + allow_failures: +# - env: EMACS=xemacs21 + - env: EMACS=emacs22 + - env: EMACS=emacs-snapshot + +### +### limit build attempts to defined branches +### +### notes +### +### This controls which branches are built. +### +### You can also control which branches affect the web badge, by +### appending "?branch=master,staging,production" to the end of the +### image URL (replacing "master,staging,production" with a +### comma-separated list of branches to be reflected in the badge). +### +# +# branches: +# only: +# - master +# + +### +### runtime initialization +### +### notes +### +### emacs22 is extracted manually from Ubuntu Maverick. +### +### emacs23 is the stock default, but is updated anyway to +### a GUI-capable version, which will have certain additional +### functions compiled in. +### +### emacs24 (current stable release) is obtained from the +### cassou PPA: http://launchpad.net/~cassou/+archive/emacs +### +### emacs-snapshot (trunk) is obtained from the Ubuntu Emacs Lisp PPA: +### https://launchpad.net/~ubuntu-elisp/+archive/ppa +### For the emacs-snapshot build, bleeding-edge versions +### of all test dependencies are also used. +### + +before_install: + - git submodule --quiet update --init --recursive + +install: +# - if [ "$EMACS" = 'xemacs21' ]; then +# sudo apt-get -qq update && +# sudo apt-get -qq -f install && +# sudo apt-get -qq install xemacs21-basesupport xemacs21-basesupport-el xemacs21-supportel xemacs21-support xemacs21-mulesupport-el xemacs21-mulesupport xemacs21-mule-canna-wnn xemacs21-mule-canna-wnn; +# fi + - if [ "$EMACS" = 'emacs22' ]; then + curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22_22.2-0ubuntu9_i386.deb && + curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-bin-common_22.2-0ubuntu9_i386.deb && + curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-common_22.2-0ubuntu9_all.deb && + curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-el_22.2-0ubuntu9_all.deb && + curl -Os http://security.ubuntu.com/ubuntu/pool/universe/e/emacs22/emacs22-gtk_22.2-0ubuntu9_i386.deb && + sudo apt-get -qq update && + sudo apt-get -qq remove emacs emacs23-bin-common emacs23-common emacs23-nox && + sudo apt-get -qq --fix-missing install install-info emacsen-common libjpeg62:i386 xaw3dg:i386 liblockfile1:i386 libasound2:i386 libgif4:i386 libncurses5:i386 libpng12-0:i386 libtiff4:i386 libxpm4:i386 libxft2:i386 libglib2.0-0:i386 libgtk2.0-0:i386 && + sudo apt-get -qq -f install && + sudo dpkg -i emacs22-common_22.2-0ubuntu9_all.deb emacs22-el_22.2-0ubuntu9_all.deb && + sudo dpkg -i --force-depends emacs22-bin-common_22.2-0ubuntu9_i386.deb && + sudo dpkg -i emacs22_22.2-0ubuntu9_i386.deb emacs22-gtk_22.2-0ubuntu9_i386.deb && + sudo update-alternatives --set emacs22 /usr/bin/emacs22-gtk; + fi + - if [ "$EMACS" = 'emacs23' ]; then + sudo apt-get -qq update && + sudo apt-get -qq -f install && + sudo apt-get -qq install emacs23-gtk emacs23-el; + fi + - if [ "$EMACS" = 'emacs24' ]; then + sudo add-apt-repository -y ppa:cassou/emacs && + sudo apt-get -qq update && + sudo apt-get -qq -f install && + sudo apt-get -qq install emacs24 emacs24-el; + fi + - if [ "$EMACS" = 'emacs-snapshot' ]; then + sudo add-apt-repository -y ppa:ubuntu-elisp/ppa && + sudo apt-get -qq update && + sudo apt-get -qq -f install && + sudo apt-get -qq install emacs-snapshot && + sudo apt-get -qq install emacs-snapshot-el; + fi + +before_script: + - if [ "$EMACS" = 'emacs-snapshot' ]; then + make downloads-latest; + else + make downloads; + fi + +### +### the actual build/test command +### +### Use "make test-batch" to test without byte-compiling. +### The default command avoids byte-compiling on Emacs 22. +### + +script: + $EMACS --version && ( test "$EMACS" != 'emacs22' && make test EMACS="$EMACS" || make test-batch EMACS="$EMACS" ) + +### +### settings +### + +notifications: + email: false + +# +# Emacs +# +# Local Variables: +# indent-tabs-mode: nil +# coding: utf-8 +# End: +# diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..70d22d7 --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +EMACS=emacs + +EMACS_CLEAN=-Q +EMACS_BATCH=$(EMACS_CLEAN) --batch +TESTS= + +CURL=curl --silent +WORK_DIR=$(shell pwd) +PACKAGE_NAME=$(shell basename $(WORK_DIR)) +AUTOLOADS_FILE=$(PACKAGE_NAME)-autoloads.el +TRAVIS_FILE=.travis.yml +TEST_DIR=ert-tests +TEST_DEP_1=ert +TEST_DEP_1_STABLE_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=emacs-24.3 +TEST_DEP_1_LATEST_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=master + +.PHONY : build downloads downloads-latest autoloads test-autoloads test-travis \ + test test-interactive clean edit test-dep-1 test-dep-2 test-dep-3 \ + test-dep-4 test-dep-5 test-dep-6 test-dep-7 test-dep-8 test-dep-9 + +build : + $(EMACS) $(EMACS_BATCH) --eval \ + "(if (< emacs-major-version 24) \ + (progn \ + (add-to-list 'load-path \"./\") \ + (require 'color-theme-solarized) \ + (color-theme-solarized)) \ + (add-to-list 'custom-theme-load-path \"./\") \ + (load-theme 'solarized t))" + +test-dep-1 : + @cd $(TEST_DIR) && \ + $(EMACS) $(EMACS_BATCH) -L . -L .. -l $(TEST_DEP_1) || \ + (echo "Can't load test dependency $(TEST_DEP_1).el, run 'make downloads' to fetch it" ; exit 1) + +downloads : + $(CURL) '$(TEST_DEP_1_STABLE_URL)' > $(TEST_DIR)/$(TEST_DEP_1).el + +downloads-latest : + $(CURL) '$(TEST_DEP_1_LATEST_URL)' > $(TEST_DIR)/$(TEST_DEP_1).el + +autoloads : + $(EMACS) $(EMACS_BATCH) --eval \ + "(progn \ + (setq generated-autoload-file \"$(WORK_DIR)/$(AUTOLOADS_FILE)\") \ + (update-directory-autoloads \"$(WORK_DIR)\"))" + +test-autoloads : autoloads + @$(EMACS) $(EMACS_BATCH) -L . -l "./$(AUTOLOADS_FILE)" || \ + ( echo "failed to load autoloads: $(AUTOLOADS_FILE)" && false ) + +test-travis : + @if test -z "$$TRAVIS" && test -e $(TRAVIS_FILE); then travis-lint $(TRAVIS_FILE); fi + +test : build test-dep-1 test-autoloads + @cd $(TEST_DIR) && \ + (for test_lib in *-test.el; do \ + $(EMACS) $(EMACS_BATCH) -L . -L .. -l cl -l $(TEST_DEP_1) -l $$test_lib --eval \ + "(progn \ + (fset 'ert--print-backtrace 'ignore) \ + (ert-run-tests-batch-and-exit '(and \"$(TESTS)\" (not (tag :interactive)))))" || exit 1; \ + done) + +clean : + @rm -f $(AUTOLOADS_FILE) *.elc *~ */*.elc */*~ $(TEST_DIR)/$(TEST_DEP_1).el \ + $(TEST_DIR)/$(TEST_DEP_2).el $(TEST_DIR)/$(TEST_DEP_3).el $(TEST_DIR)/$(TEST_DEP_4).el \ + $(TEST_DIR)/$(TEST_DEP_5).el $(TEST_DIR)/$(TEST_DEP_6).el $(TEST_DIR)/$(TEST_DEP_7).el \ + $(TEST_DIR)/$(TEST_DEP_8).el $(TEST_DIR)/$(TEST_DEP_9).el