This patch fixes a failing unit test by feeding buildNormalizedPath to the tzdata properly. Three other tests are disabled, one assumes /root and the two others use networking. Not bad out of almost 700 tests! by Pjotr Prins --- a/std/datetime.d.orig 2016-11-24 01:13:52.584495545 +0100 +++ b/std/datetime.d 2016-11-24 01:17:09.655306728 +0100 @@ -28081,22 +28081,24 @@ import std.range : retro; import std.format : format; - name = strip(name); - enforce(tzDatabaseDir.exists(), new DateTimeException(format("Directory %s does not exist.", tzDatabaseDir))); enforce(tzDatabaseDir.isDir, new DateTimeException(format("%s is not a directory.", tzDatabaseDir))); version(Android) { + name = strip(name); auto tzfileOffset = name in tzdataIndex(tzDatabaseDir); enforce(tzfileOffset, new DateTimeException(format("The time zone %s is not listed.", name))); string tzFilename = separate_index ? "zoneinfo.dat" : "tzdata"; immutable file = buildNormalizedPath(tzDatabaseDir, tzFilename); } else - immutable file = buildNormalizedPath(tzDatabaseDir, name); + { + auto filename = "./" ~ strip(name); // make sure the prefix is not stripped + immutable file = buildNormalizedPath(tzDatabaseDir, filename); + } - enforce(file.exists(), new DateTimeException(format("File %s does not exist.", file))); + enforce(file.exists(), new DateTimeException(format("File %s does not exist in %s.", file, tzDatabaseDir))); enforce(file.isFile, new DateTimeException(format("%s is not a file.", file))); auto tzFile = File(file); diff --git a/std/path.d b/std/path.d index 254d8f0..b0fc04d 100644 --- a/std/path.d +++ b/std/path.d @@ -3080,8 +3080,11 @@ unittest } else { + pragma(msg, "test disabled on GNU Guix"); +/* assert(expandTilde("~root") == "/root", expandTilde("~root")); assert(expandTilde("~root/") == "/root/", expandTilde("~root/")); +*/ } assert(expandTilde("~Idontexist/hey") == "~Idontexist/hey"); } diff --git a/std/socket.d b/std/socket.d index b85d1c9..7fbf346 100644 --- a/std/socket.d +++ b/std/socket.d @@ -859,6 +862,8 @@ class InternetHost unittest { + pragma(msg, "test disabled on GNU Guix"); + /* InternetHost ih = new InternetHost; ih.getHostByAddr(0x7F_00_00_01); @@ -889,6 +894,7 @@ unittest // writefln("aliases[%d] = %s", i, s); // } }); + */ } ; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (test-size) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix packages) #:use-module (guix derivations) #:use-module (guix gexp) #:use-module (guix tests) #:use-module (guix scripts size) #:use-module (gnu packages) #:use-module (gnu packages bootstrap) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64)) (test-begin "size") (test-assertm "store-profile" (mlet* %store-monad ((file1 (gexp->derivation "file1" #~(symlink #$%bootstrap-guile #$output))) (file2 (text-file* "file2" "the file => " file1))) (define (matching-profile item) (lambda (profile) (string=? item (profile-file profile)))) (mbegin %store-monad (built-derivations (list file2)) (mlet %store-monad ((profiles (store-profile (list (derivation->output-path file2)))) (bash (interned-file (search-bootstrap-binary "bash" (%current-system)) "bash" #:recursive? #t)) (guile (package->derivation %bootstrap-guile))) (define (lookup-profile item) (find (matching-profile (if (derivation? item) (derivation->output-path item) item)) profiles)) (letrec-syntax ((match* (syntax-rules (=>) ((_ ((drv => profile) rest ...) body) (match (lookup-profile drv) ((? profile? profile) (match* (rest ...) body)))) ((_ () body) body)))) ;; Make sure we get all three profiles with sensible values. (return (and (= (length profiles) 4) (match* ((file1 => profile1) (file2 => profile2) (guile => profile3) (bash => profile4)) ;dependency of GUILE (and (> (profile-closure-size profile2) 0) (= (profile-closure-size profile2) (+ (profile-self-size profile1) (profile-self-size profile2) (profile-self-size profile3) (profile-self-size profile4)))))))))))) (test-assertm "store-profile with multiple items" (mlet* %store-monad ((file1 (gexp->derivation "file1" #~(symlink #$%bootstrap-guile #$output))) (file2 (text-file* "file2" "the file => " file1))) (mbegin %store-monad (built-derivations (list file2)) (mlet %store-monad ((profiles (store-profile (list (derivation->output-path file2) (derivation->output-path file1)))) (reference (store-profile (list (derivation->output-path file2))))) (return (and (= (length profiles) 4) (lset= equal? profiles reference))))))) (test-end "size") ;;; Local Variables: ;;; eval: (put 'match* 'scheme-indent-function 1) ;;; End: