sb-posix: in win32 tests, avoid certain hardcoded file names
authorDavid Lichteblau <david@lichteblau.com>
Wed, 10 Aug 2011 12:58:21 +0000 (14:58 +0200)
committerDavid Lichteblau <david@lichteblau.com>
Wed, 10 Aug 2011 18:04:43 +0000 (20:04 +0200)
  stat.5: Create a fresh file instead of hardcoding c:\pagefile.sys
  (was c:\config.sys until recently; was /bin/sh originally).

  rmdir.error.3: Use %windir% instead of c:\.

  Tests now pass with Wine on my system without local workarounds.

contrib/sb-posix/posix-tests.lisp

index 0eec378..b035e65 100644 (file)
 
 (deftest rmdir.error.3
   (handler-case
-      (sb-posix:rmdir #-win32 "/" #+win32 "C:/")
+      (sb-posix:rmdir #-win32 "/" #+win32 (sb-ext:posix-getenv "windir"))
     (sb-posix:syscall-error (c)
       (typep
        (sb-posix:syscall-errno c)
 
 #+win32
 (deftest stat.5
-    (let* ((stat-1 (sb-posix:stat "/"))
-           (mode-1 (sb-posix:stat-mode stat-1))
-           (stat-2 (sb-posix:stat "C:\\pagefile.sys"
-                                   stat-1))
-           (mode-2 (sb-posix:stat-mode stat-2)))
-      (values
-       (eq stat-1 stat-2)
-       (/= mode-1 mode-2)))
+    (let ((f (namestring (merge-pathnames "some.file" *test-directory*))))
+      (close (open f :if-exists :append :if-does-not-exist :create))
+      (let* ((stat-1 (sb-posix:stat "/"))
+             (mode-1 (sb-posix:stat-mode stat-1))
+             (stat-2 (sb-posix:stat f stat-1))
+             (mode-2 (sb-posix:stat-mode stat-2)))
+        (values
+         (eq stat-1 stat-2)
+         (/= mode-1 mode-2))))
   t
   t)