From 414ab99aa07c550882ffb0c65f8d415dfb1d7008 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Mon, 16 Jul 2018 00:18:58 +0800 Subject: [PATCH] [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 --- .../test/test-stress-options.scm | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/gnucash/report/standard-reports/test/test-stress-options.scm b/gnucash/report/standard-reports/test/test-stress-options.scm index da2ffb6131..42652733f0 100644 --- a/gnucash/report/standard-reports/test/test-stress-options.scm +++ b/gnucash/report/standard-reports/test/test-stress-options.scm @@ -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))