Changeset 22628 in project for release/4/ugarit/trunk/test/run.scm


Ignore:
Timestamp:
02/05/11 16:48:26 (11 years ago)
Author:
Alaric Snell-Pym
Message:

ugarit: Test for storing and extracting a directory

Still lacking an actual comparison of the extracted
result to the original input, though. Is there an easy
way to compare two directories, to save me writing a
heap of logic to do that recursively? That'd be a bit of
a yak-shaving exercise.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/ugarit/trunk/test/run.scm

    r22448 r22628  
    33(use ugarit-backend)
    44(use test)
    5 
     5(use posix)
     6(use directory-rules)
    67(include "../backend-devtools.scm")
    78(include "../backend-cache.scm")
     
    313314           (lambda ()
    314315             (write-file-contents a file-key))))
    315    
     316
    316317   (if (archive-unlinkable? a)
    317318      (begin
    318          (test "Delete the file" (void) (unlink-file! archive file-key))
     319         (test "Delete the file" (void) (unlink-file! a file-key))
    319320         (check-dir-is-empty store-path))))
     321
     322   (test-group "Directories"
     323               (let* ((test-dir (string-append store-path "-test-data"))
     324                      (extract-dir (string-append store-path "-test-extract"))
     325                      (tp (lambda (relative)
     326                            (string-append test-dir "/" relative))))
     327                 (create-directory test-dir)
     328                 (with-output-to-file (tp "plain-file") (lambda () (write "Hello world")))
     329                 (create-fifo (tp "fifo"))
     330                 #;(create-special-file (tp "block-special") stat/ifblk 123)
     331                 #;(create-special-file (tp "character-special") stat/ifchr 456)
     332                 (create-directory (tp "directory"))
     333
     334                 (test-define-values "Store a directory" (dir-key dir-reused?)
     335                                     (call-with-context-support
     336                                      (archive-global-directory-rules a)
     337                                      (lambda ()
     338                                       (store-directory! a test-dir))))
     339
     340                 (create-directory extract-dir)
     341
     342                 (test "Extract a directory" (void)
     343                       (extract-directory! a dir-key extract-dir))
     344
     345                 ;; FIXME: Compare the contents of test-dir and extract-dir?
     346
     347                 (if (archive-unlinkable? a)
     348                     (begin
     349                       (test "Delete the directory" (void) (unlink-directory! a dir-key))
     350                       (check-dir-is-empty store-path)))))
    320351#|
    321    
    322    
    323    (printf "directories...\n")
    324    
    325    (printf "\tStore a directory\n")
    326    
    327    (define-values (dir-key dir-reused?)
    328       (store-directory! archive "test-data"))
    329 
    330    (printf "\tExtract the directory\n")
    331    (create-directory (string-append store-path "-extract"))
    332    (extract-directory! archive dir-key (string-append store-path "-extract"))
    333    
    334    (if (archive-unlinkable? a)
    335       (begin
    336          (printf "\tDelete the directory\n")
    337          (unlink-directory! archive dir-key)
    338          (check-dir-is-empty store-path)))
    339352   
    340353   (printf "snapshots\n")
Note: See TracChangeset for help on using the changeset viewer.