Commit 06422eeb authored by Robert Goldman's avatar Robert Goldman
Browse files

Improve the ASDF test-op implementation and add a CI/CD pipeline

parent 418d48ea
Pipeline #3728 passed with stage
in 7 minutes and 12 seconds
# Lifted from @etimmons' script for ASDF
###############################################################################
# Global configuration
###############################################################################
variables:
# Just let the runner fetch and update the submodules for us.
GIT_SUBMODULE_STRATEGY: normal
ABCL_IMAGE: clfoundation/abcl
ABCL_TAG: latest
CCL_IMAGE: clfoundation/ccl
CCL_TAG: latest
CLASP_IMAGE: clfoundation/clasp
CLASP_TAG: latest
CLISP_IMAGE: clfoundation/clisp
CLISP_TAG: latest
CMUCL_IMAGE: clfoundation/cmucl
CMUCL_TAG: latest
ECL_IMAGE: clfoundation/ecl
ECL_TAG: latest
SBCL_IMAGE: clfoundation/sbcl
SBCL_TAG: latest
# This causes pipelines to be created only on the default branch, tags, merge
# requests, and when triggered via the web interface.
# workflow:
# rules:
# - if: $CI_MERGE_REQUEST_IID
# - if: $CI_COMMIT_TAG
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# - if: $CI_COMMIT_BRANCH == "fix-asdf-test-op"
# - if: $CI_PIPELINE_SOURCE == "web"
stages:
- regression
###############################################################################
# Testing Templates
###############################################################################
.Regression tests:
stage: regression
script:
- make test
artifacts:
paths:
- build/results/$l-test.text
needs: []
###############################################################################
# Actual test jobs - Makefile based harness
###############################################################################
ABCL regression tests:
extends: .Regression tests
image: $ABCL_IMAGE:$ABCL_TAG
variables:
l: abcl
CCL regression tests:
extends: .Regression tests
image: $CCL_IMAGE:$CCL_TAG
variables:
l: ccl
Clasp regression tests:
extends: .Regression tests
image: $CLASP_IMAGE:$CLASP_TAG
variables:
l: clasp
# dropping because I don't have access to an image with ASDF installed.
# CLISP regression tests:
# extends: .Regression tests
# image: $CLISP_IMAGE:$CLISP_TAG
# variables:
# l: clisp
CMUCL regression tests:
extends: .Regression tests
image: $CMUCL_IMAGE:$CMUCL_TAG
variables:
l: cmucl
ECL regression tests:
extends: .Regression tests
image: $ECL_IMAGE:$ECL_TAG
variables:
l: ecl
SBCL regression tests:
extends: .Regression tests
image: $SBCL_IMAGE:$SBCL_TAG
variables:
l: sbcl
[submodule "ext/rt"]
path = ext/rt
url = https://gitlab.common-lisp.net/rtoy/rt.git
......@@ -3,8 +3,69 @@ TEXFILES = doc/iter-man.tex doc/iter-bare.tex doc/aimemo.sty doc/GNUmakefile
RCSFILES = package.lisp,v iterate.lisp,v iterate-test.lisp,v iterate-pg.lisp,v doc/iter-man.tex,v
PDFFILES = doc/iter-man.pdf doc/iter-bare.pdf
# If you need to sudo in order to use docker, modify this.
DOCKER ?= docker
sourceDirectory := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
l ?= sbcl
ifeq ($(l), abcl)
command ?= abcl
loadfile = --noinit --nosystem --noinform --load
else ifeq ($(l), allegro)
command ?= alisp
loadfile = -q -L
else ifeq ($(l), ccl)
loadfile = --no-init --quiet --load
command ?= ccl
else ifeq ($(l), clasp)
command ?=
loadfile = --norc --noinit --load
else ifeq ($(l), clisp)
command ?= clisp
loadfile = -norc --silent -ansi -I -c -l
else ifeq ($(l), cmucl)
command ?= cmucl
loadfile = -noinit -batch --load
else ifeq ($(l), ecl)
command ?= ecl
loadfile = --norc --load
else ifeq ($(l), lispworks)
command ?= lispworks # this is just a convention...
loadfile = -siteinit = -init -
else ifeq ($(l), sbcl)
command ?= sbcl
loadfile = --no-userinit --no-sysinit --load
else
$(error Don\'t know how to operate on implementation $(l))
endif
.PHONY: test
distrib:
tar czf iterate.tgz $(FILES) $(TEXFILES) $(PDFFILES)
devel:
tar czf iterate-rcs.tgz $(FILES) $(RCSFILES) $(TEXFILES) Makefile
test:
$(command) $(loadfile) test.lisp
# Useful for reproducing test failures with Docker.
test-docker-repl:
@${DOCKER} run --rm -i -t --pull always -u $(shell id -u):$(shell id -g) -v $(sourceDirectory):$(sourceDirectory) -w $(sourceDirectory)/test clfoundation/${l}:latest
test-docker-lisp:
@${DOCKER} run --rm -i -t --pull always -u $(shell id -u):$(shell id -g) -v $(sourceDirectory):$(sourceDirectory) -w $(sourceDirectory) clfoundation/${l}:latest make test l=${l} t=${t}
Subproject commit a6a7503a0b47953bc7579c90f02a6dba1f6e4c5a
......@@ -31,6 +31,9 @@
;; feature of Iterate.
(cl:defpackage #:iterate.test
(:import-from #+sbcl #:sb-rt
#-sbcl #:regression-test
#:*expected-failures*)
(:use #:cl #:iterate
#+sbcl #:sb-rt
#-sbcl #:regression-test))
......@@ -48,6 +51,13 @@
thereis.finally
bug/walk.2
bug/collect-at-beginning
#+(or clozure ecl)
bug/previously-initially.1
#+ (or abcl clozure ecl sbcl)
IN-STREAM.2
#+ecl code-movement.else
#+ecl code-movement.finally
#+ecl code-movement.finally-protected
))
(deftest dsetq.1
......@@ -1977,4 +1987,37 @@
t)
(define-condition unexpected-failures-error (error)
((failures :initarg :failures))
(:report (lambda (ufe str)
(format str "Unexpected failures:~%~{~a~%~}" (slot-value ufe 'failures)))))
(define-condition unexpected-successes-error (error)
((successes :initarg :successes))
(:report (lambda (ufe str)
(format str "Unexpected successes:~%~{~a~%~}" (slot-value ufe 'successes)))))
(defun do-iterate-tests (&key (on-failure :error))
(multiple-value-bind (unexpected-failures unexpected-successes)
(let ((*expected-failures* *tests-expected-to-fail*))
(do-tests)
(values
(set-difference (pending-tests) *tests-expected-to-fail*)
(set-difference *tests-expected-to-fail* (pending-tests))))
(format t "~&DO-TESTS returned ~S unexpected failures and ~S unexpected successes~%"
unexpected-failures unexpected-successes)
(cond
((and unexpected-failures
(eq on-failure :error))
(error 'unexpected-failures-error :failures unexpected-failures))
(unexpected-failures
on-failure)
;; no unexpected failures
((and unexpected-successes
(eq on-failure :error))
(error 'unexpected-successes-error :successes unexpected-successes))
(unexpected-successes
on-failure)
(t t))))
;;; eof
......@@ -13,5 +13,4 @@
:components ((:file "iterate-test")))
(defmethod perform ((operation test-op) (component (eql (find-system :iterate/tests))))
(funcall (intern "DO-TESTS" (find-package #+sbcl "SB-RT"
#-sbcl "REGRESSION-TEST"))))
(uiop:symbol-call '#:iterate.test '#:do-iterate-tests :on-failure :error))
(in-package :common-lisp-user)
(require :asdf)
(asdf:initialize-output-translations
`(:output-translations
(t ,(merge-pathnames (make-pathname
:directory '(:relative "test" "cache" :wild-inferiors)
:name :wild :type :wild)
*load-truename*))
:ignore-inherited-configuration
))
(asdf:load-asd (merge-pathnames (make-pathname
:name "iterate"
:type "asd")
*load-truename*))
(format t "~&Successfully loaded the iterate ASD file.~%")
#-sbcl
(asdf:load-asd (merge-pathnames (make-pathname
:name "rt"
:type "asd"
:directory
'(:relative "ext" "rt"))
*load-truename*))
(if (not (asdf:find-system "iterate"))
(progn
(format t "~&Unable to find the iterate ASDF system definition.~%")
(uiop:quit 1))
(format t "~&Found iterate ASDF system definition.~%"))
(asdf:load-system "iterate/tests")
(handler-bind ((iterate.test::unexpected-failures-error
#'(lambda (e)
(declare (ignorable e))
(format t "~&Catching unexpected failures error.~%")
(uiop:quit 2)))
(error #'(lambda (e)
(format t "~&Caught unexpected error ~a~%" e)
(uiop:quit 3))))
(asdf:test-system "iterate")
(uiop:quit 0))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment