>From 40c733bdd0401daa48466b807c5cf64cb14002be Mon Sep 17 00:00:00 2001
From: Vladimir Sedach <vas@oneofus.la>
Date: Sat, 14 Sep 2019 19:26:02 -0700
Subject: [PATCH] Add a TEST-OP-TEST-FAILURE condition for test libraries to
 sub-class

---
 doc/asdf.texinfo | 13 ++++++++++---
 interface.lisp   |  1 +
 lisp-action.lisp | 15 ++++++++++++++-
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/doc/asdf.texinfo b/doc/asdf.texinfo
index d663b5cc..04ccdb9a 100644
--- a/doc/asdf.texinfo
+++ b/doc/asdf.texinfo
@@ -2448,9 +2448,16 @@ in a way that is compatible with all of the various test libraries
 and test techniques in use in the community, and
 given the fact that ASDF operations do not return a value indicating
 success or failure.
-For those willing to go to the effort, we suggest defining conditions to
-signal when a @code{test-op} fails, and storing in those conditions
-information that describes which tests fail.
+
+We suggest signaling a sub-class of the @code{test-op-test-failure}
+condition when a @code{test-op} fails.
+The test library you are using may already be doing this.
+Sub-classes of the @code{test-op-test-failure} condition should have a
+report function that prints the total number of tests run, the number
+of failed tests, the identities of the failed tests, and enough
+information about the failures to facilitate debugging.
+You should also signal a subclass of this condition when
+@code{test-op} did not result in any tests being run.

 People typically define a separate test @emph{system} to hold the tests.
 Doing this avoids unnecessarily adding a test framework as a dependency
diff --git a/interface.lisp b/interface.lisp
index 411ab547..644741e7 100644
--- a/interface.lisp
+++ b/interface.lisp
@@ -99,6 +99,7 @@
    #:asdf-version
    #:compile-condition #:compile-file-error #:compile-warned-error #:compile-failed-error
    #:compile-warned-warning #:compile-failed-warning
+   #:test-op-test-failure
    #:error-name
    #:error-pathname
    #:load-system-definition-error
diff --git a/lisp-action.lisp b/lisp-action.lisp
index 8bdeb3bf..c17193c9 100644
--- a/lisp-action.lisp
+++ b/lisp-action.lisp
@@ -12,7 +12,8 @@
    #:load-op #:prepare-op #:compile-op #:test-op #:load-source-op #:prepare-source-op
    #:call-with-around-compile-hook
    #:perform-lisp-compilation #:perform-lisp-load-fasl #:perform-lisp-load-source
-   #:lisp-compilation-output-files))
+   #:lisp-compilation-output-files
+   #:test-op-test-failure))
 (in-package :asdf/lisp-action)


@@ -242,6 +243,18 @@ an OPERATION and a COMPONENT."

 ;;;; test-op
 (with-upgradability ()
+  (define-condition test-op-test-failure (warning) ()
+    (:documentation
+     "Parent condition to be sub-classed and signaled by test libraries
+to indicate test failure.
+
+Test libraries should also signal a subclass of this condition when
+test-op did not result in any tests being run.
+
+Sub-classes of this condition should have a report function that
+prints the total number of tests run, the number of failed tests, the
+identities of the failed tests, and enough information about the
+failures to facilitate debugging."))
   (defmethod perform ((o test-op) (c component))
     nil)
   (defmethod operation-done-p ((o test-op) (c system))
--
2.11.0

