Skip to content

Commit

Permalink
Fixes of the core tests for testing on Windows
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
shhyou committed Dec 21, 2020
1 parent 0041354 commit 50f373f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion pkgs/racket-test-core/tests/racket/date.rktl
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 4 additions & 2 deletions pkgs/racket-test-core/tests/racket/foreign-test.rktl
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 50f373f

Please sign in to comment.