Skip to content

Instantly share code, notes, and snippets.

@simendsjo
Created September 1, 2020 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simendsjo/addb9e6e30cf6e287a57cfcb7e0c9aef to your computer and use it in GitHub Desktop.
Save simendsjo/addb9e6e30cf6e287a57cfcb7e0c9aef to your computer and use it in GitHub Desktop.
test-name: add-file-tree-to-store
location: /home/simendsjo/code/guix/tests/store.scm:249
source:
+ (test-equal
+ "add-file-tree-to-store"
+ `(42
+ ("." directory #t)
+ ("./bar" directory #t)
+ ("./foo" directory #t)
+ ("./foo/a" regular "file a")
+ ("./foo/b" symlink "a")
+ ("./foo/c" directory #t)
+ ("./foo/c/p" regular "file p")
+ ("./foo/c/q" directory #t)
+ ("./foo/c/q/x"
+ regular
+ ,(string-append "#!" %shell "\nexit 42"))
+ ("./foo/c/q/y" symlink "..")
+ ("./foo/c/q/z" directory #t))
+ (let* ((tree `("file-tree"
+ directory
+ ("foo"
+ directory
+ ("a" regular (data "file a"))
+ ("b" symlink "a")
+ ("c"
+ directory
+ ("p" regular (data ,(string->utf8 "file p")))
+ ("q"
+ directory
+ ("x"
+ executable
+ (data ,(string-append "#!" %shell "\nexit 42")))
+ ("y" symlink "..")
+ ("z" directory))))
+ ("bar" directory)))
+ (result (add-file-tree-to-store %store tree)))
+ (cons (status:exit-val
+ (system* (string-append result "/foo/c/q/x")))
+ (with-directory-excursion
+ result
+ (map (lambda (file)
+ (let ((type (stat:type (lstat file))))
+ `(,file
+ ,type
+ ,(match type
+ ((or 'regular 'executable)
+ (call-with-input-file file get-string-all))
+ ('symlink (readlink file))
+ ('directory #t)))))
+ (find-files "." #:directories? #t))))))
Backtrace:
14 (primitive-load-path "tests/store.scm")
In ice-9/eval.scm:
619:8 13 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
293:34 12 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 11 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 10 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 9 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 8 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 7 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 6 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 5 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 4 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 3 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
159:9 2 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
163:9 1 (_ #(#(#<directory (test-store) 7f7171e79d20> #<te?>) #))
In unknown file:
0 (string-append "#!" #f "\nexit 42")
ERROR: In procedure string-append:
In procedure string-append: Wrong type (expecting string): #f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment