Switch testing to TAP and JUnit
This commit is contained in:
parent
085b87194d
commit
cbf860fcc0
|
|
@ -44,6 +44,7 @@ pipeline {
|
|||
stage("${SCHEME}") {
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||
sh "timeout 600 make SCHEME=${SCHEME} LIBRARY=${LIBRARY} RNRS=r6rs test-docker"
|
||||
junit ".tmp/*/*/*.xml"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -61,6 +62,7 @@ pipeline {
|
|||
stage("${SCHEME}") {
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||
sh "timeout 600 make SCHEME=${SCHEME} LIBRARY=${LIBRARY} RNRS=r7rs test-docker"
|
||||
junit ".tmp/*/*/*.xml"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
(define junit-runner-output-port (current-output-port))
|
||||
(define (set-junit-runner-output-port! port)
|
||||
(set! junit-runner-output-port port))
|
||||
|
||||
(define-syntax junit-runner
|
||||
(syntax-rules ()
|
||||
|
|
@ -21,10 +24,14 @@
|
|||
(set! indentation (list-tail indentation 2)))))
|
||||
(print
|
||||
(lambda args
|
||||
(map display (append indentation args))))
|
||||
(map (lambda (item)
|
||||
(display item junit-runner-output-port))
|
||||
(append indentation args))))
|
||||
(println
|
||||
(lambda args
|
||||
(map display (append indentation args)) (newline)))
|
||||
(map (lambda (item)
|
||||
(display item junit-runner-output-port))
|
||||
(append indentation args)) (newline junit-runner-output-port)))
|
||||
(string-replace
|
||||
(lambda (str replace with)
|
||||
(list->string
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
(scheme file)
|
||||
(srfi 19)
|
||||
(srfi 64))
|
||||
(export junit-runner)
|
||||
(export junit-runner
|
||||
set-junit-runner-output-port!)
|
||||
(include "junit.scm"))
|
||||
|
|
|
|||
|
|
@ -2,11 +2,45 @@ JUnit, output for SRFI-64
|
|||
|
||||
[JUnit](https://junit.org/)
|
||||
|
||||
Usage:
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
(import (scheme base)
|
||||
(srfi 64)
|
||||
(retropikzel junit))
|
||||
|
||||
(test-runner-current (junit-runner))
|
||||
|
||||
|
||||
|
||||
## Jenkins usage tip
|
||||
|
||||
Use JUnit test runner in Jenkins and output to file, use TAP anywhere else and
|
||||
output to stdout.
|
||||
|
||||
(cond
|
||||
;; In Jenkins
|
||||
((get-environment-variable "JENKINS_URL")
|
||||
(let ((junit-file "junit-result.xml"))
|
||||
(test-runner-current (junit-runner))
|
||||
(when (file-exists? junit-file) (delete-file junit-file))
|
||||
(set-junit-runner-output-port! (open-output-file junit-file))))
|
||||
(else (test-runner-current (tap-runner))))
|
||||
|
||||
|
||||
|
||||
## Reference
|
||||
|
||||
(**junit-runner**)
|
||||
|
||||
Get the JUnit test runner.
|
||||
|
||||
(**set-junit-runner-output-port!** port)
|
||||
|
||||
Set the output port of the test runner. To output to file you can do:
|
||||
|
||||
(define junit-file "junit-result.xml")
|
||||
(when (file-exists? junit-file) (delete-file junit-file))
|
||||
(set-junit-runner-output-port! (open-output-file junit-file))
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0.2.0
|
||||
0.3.0
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
(define tap-output-port (current-output-port))
|
||||
(define (set-tap-runner-output-port! port)
|
||||
(set! tap-output-port port))
|
||||
(define-syntax tap-runner
|
||||
(syntax-rules ()
|
||||
((_)
|
||||
|
|
@ -16,10 +19,15 @@
|
|||
(set! indentation (list-tail indentation 2)))))
|
||||
(print
|
||||
(lambda args
|
||||
(map display (append indentation args))))
|
||||
(map (lambda (item)
|
||||
(display item tap-output-port))
|
||||
(append indentation args))))
|
||||
(println
|
||||
(lambda args
|
||||
(map display (append indentation args)) (display "\n")))
|
||||
(map (lambda (item)
|
||||
(display item tap-output-port))
|
||||
(append indentation args))
|
||||
(display "\n" tap-output-port)))
|
||||
(runner (test-runner-null))
|
||||
(started? #f)
|
||||
(current-test-groups (vector))
|
||||
|
|
@ -39,7 +47,8 @@
|
|||
(test-runner-on-group-end!
|
||||
runner
|
||||
(lambda (runner)
|
||||
(println "1.." current-test-group-count)
|
||||
(when (> current-test-group-count 0)
|
||||
(println "1.." current-test-group-count))
|
||||
(decrease-indentation)
|
||||
(set! current-test-groups
|
||||
(list->vector
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
(import (scheme base)
|
||||
(scheme write)
|
||||
(srfi 64))
|
||||
(export tap-runner)
|
||||
(export tap-runner
|
||||
set-tap-runner-output-port!)
|
||||
(include "tap.scm"))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,45 @@
|
|||
TAP, the Test Anything Protocol, output for SRFI-64
|
||||
TAP output for SRFI-64
|
||||
|
||||
[Test Anything Protocol](https://testanything.org/)
|
||||
|
||||
Usage:
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
(import (scheme base)
|
||||
(srfi 64)
|
||||
(retropikzel tap))
|
||||
|
||||
(test-runner-current (tap-runner))
|
||||
|
||||
|
||||
|
||||
## Jenkins usage tip
|
||||
|
||||
Use JUnit test runner in Jenkins and output to file, use TAP anywhere else and
|
||||
output to stdout.
|
||||
|
||||
(cond
|
||||
;; In Jenkins
|
||||
((get-environment-variable "JENKINS_URL")
|
||||
(let ((junit-file "junit-result.xml"))
|
||||
(test-runner-current (junit-runner))
|
||||
(when (file-exists? junit-file) (delete-file junit-file))
|
||||
(set-junit-runner-output-port! (open-output-file junit-file))))
|
||||
(else (test-runner-current (tap-runner))))
|
||||
|
||||
|
||||
|
||||
## Reference
|
||||
|
||||
(**tap-runner**)
|
||||
|
||||
Get the TAP test runner.
|
||||
|
||||
(**set-tap-runner-output-port!** port)
|
||||
|
||||
Set the output port of the test runner. To output to file you can do:
|
||||
|
||||
(define tap-file "tap-result.txt")
|
||||
(when (file-exists? tap-file) (delete-file tap-file))
|
||||
(set-tap-runner-output-port! (open-output-file tap-file))
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
0.1.2
|
||||
0.2.0
|
||||
|
|
|
|||
|
|
@ -4,9 +4,16 @@
|
|||
(scheme char)
|
||||
(scheme file)
|
||||
(scheme process-context)
|
||||
(srfi 64)
|
||||
;(retropikzel mouth)
|
||||
;(retropikzel ctrf)
|
||||
(retropikzel LIBRARY))
|
||||
(retropikzel tap)
|
||||
(retropikzel junit)
|
||||
(retropikzel LIBRARY)
|
||||
(srfi 64))
|
||||
|
||||
;(test-runner-current (ctrf-runner))
|
||||
(cond
|
||||
;; In Jenkins
|
||||
((get-environment-variable "WORKSPACE")
|
||||
(let ((junit-file "junit-result.xml"))
|
||||
(test-runner-current (junit-runner))
|
||||
(when (file-exists? junit-file) (delete-file junit-file))
|
||||
(set-junit-runner-output-port! (open-output-file junit-file))))
|
||||
(else (test-runner-current (tap-runner))))
|
||||
|
|
|
|||
|
|
@ -1,8 +1,15 @@
|
|||
(import (except (rnrs) delete-file)
|
||||
(retropikzel tap)
|
||||
(retropikzel junit)
|
||||
(retropikzel LIBRARY)
|
||||
(srfi :64)
|
||||
(srfi :98)
|
||||
;(retropikzel mouth)
|
||||
;(retropikzel ctrf)
|
||||
(retropikzel LIBRARY))
|
||||
(srfi :98))
|
||||
|
||||
;(test-runner-current (ctrf-runner))
|
||||
(cond
|
||||
;; In Jenkins
|
||||
((get-environment-variable "WORKSPACE")
|
||||
(let ((junit-file "junit-result.xml"))
|
||||
(test-runner-current (junit-runner))
|
||||
(when (file-exists? junit-file) (delete-file junit-file))
|
||||
(set-junit-runner-output-port! (open-output-file junit-file))))
|
||||
(else (test-runner-current (tap-runner))))
|
||||
|
|
|
|||
Loading…
Reference in New Issue