gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Sep 12 19:32:48 EDT 2025


Updated	 via  https://github.com/Gnucash/gnucash/commit/0e48142f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/dcb7a8c2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6666027a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/04d6601b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6fab1386 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/26c02070 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1af9e33d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6fda0321 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/46972b31 (commit)
	from  https://github.com/Gnucash/gnucash/commit/04f9e11f (commit)



commit 0e48142fb7d807b381ce044f14a59842abc7c102
Merge: 5f7017854b dcb7a8c242
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Sep 12 16:32:12 2025 -0700

    Merge John Ralls's 'win32-tests' into stable


commit dcb7a8c24265b2160648abc8d59ff9a7e8ffb7e7
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 4 15:21:32 2025 -0700

    Fix GncDateTime tests on Windows.

diff --git a/libgnucash/engine/gnc-datetime.cpp b/libgnucash/engine/gnc-datetime.cpp
index 2396d8721c..a31d33f850 100644
--- a/libgnucash/engine/gnc-datetime.cpp
+++ b/libgnucash/engine/gnc-datetime.cpp
@@ -585,7 +585,7 @@ std::string
 GncDateTimeImpl::format_zulu(const char* format) const
 {
 #ifdef __MINGW32__
-    auto tz = m_time.zone();
+    auto tz = utc_zone;
     auto tm =  static_cast<struct tm>(*this);
     auto sformat = win_format_tz_abbrev(format, tz, tm.tm_isdst);
     sformat = win_format_tz_name(sformat, tz, tm.tm_isdst);
diff --git a/libgnucash/engine/test/gtest-gnc-datetime.cpp b/libgnucash/engine/test/gtest-gnc-datetime.cpp
index aa538050df..7c4a2b7e7c 100644
--- a/libgnucash/engine/test/gtest-gnc-datetime.cpp
+++ b/libgnucash/engine/test/gtest-gnc-datetime.cpp
@@ -451,7 +451,17 @@ TEST(gnc_datetime_constructors, test_DST_start_transition_time)
     _reset_tzp();
     _set_tzp(tzp_can);
     for (auto hours = 0; hours < 23; ++hours)
+    {
+#ifdef __MINGW32__
+/* Windows thinks 02:59:00 is still DST; of course on the transition
+ * day there is no 02:59, local time goes from 01:59:59 to 03:00:00 so
+ * it's an artifact anyway.
+ */
+        if (hours == 2)
+            continue;
+#endif
         EXPECT_TRUE(test_offset(1601737140, hours, 36000, 39600, "Canberra"));
+    }
     _reset_tzp();
 }
 
@@ -474,13 +484,13 @@ TEST(gnc_datetime_constructors, test_DST_end_transition_time)
     _reset_tzp();
 }
 
+#ifndef __MINGW32__
+/* MSWindows doesn't provide historical timezone information. Brazil
+ * doesn't use DST since 2019 so these tests don't work.
+ */
 TEST(gnc_datetime_constructors, test_create_in_transition)
 {
-#ifdef __MINGW32__
-    TimeZoneProvider tzp_br{"E. South America Standard Time"};
-#else
     TimeZoneProvider tzp_br("America/Sao_Paulo");
-#endif
     _set_tzp(tzp_br);
     /* Test Daylight Savings start: When Sao Paolo had daylight
      * savings time it ended at 23:59:59 and the next second was
@@ -519,6 +529,7 @@ TEST(gnc_datetime_constructors, test_create_in_transition)
     EXPECT_EQ(gncdt3.format_zulu("%Y-%m-%d %H:%M:%S %Z"), "2019-11-01 03:00:00 UTC");
     EXPECT_EQ(gncdt3.format("%Y-%m-%d %H:%M:%S %Z"), "2019-11-01 00:00:00 -03");
 }
+#endif
 
 TEST(gnc_datetime_constructors, test_gncdate_neutral_constructor)
 {

commit 6666027a9bbf53638c4ab620517dd390bb91ad27
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 4 13:00:49 2025 -0700

    Coerce matching file separators for testing gnc_path_get_pkgsysconfdir
    
    g_build_filename claims that on Windows is uses the separator that last previously occurred
    in the parameters, but it looks only at the first character of each parameter to see if it's
    a separator. On Windows the leading character is a letter even on absolute paths so
    g_build_filename(sysconfdir, PROJECT_NAME, NULL) finds no separator and uses the Windows
    default "\\", but in the test function gnc_file_path_relative_part returns "/etc" so
    g_build_filename uses "/" for the project name separator. By explicitly inserting
    G_DIR_SEPARATOR_S before PROJECT_NAME we force the same separator and the test passes on
    Windows.

diff --git a/libgnucash/core-utils/test/gtest-path-utilities.cpp b/libgnucash/core-utils/test/gtest-path-utilities.cpp
index a1af874572..017252293b 100644
--- a/libgnucash/core-utils/test/gtest-path-utilities.cpp
+++ b/libgnucash/core-utils/test/gtest-path-utilities.cpp
@@ -116,7 +116,12 @@ TEST_F(PathTest, gnc_path_get_datadir)
 TEST_F(PathTest, gnc_path_get_sysconfdir)
 {
     gchar *dirname = gnc_file_path_relative_part(PREFIX, SYSCONFDIR);
-    gchar *sysconfpath = g_build_filename(m_prefix, dirname, PROJECT_NAME, NULL);
+    /* G_DIR_SEPARATOR_S forces g_build_filename to use the same
+     * separator as gnc_path_get_pgksysconfdir,
+     */
+    gchar *sysconfpath = g_build_filename(m_prefix, dirname,
+                                          G_DIR_SEPARATOR_S PROJECT_NAME,
+                                          NULL);
     g_free(dirname);
 #ifdef ENABLE_BINRELOC
     EXPECT_STREQ_GFREE(gnc_path_get_pkgsysconfdir(), sysconfpath);

commit 04d6601b746bc35a1c7b50c7994a15d3293db548
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Sep 4 11:45:52 2025 -0700

    Always write XML files with Unix line endings.
    
    So that file size comparisons in test-load-save-files pass on Windows.

diff --git a/libgnucash/backend/xml/io-gncxml-v2.cpp b/libgnucash/backend/xml/io-gncxml-v2.cpp
index 562d685cfd..a13440fe8a 100644
--- a/libgnucash/backend/xml/io-gncxml-v2.cpp
+++ b/libgnucash/backend/xml/io-gncxml-v2.cpp
@@ -1599,7 +1599,7 @@ gnc_book_write_to_xml_file_v2 (QofBook* book, const char* filename,
 {
     bool success = true;
 
-    auto [file, thread] = try_gz_open (filename, "w", compress, TRUE);
+    auto [file, thread] = try_gz_open (filename, "wb", compress, TRUE);
     if (!file)
         return false;
 
@@ -1633,7 +1633,7 @@ gnc_book_write_accounts_to_xml_file_v2 (QofBackend* qof_be, QofBook* book,
     FILE* out;
     gboolean success = TRUE;
 
-    out = g_fopen (filename, "w");
+    out = g_fopen (filename, "wb");
 
     /* Try to write as much as possible */
     if (!out

commit 6fab13864750ef3899fdecdd44dd70e150bfd276
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Aug 28 13:06:02 2025 -0700

    Adjust tests to accommodate Win32 special cases.

diff --git a/libgnucash/core-utils/test/test-userdata-dir.c b/libgnucash/core-utils/test/test-userdata-dir.c
index c42b0249b9..98424feb5b 100644
--- a/libgnucash/core-utils/test/test-userdata-dir.c
+++ b/libgnucash/core-utils/test/test-userdata-dir.c
@@ -32,6 +32,11 @@
 #ifdef MAC_INTEGRATION
 #include <Foundation/Foundation.h>
 #endif
+#include <platform.h>
+#if PLATFORM(WINDOWS)
+#include <windows.h>
+#include <Shlobj.h>
+#endif
 
 struct usr_confpath_strings_struct
 {
@@ -69,7 +74,21 @@ const char *path_package = PROJECT_NAME;
 static char*
 test_get_userdatadir ()
 {
-#ifdef MAC_INTEGRATION
+#ifdef G_OS_WIN32
+  /* Duplicate the override code in get_user_data_dir(). */
+    wchar_t path[MAX_PATH+1];
+    HRESULT hr;
+    LPITEMIDLIST pidl = NULL;
+    BOOL b;
+
+    hr = SHGetSpecialFolderLocation (NULL, CSIDL_APPDATA, &pidl);
+    if (hr == S_OK)
+    {
+        b = SHGetPathFromIDListW (pidl, path);
+        CoTaskMemFree (pidl);
+    }
+    return b ? g_utf16_to_utf8 (path, MAX_PATH, NULL, NULL, NULL) : NULL;
+#elif defined(MAC_INTEGRATION)
      char *retval = NULL;
      NSFileManager*fm = [NSFileManager defaultManager];
      NSArray* appSupportDir = [fm URLsForDirectory:NSApplicationSupportDirectory
diff --git a/libgnucash/engine/test/gtest-gnc-datetime.cpp b/libgnucash/engine/test/gtest-gnc-datetime.cpp
index 5123b098d9..aa538050df 100644
--- a/libgnucash/engine/test/gtest-gnc-datetime.cpp
+++ b/libgnucash/engine/test/gtest-gnc-datetime.cpp
@@ -438,7 +438,7 @@ test_offset(time64 start_time, int hour, int offset1, int offset2,
 TEST(gnc_datetime_constructors, test_DST_start_transition_time)
 {
 #ifdef __MINGW32__
-    TimeZoneProvider tzp_can{"A.U.S Eastern Standard Time"};
+    TimeZoneProvider tzp_can{"AUS Eastern Standard Time"};
     TimeZoneProvider tzp_la{"Pacific Standard Time"};
 #else
     TimeZoneProvider tzp_can("Australia/Canberra");
@@ -458,7 +458,7 @@ TEST(gnc_datetime_constructors, test_DST_start_transition_time)
 TEST(gnc_datetime_constructors, test_DST_end_transition_time)
 {
 #ifdef __MINGW32__
-    TimeZoneProvider tzp_can{"A.U.S Eastern Standard Time"};
+    TimeZoneProvider tzp_can{"AUS Eastern Standard Time"};
     TimeZoneProvider tzp_la{"Pacific Standard Time"};
 #else
     TimeZoneProvider tzp_can("Australia/Canberra");
diff --git a/libgnucash/engine/test/gtest-gnc-numeric.cpp b/libgnucash/engine/test/gtest-gnc-numeric.cpp
index 4341b723a1..d9fea79f29 100644
--- a/libgnucash/engine/test/gtest-gnc-numeric.cpp
+++ b/libgnucash/engine/test/gtest-gnc-numeric.cpp
@@ -293,6 +293,7 @@ TEST(gncnumeric_stream, output_stream)
     GncNumeric rational_string(123, 456);
     output << rational_string;
     EXPECT_EQ("123/456", output.str());
+#ifndef __WIN32 // gnu libstdc++ supports only the C locale
     try
     {
         auto loc = std::locale("fr_FR.utf8");
@@ -321,6 +322,7 @@ TEST(gncnumeric_stream, output_stream)
     output.str("");
     output << decimal_string;
     EXPECT_EQ("123,456", output.str());
+#endif
     output.str("");
     output << rational_string;
     EXPECT_EQ("123/456", output.str());

commit 26c0207060da28fbd8cec480b27236656d259220
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Aug 28 12:48:06 2025 -0700

    Force ISO date format for tests to remove OS and locale differences.

diff --git a/gnucash/report/reports/standard/test/test-balsheet-pnl.scm b/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
index 13eae24751..8c5f51d518 100644
--- a/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
+++ b/gnucash/report/reports/standard/test/test-balsheet-pnl.scm
@@ -172,6 +172,7 @@
       (set-option! balance-sheet-options "Accounts" "Levels of Subaccounts" 'all)
       (set-option! balance-sheet-options "Commodities" "Show Exchange Rates" #t)
       balance-sheet-options))
+  (qof-date-format-set QOF-DATE-FORMAT-ISO)
   (display "\n\n balsheet tests\n\n")
   (let* ((balance-sheet-options (default-balsheet-testing-options))
          (sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-default")))
@@ -519,7 +520,7 @@
     (let ((sxml (options->sxml multicol-balsheet-uuid multi-bs-options
                                "multicol-balsheet-halfyear")))
       (test-equal "bal-1/1/70"
-        '("01/01/70" "$113,100.00" "$113,100.00" "$8,970.00" "$2,000.00"
+        '("1970-01-01" "$113,100.00" "$113,100.00" "$8,970.00" "$2,000.00"
           "$6,870.00" "$0.00" "$100.00" "$4,000.00" "$2,000.00" "$2,000.00"
           "10. FUNDS " "$130.00" "$130.00" "#100.00 " "$100,000.00" "$113,100.00"
           "$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
@@ -527,7 +528,7 @@
           "1. FUNDS $200.00")
         (sxml->table-row-col sxml 1 #f 2))
       (test-equal "bal-1/1/71"
-        '("01/01/71" "$116,006.33" "$116,006.33" "$4,709.00" "$2,000.00"
+        '("1971-01-01" "$116,006.33" "$116,006.33" "$4,709.00" "$2,000.00"
           "$2,609.00" "$0.00" "$100.00" "$11,000.30" "$2,000.00" "$9,000.30"
           "30. FUNDS " "$297.03" "$297.03" "#200.00 " "$100,000.00" "$116,006.33"
           "$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
@@ -535,7 +536,7 @@
           "1. FUNDS $300.01")
         (sxml->table-row-col sxml 1 #f 3))
       (test-equal "bal-1/1/72"
-        '("01/01/72" "$117,437.00" "$117,437.00" "$4,709.00" "$2,000.00"
+        '("1972-01-01" "$117,437.00" "$117,437.00" "$4,709.00" "$2,000.00"
           "$2,609.00" "$0.00" "$100.00" "$12,396.63" "$2,000.00" "$10,396.63"
           "30. FUNDS " "$331.37" "$331.37" "#200.00 " "$100,000.00" "$117,437.00"
           "$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
@@ -547,7 +548,7 @@
     (let ((sxml (options->sxml multicol-balsheet-uuid multi-bs-options
                                "multicol-balsheet-halfyear")))
       (test-equal "bal-1/1/70-reverse-chrono"
-        '("Date" "01/01/72" "01/01/71" "01/01/70")
+        '("Date" "1972-01-01" "1971-01-01" "1970-01-01")
         (sxml->table-row-col sxml 1 1 #f)))
 
     (set-option! multi-bs-options "General" "Period order is most recent first" #f)
@@ -601,15 +602,15 @@
     (let ((sxml (options->sxml multicol-pnl-uuid multi-bs-options
                                "multicol-pnl-halfyear")))
       (test-equal "pnl-1/80"
-        '("01/01/80" " to 01/31/80" "$1,100.00" "$250.00" "$850.00" "#500.00 "
+        '("1980-01-01" " to 01/31/80" "$1,100.00" "$250.00" "$850.00" "#500.00 "
           "$1,100.00" "#1.00 $1.70")
         (sxml->table-row-col sxml 1 #f 2))
       (test-equal "pnl-2/80"
-        '("02/01/80" " to 02/29/80" "$170.00" "$0.00" "$170.00" "#100.00 "
+        '("1980-02-01" " to 02/29/80" "$170.00" "$0.00" "$170.00" "#100.00 "
           "$170.00" "#1.00 $1.70")
         (sxml->table-row-col sxml 1 #f 3))
       (test-equal "pnl-3/80"
-        '("03/01/80" " to 03/31/80" "$0.00" "$0.00" "$0.00" "#0.00 "
+        '("1980-03-01" " to 03/31/80" "$0.00" "$0.00" "$0.00" "#0.00 "
           "$0.00" "#1.00 $1.70")
         (sxml->table-row-col sxml 1 #f 4)))
 
@@ -617,7 +618,7 @@
     (let ((sxml (options->sxml multicol-balsheet-uuid multi-bs-options
                                "testing period reverse chrono order pnl")))
       (test-equal "pnl-reverse chrono"
-        '("Date" "03/31/80" "03/01/80" "02/01/80" "01/01/80")
+        '("Date" "1980-03-31" "1980-03-01" "1980-02-01" "1980-01-01")
         (sxml->table-row-col sxml 1 1 #f)))
 
     (set-option! multi-bs-options "Commodities" "Price Source" 'weighted-average)
diff --git a/gnucash/report/reports/standard/test/test-charts.scm b/gnucash/report/reports/standard/test/test-charts.scm
index a60251caf0..07b8ed7b37 100644
--- a/gnucash/report/reports/standard/test/test-charts.scm
+++ b/gnucash/report/reports/standard/test/test-charts.scm
@@ -77,7 +77,8 @@
       (options->render uuid options "null-test"))))
 
 (define (test-chart variant)
-  (test-group-with-cleanup (format #f "test variant ~a" variant)
+    (qof-date-format-set QOF-DATE-FORMAT-ISO)
+    (test-group-with-cleanup (format #f "test variant ~a" variant)
     (test-chart-variant variant)
     (gnc-clear-current-session)))
 
@@ -127,10 +128,10 @@
             '("Date" "Assets" "Liabilities" "Net Worth")
             (sxml->table-row-col sxml 1 0 #f))
           (test-equal "first data row"
-            '("01/01/70" "$25.00" "$0.00" "$25.00")
+            '("1970-01-01" "$25.00" "$0.00" "$25.00")
             (sxml->table-row-col sxml 1 1 #f))
           (test-equal "last data row"
-            '("04/15/70" "$375.00" "$0.00" "$375.00")
+            '("1970-04-15" "$375.00" "$0.00" "$375.00")
             (sxml->table-row-col sxml 1 -1 #f)))
 
         (when inc-exp?
@@ -138,10 +139,10 @@
             '("Date" "Income" "Expense" "Net Profit")
             (sxml->table-row-col sxml 1 0 #f))
           (test-equal "first data row"
-            '("01/01/70" "$100.00" "$0.00" "$100.00")
+            '("1970-01-01" "$100.00" "$0.00" "$100.00")
             (sxml->table-row-col sxml 1 1 #f))
           (test-equal "last data row"
-            '("04/01/70" "$0.00" "$0.00" "$0.00")
+            '("1970-04-01" "$0.00" "$0.00" "$0.00")
             (sxml->table-row-col sxml 1 -1 #f)))))))
 
 (define (test-chart-variant variant)
@@ -210,10 +211,10 @@
             '("Date" "Assets" "Liabilities" "Net Worth")
             (sxml->table-row-col sxml 1 0 #f))
           (test-equal "net-worth-barchart: first data row"
-            '("01/15/70" "$105.00" "$0.00" "$105.00")
+            '("1970-01-15" "$105.00" "$0.00" "$105.00")
             (sxml->table-row-col sxml 1 1 #f))
           (test-equal "net-worth-barchart: last data row"
-            '("03/15/70" "$2,701.00" "$0.00" "$2,701.00")
+            '("1970-03-15" "$2,701.00" "$0.00" "$2,701.00")
             (sxml->table-row-col sxml 1 -1 #f)))))
 
       (when (eq? variant 'income-expense-barchart)
@@ -230,10 +231,10 @@
             '("Date" "Income" "Expense" "Net Profit")
             (sxml->table-row-col sxml 1 0 #f))
           (test-equal "income-expense: first data row"
-            '("01/15/70" "$14.00" "$0.00" "$14.00")
+            '("1970-01-15" "$14.00" "$0.00" "$14.00")
             (sxml->table-row-col sxml 1 1 #f))
           (test-equal "income-expense: last data row"
-            '("03/15/70" "$73.00" "$0.00" "$73.00")
+            '("1970-03-15" "$73.00" "$0.00" "$73.00")
             (sxml->table-row-col sxml 1 -1 #f))))
       ))
 
diff --git a/gnucash/report/reports/standard/test/test-equity-statement.scm b/gnucash/report/reports/standard/test/test-equity-statement.scm
index 24811f7e4c..777c2daa36 100644
--- a/gnucash/report/reports/standard/test/test-equity-statement.scm
+++ b/gnucash/report/reports/standard/test/test-equity-statement.scm
@@ -60,6 +60,7 @@
          (income (assoc-ref account-alist "Income"))
          (bank (assoc-ref account-alist "Bank")))
 
+    (qof-date-format-set QOF-DATE-FORMAT-ISO)
     (gnc-commodity-set-user-symbol
      (xaccAccountGetCommodity gbp-bank)
      "#")
@@ -83,7 +84,7 @@
         (length (sxml->table-row-col sxml 1 #f #f)))
 
       (test-equal "capital"
-        '("Capital, 01/01/70" "$29.00")
+        '("Capital, 1970-01-01" "$29.00")
         (sxml->table-row-col sxml 1 2 #f))
 
       (test-equal "income"
@@ -107,5 +108,5 @@
         (sxml->table-row-col sxml 1 7 #f))
 
       (test-equal "capital end"
-        '("Capital, 01/01/05" "$3,115.00")
+        '("Capital, 2005-01-01" "$3,115.00")
         (sxml->table-row-col sxml 1 8 #f)))))
diff --git a/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm b/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm
index c34b830ea1..c04d33c8da 100644
--- a/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm
+++ b/gnucash/report/reports/standard/test/test-ifrs-cost-basis.scm
@@ -243,6 +243,7 @@
   account-alist)
 
 (define (ifrs-cost-basis-tests)
+  (qof-date-format-set QOF-DATE-FORMAT-ISO)
   (test-group-with-cleanup "ifrs-cost-basis-tests"
     (let* ((account-alist (create-ifrs-cost-basis-test-data))
            (options (gnc:make-report-options uuid)))
@@ -261,96 +262,96 @@
 
       (let ((sxml (options->sxml uuid options "latest")))
         (test-equal "BUY 100 SPY"
-          '("07/01/19" "Buy SPY" "100. SPY" "100. SPY" "Open Long" "CAD"
+          '("2019-07-01" "Buy SPY" "100. SPY" "100. SPY" "Open Long" "CAD"
             "C$1.00" "C$20,000.00" "C$9.95" "C$20,000.00" "C$9.95"
             "C$20,009.95" "C$0.00" "C$0.00" "C$0.00")
           (sxml->table-row-col sxml 1 1 #f))
 
         (test-equal "BUY 50 SPY"
-          '("12/11/19" "Buy SPY" "50. SPY" "150. SPY" "Buy" "CAD" "C$1.00"
+          '("2019-12-11" "Buy SPY" "50. SPY" "150. SPY" "Buy" "CAD" "C$1.00"
             "C$16,000.00" "C$9.95" "C$16,000.00" "C$9.95" "C$36,019.90"
             "C$200.10" "C$0.00" "C$0.00" "C$0.00")
           (sxml->table-row-col sxml 1 2 #f))
 
         (test-equal "Sell 75 SPY"
-          '("03/18/20" "Sell SPY" "-75. SPY" "75. SPY" "Sell" "CAD" "C$1.00"
+          '("2020-03-18" "Sell SPY" "-75. SPY" "75. SPY" "Sell" "CAD" "C$1.00"
             "C$12,000.00" "C$9.95" "C$12,000.00" "C$9.95" "C$18,009.95"
             "C$240.13" "C$18,009.95" "C$11,990.05" "-C$6,019.90"
             "-C$6,009.95" "-C$6,009.95" "-C$6,009.95" "-C$6,019.90" "-C$6,019.90")
           (sxml->table-row-col sxml 1 3 #f))
 
         (test-equal "BUY 250 SPY"
-          '("04/01/20" "Buy SPY" "250. SPY" "325. SPY" "Buy" "CAD" "C$1.00"
+          '("2020-04-01" "Buy SPY" "250. SPY" "325. SPY" "Buy" "CAD" "C$1.00"
             "C$42,000.00" "C$9.95" "C$42,000.00" "C$9.95" "C$60,019.90"
             "C$240.13" "-C$6,009.95" "-C$6,019.90" "-C$6,019.90")
           (sxml->table-row-col sxml 1 4 #f))
 
         (test-equal "Return Capital $2500"
-          '("04/16/20" "Return of Capital" "0. SPY" "325. SPY" "Return of capital"
+          '("2020-04-16" "Return of Capital" "0. SPY" "325. SPY" "Return of capital"
             "CAD" "C$1.00" "-C$2,500.00" "-C$2,500.00" "C$57,519.90"
             "C$184.68" "-C$6,009.95" "-C$6,019.90" "-C$6,019.90")
           (sxml->table-row-col sxml 1 5 #f))
 
         (test-equal "BUY 125 SPY"
-          '("05/02/20" "Buy spy" "125. SPY" "450. SPY" "Buy" "CAD" "C$1.00"
+          '("2020-05-02" "Buy spy" "125. SPY" "450. SPY" "Buy" "CAD" "C$1.00"
             "C$47,500.00" "C$0.00" "C$47,500.00" "C$0.00" "C$105,019.90"
             "C$176.98" "-C$6,009.95" "-C$6,019.90" "-C$6,019.90")
           (sxml->table-row-col sxml 1 6 #f))
 
         (test-equal "2:1 split"
-          ' ("05/11/20" "stock split" "450. SPY" "900. SPY" "Stock split"
+          ' ("2020-05-11" "stock split" "450. SPY" "900. SPY" "Stock split"
              "CAD" "C$1.00" "C$105,019.90" "C$233.38" "-C$6,009.95"
              "-C$6,019.90" "-C$6,019.90")
           (sxml->table-row-col sxml 1 7 #f))
 
         (test-equal "sell 135 SPY"
-          '("05/21/20" "Sell SPY" "-135. SPY" "765. SPY" "Sell" "CAD" "C$1.00"
+          '("2020-05-21" "Sell SPY" "-135. SPY" "765. SPY" "Sell" "CAD" "C$1.00"
             "C$21,500.00" "C$9.95" "C$21,500.00" "C$9.95" "C$89,266.92"
             "C$116.69" "C$15,752.98" "C$21,490.05" "C$5,737.06"
             "C$5,747.02" "C$5,747.02" "-C$262.94" "-C$282.84" "-C$282.84")
           (sxml->table-row-col sxml 1 8 #f))
 
         (test-equal "BUY 150 SPY"
-          '("06/03/20" "Buy spy" "150. SPY" "915. SPY" "Buy" "CAD" "C$1.00"
+          '("2020-06-03" "Buy spy" "150. SPY" "915. SPY" "Buy" "CAD" "C$1.00"
             "C$21,000.00" "C$0.00" "C$21,000.00" "C$0.00" "C$110,266.92"
             "C$116.69" "-C$262.94" "-C$282.84" "-C$282.84")
           (sxml->table-row-col sxml 1 9 #f))
 
         (test-equal "sell 915 SPY close long"
-          '("06/10/20" "Sell SPY" "-915. SPY" "0. SPY" "Sell" "CAD"
+          '("2020-06-10" "Sell SPY" "-915. SPY" "0. SPY" "Sell" "CAD"
             "C$1.00" "C$128,100.00" "C$9.95" "C$128,100.00" "C$9.95"
             "C$0.00" "C$120.51" "C$110,266.92" "C$128,090.05" "C$17,823.14"
             "C$17,833.08" "C$17,833.08" "C$17,570.15" "C$17,540.30" "C$17,540.30")
           (sxml->table-row-col sxml 1 10 #f))
 
         (test-equal "short-sell 85 SPY"
-          '("06/10/20" "Sell SPY Short" "-85. SPY" "-85. SPY" "Open Short"
+          '("2020-06-10" "Sell SPY Short" "-85. SPY" "-85. SPY" "Open Short"
             "CAD" "C$1.00" "-C$11,900.00" "C$9.95" "-C$11,900.00" "C$9.95"
             "-C$11,890.05" "C$17,570.15" "C$17,540.30" "C$17,540.30")
           (sxml->table-row-col sxml 1 11 #f))
 
         (test-equal "short-sell 65 SPY"
-          '("06/15/20" "Sell SPY Short" "-65. SPY" "-150. SPY" "Short Sell"
+          '("2020-06-15" "Sell SPY Short" "-65. SPY" "-150. SPY" "Short Sell"
             "CAD" "C$1.00" "-C$11,050.00" "C$9.95" "-C$11,050.00" "C$9.95"
             "-C$22,930.10" "C$139.88" "C$17,570.15" "C$17,540.30" "C$17,540.30")
           (sxml->table-row-col sxml 1 12 #f))
 
         (test-equal "buy 50 SPY short"
-          '("06/18/20" "Buy SPY Close Short" "50. SPY" "-100. SPY" "Cover Buy"
+          '("2020-06-18" "Buy SPY Close Short" "50. SPY" "-100. SPY" "Cover Buy"
             "CAD" "C$1.00" "-C$5,000.00" "C$9.95" "-C$5,000.00" "C$9.95"
             "-C$15,286.73" "C$152.87" "-C$7,643.37" "-C$5,009.95" "C$2,633.42"
             "C$2,643.37" "C$2,643.37" "C$20,213.52" "C$20,173.72" "C$20,173.72")
           (sxml->table-row-col sxml 1 13 #f))
 
         (test-equal "BUY 100 SPY close short"
-          '("06/20/20" "Buy SPY Close Short" "100. SPY" "0. SPY" "Cover Buy"
+          '("2020-06-20" "Buy SPY Close Short" "100. SPY" "0. SPY" "Cover Buy"
             "CAD" "C$1.00" "-C$8,000.00" "C$4.98" "-C$8,000.00" "C$4.98"
             "C$0.00" "C$152.87" "-C$15,286.73" "-C$8,004.98" "C$7,281.75"
             "C$7,286.73" "C$7,286.73" "C$27,500.25" "C$27,455.47" "C$27,455.47")
           (sxml->table-row-col sxml 1 14 #f))
 
         (test-equal "BUY 100 SPY"
-          '("06/21/20" "Buy SPY" "100. SPY" "100. SPY" "Open Long" "CAD"
+          '("2020-06-21" "Buy SPY" "100. SPY" "100. SPY" "Open Long" "CAD"
             "C$1.00" "C$8,000.00" "C$4.98" "C$8,000.00" "C$4.98"
             "C$8,004.98" "C$27,500.25" "C$27,455.47" "C$27,455.47")
           (sxml->table-row-col sxml 1 15 #f))))
diff --git a/gnucash/report/reports/standard/test/test-transaction.scm b/gnucash/report/reports/standard/test/test-transaction.scm
index 8b513e3147..70d2be44f3 100644
--- a/gnucash/report/reports/standard/test/test-transaction.scm
+++ b/gnucash/report/reports/standard/test/test-transaction.scm
@@ -67,6 +67,7 @@
   ;; It also catches XML parsing errors, dumping the options changed.
   ;;
   ;; It also dumps the render into /tmp/test-trep-XX.html where XX is the test title
+  (qof-date-format-set QOF-DATE-FORMAT-ISO)
   (gnc:options->sxml trep-uuid options "test-trep" test-title))
 
 (define (get-row-col sxml row col)
@@ -721,7 +722,7 @@
       (set-option! options "Sorting" "Primary Key" 'date)
       (let* ((sxml (options->sxml options "sorting=date")))
         (test-equal "dates are sorted"
-          '("12/31/69" "12/31/69" "01/01/70" "02/01/70" "02/10/70")
+          '("1969-12-31" "1969-12-31" "1970-01-01" "1970-02-01" "1970-02-10")
           (get-row-col sxml #f 1)))
 
       (set-option! options "Sorting" "Primary Key" 'number)

commit 1af9e33d814f6fef09e9cfee4958a7574f444074
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Aug 26 11:39:57 2025 -0700

    [Tests] Fix filepath handling and temp directory location on Win32 builds.

diff --git a/gnucash/report/test/test-report-extras.scm b/gnucash/report/test/test-report-extras.scm
index f4a56cdcee..a65981f3fd 100644
--- a/gnucash/report/test/test-report-extras.scm
+++ b/gnucash/report/test/test-report-extras.scm
@@ -51,8 +51,11 @@
     (gnc:html-document-set-style-sheet! document (gnc:report-stylesheet report))
     (if test-title
         (gnc:html-document-set-title! document test-title))
-    (let ((render (gnc:html-document-render document)))
-      (call-with-output-file (format #f "/tmp/~a-~a.html"
+    (let ((render (gnc:html-document-render document))
+          (tmpdir (if (eq? (system-file-name-convention) 'windows)
+                      (getenv "TMP")
+                      "/tmp")))
+      (call-with-output-file (format #f "~a/~a-~a.html" tmpdir
                                    (string-map sanitize-char prefix)
                                    (string-map sanitize-char test-title))
         (lambda (p)
diff --git a/gnucash/report/test/test-report-html.scm b/gnucash/report/test/test-report-html.scm
index 773a8bbdd9..e9b9f00a3f 100644
--- a/gnucash/report/test/test-report-html.scm
+++ b/gnucash/report/test/test-report-html.scm
@@ -802,8 +802,11 @@ HTML Document Title</title></head><body></body>\n\
     (let* ((doc (gnc:make-html-document)))
       (gnc:html-document-set-style-sheet! doc (gnc:html-style-sheet-find "Default"))
       (gnc:html-document-add-object! doc table)
-      (let ((render (gnc:html-document-render doc)))
-        (call-with-output-file (format #f "/tmp/html-acct-table-~a.html" prefix)
+      (let ((render (gnc:html-document-render doc))
+          (tmpdir (if (eq? (system-file-name-convention) 'windows)
+                      (getenv "TMP")
+                      "/tmp")))
+        (call-with-output-file (format #f "~a/html-acct-table-~a.html" tmpdir prefix)
           (lambda (p)
             (display render p)))
         (xml->sxml render
diff --git a/libgnucash/backend/xml/test/gtest-load-save-files.cpp b/libgnucash/backend/xml/test/gtest-load-save-files.cpp
index 0602487f3a..b8ee039650 100644
--- a/libgnucash/backend/xml/test/gtest-load-save-files.cpp
+++ b/libgnucash/backend/xml/test/gtest-load-save-files.cpp
@@ -40,6 +40,7 @@
 #include <TransLog.h>
 #include <gnc-engine.h>
 #include <gnc-prefs.h>
+#include <gnc-uri-utils.h>
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wcpp"
@@ -208,6 +209,7 @@ public:
 TEST_P(LoadSaveFiles, test_file)
 {
     auto filename = GetParam();
+    auto base_url = gnc_uri_normalize_uri (filename.c_str (), FALSE);
     /* Verify that we can write a compressed version of the original file that
      * has the original content when uncompressed.
      */
@@ -215,7 +217,9 @@ TEST_P(LoadSaveFiles, test_file)
     /* Verify that we can read a compressed file and write an uncompressed file
      * that has the original content.
      */
+    auto compressed_url = gnc_uri_normalize_uri (new_compressed_file.c_str (), FALSE);
     auto new_uncompressed_file = filename + "-test-uncompressed~";
+    auto uncompressed_url = gnc_uri_normalize_uri (new_uncompressed_file.c_str (), FALSE);
     const char *logdomain = "backend.xml";
     GLogLevelFlags loglevel = static_cast<decltype (loglevel)>
                               (G_LOG_LEVEL_WARNING);
@@ -226,14 +230,15 @@ TEST_P(LoadSaveFiles, test_file)
     {
         auto load_uncompressed_session = std::shared_ptr<QofSession>{qof_session_new (qof_book_new ()), qof_session_destroy};
 
-        QOF_SESSION_CHECKED_CALL(qof_session_begin, load_uncompressed_session, filename.c_str (), SESSION_READ_ONLY);
+        QOF_SESSION_CHECKED_CALL(qof_session_begin, load_uncompressed_session, base_url, SESSION_READ_ONLY);
         QOF_SESSION_CHECKED_CALL(qof_session_load, load_uncompressed_session, nullptr);
 
         auto save_compressed_session = std::shared_ptr<QofSession>{qof_session_new (nullptr), qof_session_destroy};
 
         g_unlink (new_compressed_file.c_str ());
         g_unlink ((new_compressed_file + ".LCK").c_str ());
-        QOF_SESSION_CHECKED_CALL(qof_session_begin, save_compressed_session, new_compressed_file.c_str (), SESSION_NEW_OVERWRITE);
+
+        QOF_SESSION_CHECKED_CALL(qof_session_begin, save_compressed_session, compressed_url, SESSION_NEW_OVERWRITE);
 
         qof_event_suspend ();
         qof_session_swap_data (load_uncompressed_session.get (), save_compressed_session.get ());
@@ -254,14 +259,14 @@ TEST_P(LoadSaveFiles, test_file)
     {
         auto load_compressed_session = std::shared_ptr<QofSession>{qof_session_new (qof_book_new ()), qof_session_destroy};
 
-        QOF_SESSION_CHECKED_CALL(qof_session_begin, load_compressed_session, new_compressed_file.c_str (), SESSION_READ_ONLY);
+        QOF_SESSION_CHECKED_CALL(qof_session_begin, load_compressed_session, compressed_url, SESSION_READ_ONLY);
         QOF_SESSION_CHECKED_CALL(qof_session_load, load_compressed_session, nullptr);
 
         auto save_uncompressed_session = std::shared_ptr<QofSession>{qof_session_new (nullptr), qof_session_destroy};
 
         g_unlink (new_uncompressed_file.c_str ());
         g_unlink ((new_uncompressed_file + ".LCK").c_str ());
-        QOF_SESSION_CHECKED_CALL(qof_session_begin, save_uncompressed_session, new_uncompressed_file.c_str (), SESSION_NEW_OVERWRITE);
+        QOF_SESSION_CHECKED_CALL(qof_session_begin, save_uncompressed_session, uncompressed_url, SESSION_NEW_OVERWRITE);
 
         qof_event_suspend ();
         qof_session_swap_data (load_compressed_session.get (), save_uncompressed_session.get ());
@@ -276,6 +281,10 @@ TEST_P(LoadSaveFiles, test_file)
         qof_session_end (save_uncompressed_session.get ());
     }
 
+    g_free (base_url);
+    g_free (compressed_url);
+    g_free (uncompressed_url);
+
     if (!compare_files (filename, new_uncompressed_file))
         return;
 }
diff --git a/libgnucash/backend/xml/test/gtest-xml-contents.cpp b/libgnucash/backend/xml/test/gtest-xml-contents.cpp
index d5db6912a1..f01ba3e2e7 100644
--- a/libgnucash/backend/xml/test/gtest-xml-contents.cpp
+++ b/libgnucash/backend/xml/test/gtest-xml-contents.cpp
@@ -30,6 +30,7 @@
 #include <gnc-prefs.h>
 #include <Account.hpp>
 #include <gnc-datetime.hpp>
+#include <gnc-uri-utils.h>
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wcpp"
@@ -62,8 +63,11 @@ static QofBook*
 session_load (QofSession* session, const char* filename)
 {
     if (!session || !filename) return nullptr;
+    auto url = gnc_uri_normalize_uri (filename, FALSE);
+
+    qof_session_begin (session, url, SESSION_READ_ONLY);
+    g_free (url);
 
-    qof_session_begin (session, filename, SESSION_READ_ONLY);
     if (qof_session_get_error(session) != 0)
     {
         std::cerr << "Session begin failed: " << qof_session_get_error_message(session);
diff --git a/libgnucash/backend/xml/test/test-load-xml2.cpp b/libgnucash/backend/xml/test/test-load-xml2.cpp
index ef6ecc4c91..4ed7384a7c 100644
--- a/libgnucash/backend/xml/test/test-load-xml2.cpp
+++ b/libgnucash/backend/xml/test/test-load-xml2.cpp
@@ -43,6 +43,7 @@
 #include <TransLog.h>
 #include <gnc-engine.h>
 #include <gnc-prefs.h>
+#include <gnc-uri-utils.h>
 
 #include <unittest-support.h>
 #include <test-engine-stuff.h>
@@ -91,13 +92,15 @@ test_load_file (const char* filename)
 
     auto book = qof_book_new();
     auto session = qof_session_new (book);
+    auto url = gnc_uri_normalize_uri (filename, FALSE);
 
     remove_locks (filename);
 
     ignore_lock = (g_strcmp0 (g_getenv ("SRCDIR"), ".") != 0);
     /*    gnc_prefs_set_file_save_compressed(FALSE); */
-    qof_session_begin (session, filename,
+    qof_session_begin (session, url,
                        ignore_lock ? SESSION_READ_ONLY : SESSION_NORMAL_OPEN);
+    g_free (url);
 
     qof_session_load (session, NULL);
 

commit 6fda0321a71a825df8684e90adae24ef86f659af
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Aug 22 16:17:02 2025 -0700

    Fix path environment for Guile and GncModule tests on Windows.

diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake
index 4d6fa5e770..707e46deeb 100644
--- a/common/cmake_modules/GncAddTest.cmake
+++ b/common/cmake_modules/GncAddTest.cmake
@@ -1,85 +1,94 @@
 
 
 function(get_guile_env)
-  set(_GNC_MODULE_PATH ${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash)
+  set(_gnc_module_path ${LIBDIR_BUILD}:${LIBDIR_BUILD}/gnucash)
   if (WIN32)
-    set(_GNC_MODULE_PATH ${CMAKE_BINARY_DIR}/bin)
-  endif()
-  set(env "")
-  list(APPEND env "GNC_UNINSTALLED=yes")
-  list(APPEND env "GNC_BUILDDIR=${CMAKE_BINARY_DIR}")
-  if (APPLE)
-    list(APPEND env "DYLD_LIBRARY_PATH=${_GNC_MODULE_PATH}:$ENV{DYLD_LIBRARY_PATH}")
-  endif()
-  if (UNIX)
-    list(APPEND env "LD_LIBRARY_PATH=${_GNC_MODULE_PATH}:$ENV{LD_LIBRARY_PATH}")
+    set(_gnc_module_path ${CMAKE_BINARY_DIR}/bin)
   endif()
+  set(_relative_site_dir "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}")
+  set(_relative_cache_dir "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
+
   if (MINGW64)
     set(fpath "")
     set(path $ENV{PATH})
     list(INSERT path 0 ${CMAKE_BINARY_DIR}/bin)
-    foreach(dir ${path})
-      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" dir ${dir})
-      string(REGEX REPLACE "\\\\" "/" dir ${dir})
-      set(fpath "${fpath}${dir}:")
-    endforeach(dir)
-    list(APPEND env "PATH=${fpath}")
-    set(compiled_path "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
-    string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
-    string(REGEX REPLACE "\\\\" "/" compiled_path ${compiled_path})
-    list(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
+    if (${GUILE_EFFECTIVE_VERSION} VERSION_LESS 2.2)
+      foreach(dir ${path})
+        make_unix_path(dir)
+        list(APPEND fpath ${dir})
+      endforeach(dir)
+      make_unix_path_list(fpath)
+    else()
+      set(fpath ${path})
+      make_win32_path_list(fpath)
+    endif()
   endif()
-  list(APPEND env "GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
-  list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
 
-  set(guile_load_paths "")
-  list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}")
-  list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/deprecated") # Path to gnucash' deprecated modules
+  set(guile_load_paths "$ENV{GUILE_LOAD_PATH}")
+  list(APPEND guile_load_paths
+    "${_relative_site_dir}"
+    "${_relative_site_dir}/gnucash/deprecated" 
+    )
   if (GUILE_COVERAGE)
-    list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash")
-    list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/report")
-    list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/reports")
-    list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/engine")
-    list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/app-utils")
-    list(APPEND guile_load_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITEDIR}/gnucash/qif-import")
+    list(APPEND guile_load_paths
+      "${_relative_site_dir}/gnucash"
+      "${_relative_site_dir}/gnucash/report"
+      "${_relative_site_dir}/gnucash/reports"
+      "${_relative_site_dir}/gnucash/engine"
+      "${_relative_site_dir}/gnucash/app-utils"
+      "${_relative_site_dir}/gnucash/qif-import"
+      )
 
   endif()
-  set(guile_load_path "${guile_load_paths}")
+  set(_guile_load_path "${guile_load_paths}")
 
-  set(guile_load_compiled_paths "")
-  list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
-  list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}/gnucash/deprecated")
-  list(APPEND guile_load_compiled_paths "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}/tests")
-  set(guile_load_compiled_path "${guile_load_compiled_paths}")
+  set(guile_load_compiled_paths "$ENV{GUILE_LOAD_COMPILED_PATH}")
+  list(APPEND guile_load_compiled_paths
+    "${_relative_cache_dir}"
+    "${_relative_cache_dir}/gnucash/deprecated"
+    "${_relative_cache_dir}/tests"
+  )
+  set(_guile_load_compiled_path "${guile_load_compiled_paths}")
 
-  if (MINGW64)
+  if (MINGW64 AND ${GUILE_EFFECTIVE_VERSION} VERSION_LESS 2.2)
     set(new_path "")
-    foreach(load_item ${guile_load_path})
-#      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
-      string(REGEX REPLACE "\\\\" "/" load_item ${load_item})
-      list(APPEND new_path ${load_item})
+    foreach(load_item ${_guile_load_path})
+      make_unix_path(load_item)
+      list(APPEND new_path "${load_item}")
     endforeach(load_item)
-    set(guile_load_path ${new_path})
+    set(_guile_load_path ${new_path})
 
     set(new_path "")
-    foreach(load_item ${guile_load_compiled_path})
-#      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
-      string(REGEX REPLACE "\\\\" "/" load_item ${load_item})
+    foreach(load_item ${_guile_load_compiled_path})
+      make_unix_path(load_item)
       list(APPEND new_path ${load_item})
     endforeach(load_item)
-    set(guile_load_compiled_path ${new_path})
+    set(_guile_load_compiled_path ${new_path})
   endif()
-  if (WIN32)
-      string(REPLACE ";" "\\\\;" GUILE_LOAD_PATH "${guile_load_path}")
-      string(REPLACE ";" "\\\\;" GUILE_LOAD_COMPILED_PATH "${guile_load_compiled_path}")
+
+  if (NOT MINGW64 OR ${GUILE_EFFECTIVE_VERSION} VERSION_LESS 2.2)
+    make_unix_path_list(_guile_load_path)
+    make_unix_path_list(_guile_load_compiled_path)
   else()
-      string(REPLACE ";" ":" GUILE_LOAD_PATH "${guile_load_path}")
-      string(REPLACE ";" ":" GUILE_LOAD_COMPILED_PATH "${guile_load_compiled_path}")
+    make_win32_path_list(_guile_load_path)
+    make_win32_path_list(_guile_load_compiled_path)
+  endif()
+
+  set(_guile_env
+    "GNC_MODULE_PATH=${_gnc_module_path}"
+    "GUILE=${GUILE_EXECUTABLE}"
+    "GUILE_LOAD_PATH=${_guile_load_path}"
+    "GUILE_LOAD_COMPILED_PATH=${_guile_load_compiled_path}"
+    "GUILE_WARN_DEPRECATED=detailed"
+  )
+  if (MINGW64)
+    list(APPEND _guile_env "PATH=${fpath}")
+  elseif (APPLE)
+    list(APPEND _guile_env "DYLD_LIBRARY_PATH=${_gnc_module_path}:$ENV{DYLD_LIBRARY_PATH}")
+  elseif (UNIX)
+    list(APPEND _guile_env "LD_LIBRARY_PATH=${_gnc_module_path}:$ENV{LD_LIBRARY_PATH}")
   endif()
-  list(APPEND env "GUILE_LOAD_PATH=${GUILE_LOAD_PATH}")
-  list(APPEND env "GUILE_LOAD_COMPILED_PATH=${GUILE_LOAD_COMPILED_PATH}")
-  list(APPEND env "GUILE_WARN_DEPRECATED=detailed")
-  set(GUILE_ENV ${env} PARENT_SCOPE)
+  set(GUILE_ENV "${_guile_env}" PARENT_SCOPE)
 endfunction()
 
 
diff --git a/libgnucash/gnc-module/test/CMakeLists.txt b/libgnucash/gnc-module/test/CMakeLists.txt
index f5c3e5629a..e99f1ca2dc 100644
--- a/libgnucash/gnc-module/test/CMakeLists.txt
+++ b/libgnucash/gnc-module/test/CMakeLists.txt
@@ -17,43 +17,50 @@ set(GNC_MODULE_TEST_LIBS
   gncmod-incompatdep
   gncmod-ordinary
   gncmod-withdep
-  )
+)
+
+set(_gnc_libdir ${LIBDIR_BUILD})
+set(_gnc_module_dir "${_gnc_libdir}/gnucash")
+if (WIN32)
+  set(_gnc_libdir "${CMAKE_BINARY_DIR}/bin")
+  set(_gnc_module_dir "${_gnc_libdir}")
+  set(path $ENV{PATH})
+  list(APPEND path "${_gnc_module_dir}/test")
+  make_win32_path_list(path)
+endif()
 
 gnc_add_test(test-load-c
     test-load-c.c
     GNC_MODULE_TEST_INCLUDE_DIRS
     GNC_MODULE_TEST_LIBS
-    "GNC_MODULE_PATH=${LIBDIR_BUILD}/gnucash/test"
+    "GNC_MODULE_PATH=${_gnc_module_dir}/test"
+    "PATH=${path}"
 )
 
 gnc_add_test(test-modsysver
     test-modsysver.c
     GNC_MODULE_TEST_INCLUDE_DIRS
     GNC_MODULE_TEST_LIBS
-    "GNC_MODULE_PATH=${LIBDIR_BUILD}/gnucash/test/future"
+    "GNC_MODULE_PATH=${_gnc_module_dir}/test/future"
 )
 gnc_add_test(test-incompatdep
     test-incompatdep.c
     GNC_MODULE_TEST_INCLUDE_DIRS
     GNC_MODULE_TEST_LIBS
-    "GNC_MODULE_PATH=${LIBDIR_BUILD}/gnucash/test"
+    "GNC_MODULE_PATH=${_gnc_module_dir}/test"
 )
 gnc_add_test(test-agedver
     test-agedver.c
     GNC_MODULE_TEST_INCLUDE_DIRS
     GNC_MODULE_TEST_LIBS
-    "GNC_MODULE_PATH=${LIBDIR_BUILD}/gnucash/test"
+    "GNC_MODULE_PATH=${_gnc_module_dir}/test"
   )
 
-set(_LIBDIR ${LIBDIR_BUILD})
-if (WIN32)
-  set(_LIBDIR ${CMAKE_BINARY_DIR}/bin)
-endif()
 gnc_add_test(test-dynload
     test-dynload.c
     GNC_MODULE_TEST_INCLUDE_DIRS
     GNC_MODULE_TEST_LIBS
-    LIBDIR=${_LIBDIR}
+    LIBDIR=${_gnc_libdir}
 )
 
 set(test_gnc_module_SOURCE_DIST

commit 46972b3125e6b6515acbc4152409f6dab4c295e4
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Aug 21 13:45:18 2025 -0700

    Set policy CMP0177 and follow the documented recommendations regarding DESTINATION paths.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10d9609e0e..c046460556 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,11 @@ endif()
 if (POLICY CMP0167)
   cmake_policy(SET CMP0167 OLD)
 endif()
+# CMake 3.31+ Use normalization rules on install DESTINATION
+# command. We shouldn't be impacted so allow the new behavior.
+if (POLICY CMP0177)
+  cmake_policy(SET CMP0177 NEW)
+endif()
 
 project (gnucash
     VERSION 5.12
diff --git a/common/cmake_modules/GncAddSchemeTargets.cmake b/common/cmake_modules/GncAddSchemeTargets.cmake
index 9a038def23..8e1e361548 100644
--- a/common/cmake_modules/GncAddSchemeTargets.cmake
+++ b/common/cmake_modules/GncAddSchemeTargets.cmake
@@ -309,8 +309,8 @@ function(gnc_add_scheme_targets _TARGET)
   if(SCHEME_TGT_TEST)
     add_dependencies(check ${_TARGET})
   else()
-    install(FILES ${_TARGET_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${GUILE_REL_SITECCACHEDIR}/${SCHEME_TGT_OUTPUT_DIR})
-    install(FILES ${SCHEME_TGT_SOURCES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${GUILE_REL_SITEDIR}/${SCHEME_TGT_OUTPUT_DIR})
+    install(FILES ${_TARGET_FILES} DESTINATION ${GUILE_REL_SITECCACHEDIR}/${SCHEME_TGT_OUTPUT_DIR})
+    install(FILES ${SCHEME_TGT_SOURCES} DESTINATION ${GUILE_REL_SITEDIR}/${SCHEME_TGT_OUTPUT_DIR})
   endif()
 endfunction()
 
diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake
index 629bbf8010..4d6fa5e770 100644
--- a/common/cmake_modules/GncAddTest.cmake
+++ b/common/cmake_modules/GncAddTest.cmake
@@ -26,6 +26,7 @@ function(get_guile_env)
     list(APPEND env "PATH=${fpath}")
     set(compiled_path "${CMAKE_BINARY_DIR}/${GUILE_REL_SITECCACHEDIR}")
     string(REGEX REPLACE "^([A-Za-z]):" "/\\1" compiled_path ${compiled_path})
+    string(REGEX REPLACE "\\\\" "/" compiled_path ${compiled_path})
     list(APPEND env GUILE_LOAD_COMPILED_PATH=${compiled_path})
   endif()
   list(APPEND env "GNC_MODULE_PATH=${_GNC_MODULE_PATH}")
@@ -54,19 +55,21 @@ function(get_guile_env)
   if (MINGW64)
     set(new_path "")
     foreach(load_item ${guile_load_path})
-      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
+#      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
+      string(REGEX REPLACE "\\\\" "/" load_item ${load_item})
       list(APPEND new_path ${load_item})
     endforeach(load_item)
     set(guile_load_path ${new_path})
 
     set(new_path "")
     foreach(load_item ${guile_load_compiled_path})
-      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
+#      string(REGEX REPLACE "^([A-Za-z]):" "/\\1" load_item ${load_item})
+      string(REGEX REPLACE "\\\\" "/" load_item ${load_item})
       list(APPEND new_path ${load_item})
     endforeach(load_item)
     set(guile_load_compiled_path ${new_path})
   endif()
-  if (WIN32 AND NOT MINGW64)
+  if (WIN32)
       string(REPLACE ";" "\\\\;" GUILE_LOAD_PATH "${guile_load_path}")
       string(REPLACE ";" "\\\\;" GUILE_LOAD_COMPILED_PATH "${guile_load_compiled_path}")
   else()
diff --git a/libgnucash/backend/dbi/test/CMakeLists.txt b/libgnucash/backend/dbi/test/CMakeLists.txt
index 4474a3edcb..f8486d40f0 100644
--- a/libgnucash/backend/dbi/test/CMakeLists.txt
+++ b/libgnucash/backend/dbi/test/CMakeLists.txt
@@ -34,7 +34,6 @@ set(test_dbi_backend_HEADERS test-dbi-business-stuff.h test-dbi-stuff.h)
 
 set_dist_list(test_dbi_backend_DIST ${test_dbi_backend_SOURCES} ${test_dbi_backend_HEADERS} test-dbi.xml CMakeLists.txt )
 
-# This test does not work on Win32
 if (WITH_SQL)
   gnc_add_test(test-backend-dbi "${test_dbi_backend_SOURCES}"
     BACKEND_DBI_TEST_INCLUDE_DIRS BACKEND_DBI_TEST_LIBS



Summary of changes:
 CMakeLists.txt                                     |   5 +
 common/cmake_modules/GncAddSchemeTargets.cmake     |   4 +-
 common/cmake_modules/GncAddTest.cmake              | 124 +++++++++++----------
 .../reports/standard/test/test-balsheet-pnl.scm    |  17 +--
 .../report/reports/standard/test/test-charts.scm   |  19 ++--
 .../standard/test/test-equity-statement.scm        |   5 +-
 .../reports/standard/test/test-ifrs-cost-basis.scm |  31 +++---
 .../reports/standard/test/test-transaction.scm     |   3 +-
 gnucash/report/test/test-report-extras.scm         |   7 +-
 gnucash/report/test/test-report-html.scm           |   7 +-
 libgnucash/backend/dbi/test/CMakeLists.txt         |   1 -
 libgnucash/backend/xml/io-gncxml-v2.cpp            |   4 +-
 .../backend/xml/test/gtest-load-save-files.cpp     |  17 ++-
 libgnucash/backend/xml/test/gtest-xml-contents.cpp |   6 +-
 libgnucash/backend/xml/test/test-load-xml2.cpp     |   5 +-
 .../core-utils/test/gtest-path-utilities.cpp       |   7 +-
 libgnucash/core-utils/test/test-userdata-dir.c     |  21 +++-
 libgnucash/engine/gnc-datetime.cpp                 |   2 +-
 libgnucash/engine/test/gtest-gnc-datetime.cpp      |  23 +++-
 libgnucash/engine/test/gtest-gnc-numeric.cpp       |   2 +
 libgnucash/gnc-module/test/CMakeLists.txt          |  27 +++--
 21 files changed, 212 insertions(+), 125 deletions(-)



More information about the gnucash-changes mailing list