Test our output against GNU and BSD tar
This commit is contained in:
parent
0d1c459c32
commit
e6d45ea173
|
@ -0,0 +1 @@
|
|||
/test*.tar
|
|
@ -3,13 +3,25 @@
|
|||
(import (scheme base)
|
||||
(scheme file)
|
||||
(scheme process-context)
|
||||
(scheme read)
|
||||
(scheme write)
|
||||
(tex-parser))
|
||||
(trivial-tar-writer))
|
||||
|
||||
(define (slurp-binary-file filename)
|
||||
(call-with-port
|
||||
(open-binary-input-file filename)
|
||||
(lambda (port)
|
||||
(let loop ((whole (make-bytevector 0)))
|
||||
(let ((part (read-bytevector 4096 port)))
|
||||
(if (eof-object? part)
|
||||
whole
|
||||
(loop (bytevector-append whole part))))))))
|
||||
|
||||
(tar-write-file "hello/world.text"
|
||||
(slurp-binary-file "trivial-tar-writer.scm"))
|
||||
|
||||
(define (main arguments)
|
||||
(for-each (lambda (tex-file)
|
||||
(display (with-input-from-file tex-file read-tex-document))
|
||||
(newline))
|
||||
(for-each (lambda (file) (tar-write-file file (slurp-binary-file file)))
|
||||
(cdr arguments)))
|
||||
|
||||
(main (command-line))
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#! /usr/bin/env chibi-scheme
|
||||
|
||||
(import (scheme base)
|
||||
(scheme file)
|
||||
(scheme process-context)
|
||||
(scheme write)
|
||||
(tex-parser))
|
||||
|
||||
(define (main arguments)
|
||||
(for-each (lambda (tex-file)
|
||||
(display (with-input-from-file tex-file read-tex-document))
|
||||
(newline))
|
||||
(cdr arguments)))
|
||||
|
||||
(main (command-line))
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eux
|
||||
./test-chibi.scm trivial-tar-writer.scm >test-our.tar
|
||||
bsdtar -cf test-bsd.tar trivial-tar-writer.scm
|
||||
gtar -cf test-gnu.tar trivial-tar-writer.scm
|
||||
hexdump -C test-our.tar
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
hexdump -C test-gnu.tar
|
||||
echo
|
||||
echo
|
||||
echo
|
||||
hexdump -C test-bsd.tar
|
Loading…
Reference in New Issue