From 3a88c3c37959b1710e5fd5c579e002f22102cf3c Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Tue, 26 Nov 2013 13:38:34 +0000 Subject: [PATCH] Fix several test failures under guile 2 with auto compile enabled git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23444 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/app-utils/test/test-load-module | 14 +++++++++++++- src/report/report-gnome/test/test-load-module | 3 ++- .../test/test-standard-category-report.scm | 15 +++++++++++++-- .../test/test-standard-net-barchart.scm | 14 +++++++++++++- .../test/test-standard-net-linechart.scm | 14 +++++++++++++- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/src/app-utils/test/test-load-module b/src/app-utils/test/test-load-module index 827666bad1..3d38bffa58 100755 --- a/src/app-utils/test/test-load-module +++ b/src/app-utils/test/test-load-module @@ -7,7 +7,19 @@ exec ${GUILE} -s "$0" (use-modules (gnucash gnc-module)) (gnc:module-system-init) -(if (gnc:module-load "gnucash/app-utils" 0) +;; Guile 2 needs to load external modules at compile time +;; otherwise the N_ syntax-rule won't be found at compile time +;; causing the test to fail +;; That's what the wrapper below is meant for: +(cond-expand + (guile-2 + (define-syntax-rule (begin-for-syntax form ...) + (eval-when (load compile eval) (begin form ...)))) + (else + (define begin-for-syntax begin))) + +(begin-for-syntax (define loaded-module (gnc:module-load "gnucash/app-utils" 0))) +(if loaded-module (display "Module gnucash/app-utils loaded successfully\n") (begin (display "Failed - module gnucash/app-utils not loaded successfully\n") diff --git a/src/report/report-gnome/test/test-load-module b/src/report/report-gnome/test/test-load-module index b14854c013..332bd2923c 100755 --- a/src/report/report-gnome/test/test-load-module +++ b/src/report/report-gnome/test/test-load-module @@ -6,7 +6,8 @@ exec ${GUILE} -s "$0" (debug-enable 'backtrace) (debug-set! stack 500000) -(debug-set! maxdepth 10000) +(if (< (string->number (major-version)) 2) + (debug-set! maxdepth 100000)) (display " testing report module load ... ") (use-modules (ice-9 syncase)) diff --git a/src/report/standard-reports/test/test-standard-category-report.scm b/src/report/standard-reports/test/test-standard-category-report.scm index 9ef85ea195..aad74fb375 100644 --- a/src/report/standard-reports/test/test-standard-category-report.scm +++ b/src/report/standard-reports/test/test-standard-category-report.scm @@ -2,9 +2,20 @@ (use-modules (ice-9 format)) (use-modules (ice-9 streams)) (use-modules (srfi srfi-1)) - (use-modules (gnucash gnc-module)) -(gnc:module-load "gnucash/report/report-system" 0) + +;; Guile 2 needs to load external modules at compile time +;; otherwise the N_ syntax-rule won't be found at compile time +;; causing the test to fail +;; That's what the wrapper below is meant for: +(cond-expand + (guile-2 + (define-syntax-rule (begin-for-syntax form ...) + (eval-when (load compile eval) (begin form ...)))) + (else + (define begin-for-syntax begin))) + +(begin-for-syntax (gnc:module-load "gnucash/report/report-system" 0)) (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (gnucash printf)) diff --git a/src/report/standard-reports/test/test-standard-net-barchart.scm b/src/report/standard-reports/test/test-standard-net-barchart.scm index 9f4d7f03cb..a9b1fab7fa 100644 --- a/src/report/standard-reports/test/test-standard-net-barchart.scm +++ b/src/report/standard-reports/test/test-standard-net-barchart.scm @@ -2,7 +2,19 @@ ;(use-modules (gnucash report new-reports reports-2)) (use-modules (gnucash gnc-module)) -(gnc:module-load "gnucash/report/report-system" 0) + +;; Guile 2 needs to load external modules at compile time +;; otherwise the N_ syntax-rule won't be found at compile time +;; causing the test to fail +;; That's what the wrapper below is meant for: +(cond-expand + (guile-2 + (define-syntax-rule (begin-for-syntax form ...) + (eval-when (load compile eval) (begin form ...)))) + (else + (define begin-for-syntax begin))) + +(begin-for-syntax (gnc:module-load "gnucash/report/report-system" 0)) (use-modules (gnucash engine)) (use-modules (sw_engine)) diff --git a/src/report/standard-reports/test/test-standard-net-linechart.scm b/src/report/standard-reports/test/test-standard-net-linechart.scm index 07e4825afb..b0e5f58f4e 100644 --- a/src/report/standard-reports/test/test-standard-net-linechart.scm +++ b/src/report/standard-reports/test/test-standard-net-linechart.scm @@ -2,7 +2,19 @@ ;(use-modules (gnucash report new-reports reports-2)) (use-modules (gnucash gnc-module)) -(gnc:module-load "gnucash/report/report-system" 0) + +;; Guile 2 needs to load external modules at compile time +;; otherwise the N_ syntax-rule won't be found at compile time +;; causing the test to fail +;; That's what the wrapper below is meant for: +(cond-expand + (guile-2 + (define-syntax-rule (begin-for-syntax form ...) + (eval-when (load compile eval) (begin form ...)))) + (else + (define begin-for-syntax begin))) + +(begin-for-syntax (gnc:module-load "gnucash/report/report-system" 0)) (use-modules (gnucash engine)) (use-modules (sw_engine))