Fix thread-alloca test on Windows.
authorStas Boukarev <stassats@gmail.com>
Tue, 20 Aug 2013 23:06:28 +0000 (03:06 +0400)
committerStas Boukarev <stassats@gmail.com>
Tue, 20 Aug 2013 23:06:28 +0000 (03:06 +0400)
Invoke gcc in a more portable fashion.

tests/alloca.c
tests/foreign-stack-alignment.impure.lisp
tests/kill-non-lisp-thread.impure.lisp
tests/run-tests.lisp
tests/swap-lispobjs.impure.lisp
tests/test-util.lisp
tests/threads.impure.lisp

index 1e6ab13..18c4b23 100644 (file)
@@ -1,4 +1,3 @@
-#include <alloca.h>
 #include <string.h>
 
 #define SIZE 128*1024 // twice the largest page size
index ee14cd9..c7b2b90 100644 (file)
@@ -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"
index f59e7f4..f7f88fd 100644 (file)
@@ -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"
index 8a7db46..7bf562a 100644 (file)
   ;; 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))
index 267ed6d..8e8c1ca 100644 (file)
@@ -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"
index c4e4804..40726a4 100644 (file)
 (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)))
 (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
index c5ff8f2..5da2c1b 100644 (file)
     (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"))
     (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)))