[test-stress-options] Set COMBINATORICS to full path to jenny

Setting COMBINATORICS to the full path name to jenny will enable
pairwise testing.

e.g. COMBINATORICS=/home/user/jenny/jenny ninja check
This commit is contained in:
Christopher Lam 2018-07-16 00:18:58 +08:00
parent b8ce2b545a
commit 414ab99aa0

View File

@ -17,6 +17,15 @@
(use-modules (sxml simple))
(use-modules (sxml xpath))
;; NOTE
;; ----
;; SIMPLE stress tests by default
;;
;; PAIRWISE COMBINATORICS are enabled by setting environment variable COMBINATORICS
;; to the fullpath for the compiled jenny from http://burtleburtle.net/bob/math/jenny.html
;;
;; e.g. COMBINATORICS=/home/user/jenny/jenny ninja check
(load "test-stress-optionslist.scm")
;; The above optionslist was generated programmatically. It was
;; generated by running a sentinel function in the middle of an
@ -81,6 +90,18 @@
(tests)
(test-end "stress options"))
(define jennypath
(get-environment-variable "COMBINATORICS"))
(define jenny-exists?
;; this is a simple test for presence of jenny - will check
;; COMBINATORICS env exists, and running it produces exit-code of
;; zero, and tests the first few letters of its output.
(and (string? jennypath)
(zero? (system jennypath))
(string=? (string-take (get-string-all (open-input-pipe jennypath)) 6)
"jenny:")))
(define (set-option! options section name value)
(let ((option (gnc:lookup-option options section name)))
(if option
@ -175,8 +196,8 @@
;; the following is the n-tuple
2
(length report-options)))
(cmdline (format #f "/home/chris/sources/jenny/jenny -n~a ~a"
n-tuple jennyargs))
(cmdline (format #f "~a -n~a ~a"
jennypath n-tuple jennyargs))
(jennyout (get-string-all (open-input-pipe cmdline)))
(test-cases (string-split jennyout #\newline)))
(for-each
@ -221,7 +242,7 @@
;; what strategy are we using here? simple stress test (ie tests as
;; many times as the maximum number of options) or combinatorial
;; tests (using jenny)
(if (get-environment-variable "COMBINATORICS")
(if jenny-exists?
combinatorial-stress-test
simple-stress-test))