From 1e786e1a23a1f2276ec2dbe197dcc31a53b43738 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Wed, 21 Aug 2013 03:06:28 +0400 Subject: [PATCH] Fix thread-alloca test on Windows. Invoke gcc in a more portable fashion. --- tests/alloca.c | 1 - tests/foreign-stack-alignment.impure.lisp | 1 - tests/kill-non-lisp-thread.impure.lisp | 1 - tests/run-tests.lisp | 1 - tests/swap-lispobjs.impure.lisp | 1 - tests/test-util.lisp | 13 ++++++++----- tests/threads.impure.lisp | 8 +++----- 7 files changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/alloca.c b/tests/alloca.c index 1e6ab13..18c4b23 100644 --- a/tests/alloca.c +++ b/tests/alloca.c @@ -1,4 +1,3 @@ -#include #include #define SIZE 128*1024 // twice the largest page size diff --git a/tests/foreign-stack-alignment.impure.lisp b/tests/foreign-stack-alignment.impure.lisp index ee14cd9..c7b2b90 100644 --- a/tests/foreign-stack-alignment.impure.lisp +++ b/tests/foreign-stack-alignment.impure.lisp @@ -22,7 +22,6 @@ (output (with-output-to-string (s) (setf proc (run-program program arguments - :environment (test-util::test-env) :output s))))) (unless (zerop (process-exit-code proc)) (error "Bad exit code: ~S~%Output:~% ~S" diff --git a/tests/kill-non-lisp-thread.impure.lisp b/tests/kill-non-lisp-thread.impure.lisp index f59e7f4..f7f88fd 100644 --- a/tests/kill-non-lisp-thread.impure.lisp +++ b/tests/kill-non-lisp-thread.impure.lisp @@ -21,7 +21,6 @@ (output (with-output-to-string (s) (setf proc (run-program program arguments - :environment (test-util::test-env) :output s))))) (unless (zerop (process-exit-code proc)) (error "Bad exit code: ~S~%Output:~% ~S" diff --git a/tests/run-tests.lisp b/tests/run-tests.lisp index 8a7db46..7bf562a 100644 --- a/tests/run-tests.lisp +++ b/tests/run-tests.lisp @@ -215,7 +215,6 @@ ;; What? No SB-POSIX:EXECV? `(let ((process (sb-ext:run-program "/bin/sh" (list (native-namestring ,file)) - :environment (test-util::test-env) :output *error-output*))) (let ((*failures* nil)) (test-util:report-test-status)) diff --git a/tests/swap-lispobjs.impure.lisp b/tests/swap-lispobjs.impure.lisp index 267ed6d..8e8c1ca 100644 --- a/tests/swap-lispobjs.impure.lisp +++ b/tests/swap-lispobjs.impure.lisp @@ -21,7 +21,6 @@ (output (with-output-to-string (s) (setf proc (run-program program arguments - :environment (test-util::test-env) :output s))))) (unless (zerop (process-exit-code proc)) (error "Bad exit code: ~S~%Output:~% ~S" diff --git a/tests/test-util.lisp b/tests/test-util.lisp index c4e4804..40726a4 100644 --- a/tests/test-util.lisp +++ b/tests/test-util.lisp @@ -17,6 +17,14 @@ (defvar *threads-to-kill*) (defvar *threads-to-join*) +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :sb-posix)) + +;;; run-program on Windows doesn't have an :environment parameter, +;;; set these globally +(sb-posix:putenv (format nil "SBCL_MACHINE_TYPE=~A" (machine-type))) +(sb-posix:putenv (format nil "SBCL_SOFTWARE_TYPE=~A" (software-type))) + #+sb-thread (defun make-kill-thread (&rest args) (let ((thread (apply #'sb-thread:make-thread args))) @@ -130,11 +138,6 @@ (defun skipped-p (skipped-on) (sb-impl::featurep skipped-on)) -(defun test-env () - (cons (format nil "SBCL_MACHINE_TYPE=~A" (machine-type)) - (cons (format nil "SBCL_SOFTWARE_TYPE=~A" (software-type)) - (posix-environ)))) - ;;; Repeat calling THUNK until its cumulated runtime, measured using ;;; GET-INTERNAL-RUN-TIME, is larger than PRECISION. Repeat this ;;; REPETITIONS many times and return the time one call to THUNK took diff --git a/tests/threads.impure.lisp b/tests/threads.impure.lisp index c5ff8f2..5da2c1b 100644 --- a/tests/threads.impure.lisp +++ b/tests/threads.impure.lisp @@ -212,8 +212,7 @@ (format o "void loop_forever() { while(1) ; }~%")) (sb-ext:run-program "/bin/sh" '("run-compiler.sh" "-sbcl-pic" "-sbcl-shared" - "-o" "threads-foreign.so" "threads-foreign.c") - :environment (test-util::test-env)) + "-o" "threads-foreign.so" "threads-foreign.c")) (sb-alien:load-shared-object (truename "threads-foreign.so")) (sb-alien:define-alien-routine loop-forever sb-alien:void) (delete-file "threads-foreign.c")) @@ -1555,11 +1554,10 @@ (assert (eq result :ok)))) (with-test (:name :thread-alloca) - (sb-ext:run-program "/bin/sh" + (sb-ext:run-program "sh" '("run-compiler.sh" "-sbcl-pic" "-sbcl-shared" "alloca.c" "-o" "alloca.so") - :environment (test-util::test-env)) - + :search t) (load-shared-object (truename "alloca.so")) (alien-funcall (extern-alien "alloca_test" (function void))) -- 1.7.10.4