From 50f373f4d62308b4bfcceaceb0219b707db489df Mon Sep 17 00:00:00 2001 From: shhyou Date: Mon, 21 Dec 2020 15:18:07 -0600 Subject: [PATCH] Fixes of the core tests for testing on Windows * Initialize the environment variables with paths to MSVC toolchain before running the racket-test-core, since the foreign library tests need a C compiler. * Fix a bug in foreign-test.rktl that deletes the existing content of environment variables (PATH, INCLUDE, LIB, etc) * Let a test in date.rktl fail more gracefully. --- .github/workflows/ci_win.yml | 4 +++- pkgs/racket-test-core/tests/racket/date.rktl | 4 +++- pkgs/racket-test-core/tests/racket/foreign-test.rktl | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_win.yml b/.github/workflows/ci_win.yml index b5d0c841b9..3d1b3e7315 100644 --- a/.github/workflows/ci_win.yml +++ b/.github/workflows/ci_win.yml @@ -47,7 +47,9 @@ jobs: call racket\raco.exe pkg install --auto --no-docs racket-test unstable-flonum-lib net-test - name: Run tests/racket/test shell: cmd - run: racket\raco.exe test -l tests/racket/test + run: | + call .\racket\src\worksp\msvcprep.bat x86_amd64 + racket\raco.exe test -l tests/racket/test - name: Run tests/racket/contract/all shell: cmd run: racket\racket.exe -l tests/racket/contract/all diff --git a/pkgs/racket-test-core/tests/racket/date.rktl b/pkgs/racket-test-core/tests/racket/date.rktl index 2da229605d..a1bb43f7a6 100644 --- a/pkgs/racket-test-core/tests/racket/date.rktl +++ b/pkgs/racket-test-core/tests/racket/date.rktl @@ -26,7 +26,9 @@ (test 0 find-seconds 0 0 0 1 1 1970 #f) (test 32416215 find-seconds 15 30 4 11 1 1971 #f) -(test 1969 date-year (seconds->date (- (* 24 60 60)))) +(define (date-year.seconds->date sec) + (date-year (seconds->date sec))) +(test 1969 date-year.seconds->date (- (* 24 60 60))) (let* ([s (current-seconds)] [d1 (seconds->date s)] diff --git a/pkgs/racket-test-core/tests/racket/foreign-test.rktl b/pkgs/racket-test-core/tests/racket/foreign-test.rktl index 8ce08aff30..0d081c2cb7 100644 --- a/pkgs/racket-test-core/tests/racket/foreign-test.rktl +++ b/pkgs/racket-test-core/tests/racket/foreign-test.rktl @@ -73,17 +73,19 @@ (and progfiles (concat progfiles "/Microsoft Visual Studio 10.0"))) (when (and studio (directory-exists? studio)) (define (paths-env var . ps) + (define orig-val (getenv var)) (define val (apply concat (for/list ([p (in-list ps)] #:when (and p (directory-exists? p))) (concat p ";")))) (printf ">>> $~a = ~s\n" var val) - (putenv var val)) + (putenv var (if orig-val + (concat orig-val ";" val) + val))) (define (vc p) (concat studio "/VC/" p)) (define (common p) (concat studio "/Common7/" p)) (define (winsdk p) (concat progfiles "/Microsoft SDKs/Windows/v7.0A/" p)) (paths-env "PATH" - (getenv "PATH") (vc (if 64bit? "BIN/amd64" "BIN")) (vc "IDE") (vc "Tools") (vc "Tools/bin") (common "Tools") (common "IDE"))