Skip to content

Commit

Permalink
* This commit fix the bogus result of 'make check' which passes every…
Browse files Browse the repository at this point in the history
…time even

  if some tests are failed

* lib/unittest.scm
  - (test-display-result): New procedure which binds to the identical
    code of previous test-report-result implementation
  - (test-report-result): Add explicit exit which returns EX_SOFTWARE on a
    failure, to fix the bogus result of 'make check'
* test/test-fail.scm
  - New file
* test/Makefile.am
  - (sscm_tests, sscm_xfail_tests): Add test-fail.scm

* test/test-sscm-ext.scm
  - Fix expected sscm-version
  • Loading branch information
yamakenz committed Apr 6, 2008
1 parent 8451fd1 commit 170fa53
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/unittest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(define *total-errors* 0) ;; TODO: recover unintended error and increment this
(define test-filename "unspecified")

(define test-report-result
(define test-display-result
(lambda ()
(let ((header (if (zero? *total-failures*)
"OK: "
Expand All @@ -69,6 +69,15 @@
*total-errors* " errors"))
(newline))))

(define test-report-result
(lambda ()
(test-display-result)
(let ((EX_OK 0)
(EX_SOFTWARE 70))
(exit (if (positive? *total-failures*)
EX_SOFTWARE
EX_OK)))))

;; Backward compatibility
(define total-report test-report-result)

Expand Down
3 changes: 2 additions & 1 deletion test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
EXTRA_DIST = unittest-bigloo.scm unittest-gauche.scm \
run-singletest.sh.in

sscm_xfail_tests =
sscm_xfail_tests = test-fail.scm
sscm_optional_tests =
# Native tests of SigScheme
sscm_tests = \
Expand All @@ -21,6 +21,7 @@ sscm_tests = \
test-eqv.scm \
test-equal.scm \
test-eval.scm \
test-fail.scm \
test-formal-syntax.scm \
test-formatplus.scm \
test-lambda.scm \
Expand Down
39 changes: 39 additions & 0 deletions test/test-fail.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
;; Filename : test-fail.scm
;; About : unit tests for unconditional failure
;;
;; Copyright (c) 2008 SigScheme Project <uim-en AT googlegroups.com>
;;
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;;
;; 1. Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; 2. Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; 3. Neither the name of authors nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
;; IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
;; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
;; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
;; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(require-extension (unittest))

(test-begin "unconditional failure")
(test-true #f)
(test-end)

(test-report-result)
2 changes: 1 addition & 1 deletion test/test-sscm-ext.scm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
(define ud (undef))

(tn "sscm-version")
(assert-equal? (tn) "0.8.0" (sscm-version))
(assert-equal? (tn) "0.8.1" (sscm-version))

(tn "%%current-char-codec")
(assert-equal? (tn) "UTF-8" (%%current-char-codec))
Expand Down

0 comments on commit 170fa53

Please sign in to comment.