whitespace
This commit is contained in:
parent
9e096fa982
commit
fe1f46ae07
@ -52,86 +52,86 @@
|
|||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
|
|
||||||
(define-scenario (cache-check v)
|
(define-scenario (cache-check v)
|
||||||
"cache_check -V"
|
"cache_check -V"
|
||||||
(receive (stdout _) (cache-check "-V")
|
(receive (stdout _) (cache-check "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-check version)
|
(define-scenario (cache-check version)
|
||||||
"cache_check --version"
|
"cache_check --version"
|
||||||
(receive (stdout _) (cache-check "--version")
|
(receive (stdout _) (cache-check "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-check h)
|
(define-scenario (cache-check h)
|
||||||
"cache_check -h"
|
"cache_check -h"
|
||||||
(receive (stdout _) (cache-check "-h")
|
(receive (stdout _) (cache-check "-h")
|
||||||
(assert-equal cache-check-help stdout)))
|
(assert-equal cache-check-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-check help)
|
(define-scenario (cache-check help)
|
||||||
"cache_check --help"
|
"cache_check --help"
|
||||||
(receive (stdout _) (cache-check "--help")
|
(receive (stdout _) (cache-check "--help")
|
||||||
(assert-equal cache-check-help stdout)))
|
(assert-equal cache-check-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-check must-specify-metadata)
|
(define-scenario (cache-check must-specify-metadata)
|
||||||
"Metadata file must be specified"
|
"Metadata file must be specified"
|
||||||
(receive (_ stderr) (run-fail "cache_check")
|
(receive (_ stderr) (run-fail "cache_check")
|
||||||
(assert-equal
|
(assert-equal
|
||||||
(string-append "No input file provided.\n"
|
(string-append "No input file provided.\n"
|
||||||
cache-check-help)
|
cache-check-help)
|
||||||
stderr)))
|
stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-check no-such-metadata)
|
(define-scenario (cache-check no-such-metadata)
|
||||||
"Metadata file doesn't exist."
|
"Metadata file doesn't exist."
|
||||||
(let ((bad-path "/arbitrary/filename"))
|
(let ((bad-path "/arbitrary/filename"))
|
||||||
(receive (_ stderr) (run-fail "cache_check" bad-path)
|
(receive (_ stderr) (run-fail "cache_check" bad-path)
|
||||||
(assert-starts-with
|
(assert-starts-with
|
||||||
(string-append bad-path ": No such file or directory")
|
(string-append bad-path ": No such file or directory")
|
||||||
stderr))))
|
stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-check metadata-file-cannot-be-a-directory)
|
(define-scenario (cache-check metadata-file-cannot-be-a-directory)
|
||||||
"Metadata file must not be a directory"
|
"Metadata file must not be a directory"
|
||||||
(let ((bad-path "/tmp"))
|
(let ((bad-path "/tmp"))
|
||||||
(receive (_ stderr) (run-fail "cache_check" bad-path)
|
(receive (_ stderr) (run-fail "cache_check" bad-path)
|
||||||
(assert-starts-with
|
(assert-starts-with
|
||||||
(string-append bad-path ": Not a block device or regular file")
|
(string-append bad-path ": Not a block device or regular file")
|
||||||
stderr))))
|
stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-check unreadable-metadata)
|
(define-scenario (cache-check unreadable-metadata)
|
||||||
"Metadata file exists, but is unreadable."
|
"Metadata file exists, but is unreadable."
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(run-ok "chmod" "-r" md)
|
(run-ok "chmod" "-r" md)
|
||||||
(receive (_ stderr) (run-fail "cache_check" md)
|
(receive (_ stderr) (run-fail "cache_check" md)
|
||||||
(assert-starts-with "syscall 'open' failed: Permission denied" stderr))))
|
(assert-starts-with "syscall 'open' failed: Permission denied" stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-check fails-with-corrupt-metadata)
|
(define-scenario (cache-check fails-with-corrupt-metadata)
|
||||||
"Fail with corrupt superblock"
|
"Fail with corrupt superblock"
|
||||||
(with-corrupt-metadata (md)
|
(with-corrupt-metadata (md)
|
||||||
(run-fail "cache_check" md)))
|
(run-fail "cache_check" md)))
|
||||||
|
|
||||||
(define-scenario (cache-check failing-q)
|
(define-scenario (cache-check failing-q)
|
||||||
"Fail quietly with -q"
|
"Fail quietly with -q"
|
||||||
(with-corrupt-metadata (md)
|
(with-corrupt-metadata (md)
|
||||||
(receive (stdout stderr) (run-fail "cache_check" "-q" md)
|
(receive (stdout stderr) (run-fail "cache_check" "-q" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr))))
|
(assert-eof stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-check failing-quiet)
|
(define-scenario (cache-check failing-quiet)
|
||||||
"Fail quietly with --quiet"
|
"Fail quietly with --quiet"
|
||||||
(with-corrupt-metadata (md)
|
(with-corrupt-metadata (md)
|
||||||
(receive (stdout stderr) (run-fail "cache_check" "--quiet" md)
|
(receive (stdout stderr) (run-fail "cache_check" "--quiet" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr))))
|
(assert-eof stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-check valid-metadata-passes)
|
(define-scenario (cache-check valid-metadata-passes)
|
||||||
"A valid metadata area passes"
|
"A valid metadata area passes"
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(cache-check md)))
|
(cache-check md)))
|
||||||
|
|
||||||
(define-scenario (cache-check bad-metadata-version)
|
(define-scenario (cache-check bad-metadata-version)
|
||||||
"Invalid metadata version fails"
|
"Invalid metadata version fails"
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(cache-restore "-i" xml "-o" md "--debug-override-metadata-version" "12345")
|
(cache-restore "-i" xml "-o" md "--debug-override-metadata-version" "12345")
|
||||||
(run-fail "cache_check" md))))
|
(run-fail "cache_check" md))))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; cache_restore scenarios
|
;;; cache_restore scenarios
|
||||||
@ -148,74 +148,74 @@
|
|||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-restore h)
|
(define-scenario (cache-restore h)
|
||||||
"cache_restore -h"
|
"cache_restore -h"
|
||||||
(receive (stdout _) (cache-restore "-h")
|
(receive (stdout _) (cache-restore "-h")
|
||||||
(assert-equal cache-restore-help stdout)))
|
(assert-equal cache-restore-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-restore help)
|
(define-scenario (cache-restore help)
|
||||||
"cache_restore --help"
|
"cache_restore --help"
|
||||||
(receive (stdout _) (cache-restore "--help")
|
(receive (stdout _) (cache-restore "--help")
|
||||||
(assert-equal cache-restore-help stdout)))
|
(assert-equal cache-restore-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-restore no-input-file)
|
(define-scenario (cache-restore no-input-file)
|
||||||
"forget to specify an input file"
|
"forget to specify an input file"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (_ stderr) (run-fail "cache_restore" "-o" md)
|
(receive (_ stderr) (run-fail "cache_restore" "-o" md)
|
||||||
(assert-starts-with "No input file provided." stderr))))
|
(assert-starts-with "No input file provided." stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-restore missing-input-file)
|
(define-scenario (cache-restore missing-input-file)
|
||||||
"the input file can't be found"
|
"the input file can't be found"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (_ stderr) (run-fail "cache_restore -i no-such-file -o" md)
|
(receive (_ stderr) (run-fail "cache_restore -i no-such-file -o" md)
|
||||||
(assert-starts-with "Couldn't stat file" stderr))))
|
(assert-starts-with "Couldn't stat file" stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-restore missing-output-file)
|
(define-scenario (cache-restore missing-output-file)
|
||||||
"the output file can't be found"
|
"the output file can't be found"
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(receive (_ stderr) (run-fail "cache_restore -i " xml)
|
(receive (_ stderr) (run-fail "cache_restore -i " xml)
|
||||||
(assert-starts-with "No output file provided." stderr))))
|
(assert-starts-with "No output file provided." stderr))))
|
||||||
|
|
||||||
(define-scenario (cache-restore tiny-output-file)
|
(define-scenario (cache-restore tiny-output-file)
|
||||||
"Fails if the output file is too small."
|
"Fails if the output file is too small."
|
||||||
(with-temp-file-sized ((md "cache.bin" (* 1024 4)))
|
(with-temp-file-sized ((md "cache.bin" (* 1024 4)))
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(receive (_ stderr) (run-fail "cache_restore" "-i" xml "-o" md)
|
(receive (_ stderr) (run-fail "cache_restore" "-i" xml "-o" md)
|
||||||
(assert-starts-with cache-restore-outfile-too-small-text stderr)))))
|
(assert-starts-with cache-restore-outfile-too-small-text stderr)))))
|
||||||
|
|
||||||
(define-scenario (cache-restore successfully-restores)
|
(define-scenario (cache-restore successfully-restores)
|
||||||
"Restore succeeds."
|
"Restore succeeds."
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(cache-restore "-i" xml "-o" md))))
|
(cache-restore "-i" xml "-o" md))))
|
||||||
|
|
||||||
(define-scenario (cache-restore q)
|
(define-scenario (cache-restore q)
|
||||||
"cache_restore accepts -q"
|
"cache_restore accepts -q"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(receive (stdout stderr) (cache-restore "-i" xml "-o" md "-q")
|
(receive (stdout stderr) (cache-restore "-i" xml "-o" md "-q")
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr)))))
|
(assert-eof stderr)))))
|
||||||
|
|
||||||
(define-scenario (cache-restore quiet)
|
(define-scenario (cache-restore quiet)
|
||||||
"cache_restore accepts --quiet"
|
"cache_restore accepts --quiet"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(receive (stdout stderr) (cache-restore "-i" xml "-o" md "--quiet")
|
(receive (stdout stderr) (cache-restore "-i" xml "-o" md "--quiet")
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr)))))
|
(assert-eof stderr)))))
|
||||||
|
|
||||||
;; Failing due to a genuine bug in cache_restore
|
;; Failing due to a genuine bug in cache_restore
|
||||||
(define-scenario (cache-restore override-metadata-version)
|
(define-scenario (cache-restore override-metadata-version)
|
||||||
"we can set any metadata version"
|
"we can set any metadata version"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(cache-restore "-i" xml "-o" md "--debug-override-metadata-version 10298"))))
|
(cache-restore "-i" xml "-o" md "--debug-override-metadata-version 10298"))))
|
||||||
|
|
||||||
(define-scenario (cache-restore omit-clean-shutdown)
|
(define-scenario (cache-restore omit-clean-shutdown)
|
||||||
"accepts --omit-clean-shutdown"
|
"accepts --omit-clean-shutdown"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-cache-xml (xml)
|
(with-cache-xml (xml)
|
||||||
(cache-restore "-i" xml "-o" md "--omit-clean-shutdown"))))
|
(cache-restore "-i" xml "-o" md "--omit-clean-shutdown"))))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; cache_dump scenarios
|
;;; cache_dump scenarios
|
||||||
@ -232,14 +232,14 @@
|
|||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-dump h)
|
(define-scenario (cache-dump h)
|
||||||
"cache_dump -h"
|
"cache_dump -h"
|
||||||
(receive (stdout _) (cache-dump "-h")
|
(receive (stdout _) (cache-dump "-h")
|
||||||
(assert-equal cache-dump-help stdout)))
|
(assert-equal cache-dump-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-dump help)
|
(define-scenario (cache-dump help)
|
||||||
"cache_dump --help"
|
"cache_dump --help"
|
||||||
(receive (stdout _) (cache-dump "--help")
|
(receive (stdout _) (cache-dump "--help")
|
||||||
(assert-equal cache-dump-help stdout)))
|
(assert-equal cache-dump-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-dump missing-input-file)
|
(define-scenario (cache-dump missing-input-file)
|
||||||
"Fails with missing input file."
|
"Fails with missing input file."
|
||||||
@ -247,84 +247,84 @@
|
|||||||
(assert-starts-with "No input file provided." stderr)))
|
(assert-starts-with "No input file provided." stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-dump restore-is-noop)
|
(define-scenario (cache-dump restore-is-noop)
|
||||||
"cache_dump followed by cache_restore is a noop."
|
"cache_dump followed by cache_restore is a noop."
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(receive (d1-stdout _) (cache-dump md)
|
(receive (d1-stdout _) (cache-dump md)
|
||||||
(with-temp-file-containing ((xml "cache.xml" d1-stdout))
|
(with-temp-file-containing ((xml "cache.xml" d1-stdout))
|
||||||
(cache-restore "-i" xml "-o" md)
|
(cache-restore "-i" xml "-o" md)
|
||||||
(receive (d2-stdout _) (cache-dump md)
|
(receive (d2-stdout _) (cache-dump md)
|
||||||
(assert-equal d1-stdout d2-stdout))))))
|
(assert-equal d1-stdout d2-stdout))))))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; cache_metadata_size scenarios
|
;;; cache_metadata_size scenarios
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size v)
|
(define-scenario (cache-metadata-size v)
|
||||||
"cache_metadata_size -V"
|
"cache_metadata_size -V"
|
||||||
(receive (stdout _) (cache-metadata-size "-V")
|
(receive (stdout _) (cache-metadata-size "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size version)
|
(define-scenario (cache-metadata-size version)
|
||||||
"cache_metadata_size --version"
|
"cache_metadata_size --version"
|
||||||
(receive (stdout _) (cache-metadata-size "--version")
|
(receive (stdout _) (cache-metadata-size "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size h)
|
(define-scenario (cache-metadata-size h)
|
||||||
"cache_metadata_size -h"
|
"cache_metadata_size -h"
|
||||||
(receive (stdout _) (cache-metadata-size "-h")
|
(receive (stdout _) (cache-metadata-size "-h")
|
||||||
(assert-equal cache-metadata-size-help stdout)))
|
(assert-equal cache-metadata-size-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size help)
|
(define-scenario (cache-metadata-size help)
|
||||||
"cache_metadata_size --help"
|
"cache_metadata_size --help"
|
||||||
(receive (stdout _) (cache-metadata-size "--help")
|
(receive (stdout _) (cache-metadata-size "--help")
|
||||||
(assert-equal cache-metadata-size-help stdout)))
|
(assert-equal cache-metadata-size-help stdout)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size no-args)
|
(define-scenario (cache-metadata-size no-args)
|
||||||
"No arguments specified causes fail"
|
"No arguments specified causes fail"
|
||||||
(receive (_ stderr) (run-fail "cache_metadata_size")
|
(receive (_ stderr) (run-fail "cache_metadata_size")
|
||||||
(assert-equal "Please specify either --device-size and --block-size, or --nr-blocks."
|
(assert-equal "Please specify either --device-size and --block-size, or --nr-blocks."
|
||||||
stderr)))
|
stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size device-size-only)
|
(define-scenario (cache-metadata-size device-size-only)
|
||||||
"Just --device-size causes fail"
|
"Just --device-size causes fail"
|
||||||
(receive (_ stderr) (run-fail "cache_metadata_size --device-size" (meg 100))
|
(receive (_ stderr) (run-fail "cache_metadata_size --device-size" (meg 100))
|
||||||
(assert-equal "If you specify --device-size you must also give --block-size."
|
(assert-equal "If you specify --device-size you must also give --block-size."
|
||||||
stderr)))
|
stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size block-size-only)
|
(define-scenario (cache-metadata-size block-size-only)
|
||||||
"Just --block-size causes fail"
|
"Just --block-size causes fail"
|
||||||
(receive (_ stderr) (run-fail "cache_metadata_size --block-size" 128)
|
(receive (_ stderr) (run-fail "cache_metadata_size --block-size" 128)
|
||||||
(assert-equal "If you specify --block-size you must also give --device-size."
|
(assert-equal "If you specify --block-size you must also give --device-size."
|
||||||
stderr)))
|
stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size conradictory-info-fails)
|
(define-scenario (cache-metadata-size conradictory-info-fails)
|
||||||
"Contradictory info causes fail"
|
"Contradictory info causes fail"
|
||||||
(receive (_ stderr) (run-fail "cache_metadata_size --device-size 102400 --block-size 1000 --nr-blocks 6")
|
(receive (_ stderr) (run-fail "cache_metadata_size --device-size 102400 --block-size 1000 --nr-blocks 6")
|
||||||
(assert-equal "Contradictory arguments given, --nr-blocks doesn't match the --device-size and --block-size."
|
(assert-equal "Contradictory arguments given, --nr-blocks doesn't match the --device-size and --block-size."
|
||||||
stderr)))
|
stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size all-args-agree)
|
(define-scenario (cache-metadata-size all-args-agree)
|
||||||
"All args agreeing succeeds"
|
"All args agreeing succeeds"
|
||||||
(receive (stdout stderr) (cache-metadata-size "--device-size" 102400 "--block-size" 100 "--nr-blocks" 1024)
|
(receive (stdout stderr) (cache-metadata-size "--device-size" 102400 "--block-size" 100 "--nr-blocks" 1024)
|
||||||
(assert-equal "8248 sectors" stdout)
|
(assert-equal "8248 sectors" stdout)
|
||||||
(assert-eof stderr)))
|
(assert-eof stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size nr-blocks-alone)
|
(define-scenario (cache-metadata-size nr-blocks-alone)
|
||||||
"Just --nr-blocks succeeds"
|
"Just --nr-blocks succeeds"
|
||||||
(receive (stdout stderr) (cache-metadata-size "--nr-blocks" 1024)
|
(receive (stdout stderr) (cache-metadata-size "--nr-blocks" 1024)
|
||||||
(assert-equal "8248 sectors" stdout)
|
(assert-equal "8248 sectors" stdout)
|
||||||
(assert-eof stderr)))
|
(assert-eof stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size dev-size-and-block-size-succeeds)
|
(define-scenario (cache-metadata-size dev-size-and-block-size-succeeds)
|
||||||
"Specifying --device-size with --block-size succeeds"
|
"Specifying --device-size with --block-size succeeds"
|
||||||
(receive (stdout stderr) (cache-metadata-size "--device-size" 102400 "--block-size" 100)
|
(receive (stdout stderr) (cache-metadata-size "--device-size" 102400 "--block-size" 100)
|
||||||
(assert-equal "8248 sectors" stdout)
|
(assert-equal "8248 sectors" stdout)
|
||||||
(assert-eof stderr)))
|
(assert-eof stderr)))
|
||||||
|
|
||||||
(define-scenario (cache-metadata-size big-config)
|
(define-scenario (cache-metadata-size big-config)
|
||||||
"A big configuration succeeds"
|
"A big configuration succeeds"
|
||||||
(receive (stdout stderr) (cache-metadata-size "--nr-blocks 67108864")
|
(receive (stdout stderr) (cache-metadata-size "--nr-blocks 67108864")
|
||||||
(assert-equal "3678208 sectors" stdout)
|
(assert-equal "3678208 sectors" stdout)
|
||||||
(assert-eof stderr)))
|
(assert-eof stderr)))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -47,145 +47,145 @@
|
|||||||
;;; era_check scenarios
|
;;; era_check scenarios
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
(define-scenario (era-check v)
|
(define-scenario (era-check v)
|
||||||
"era_check -V"
|
"era_check -V"
|
||||||
(receive (stdout _) (era-check "-V")
|
(receive (stdout _) (era-check "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (era-check version)
|
(define-scenario (era-check version)
|
||||||
"era_check --version"
|
"era_check --version"
|
||||||
(receive (stdout _) (era-check "--version")
|
(receive (stdout _) (era-check "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (era-check h)
|
(define-scenario (era-check h)
|
||||||
"era_check -h"
|
"era_check -h"
|
||||||
(receive (stdout _) (era-check "-h")
|
(receive (stdout _) (era-check "-h")
|
||||||
(assert-equal era-check-help stdout)))
|
(assert-equal era-check-help stdout)))
|
||||||
|
|
||||||
(define-scenario (era-check help)
|
(define-scenario (era-check help)
|
||||||
"era_check --help"
|
"era_check --help"
|
||||||
(receive (stdout _) (era-check "--help")
|
(receive (stdout _) (era-check "--help")
|
||||||
(assert-equal era-check-help stdout)))
|
(assert-equal era-check-help stdout)))
|
||||||
|
|
||||||
(define-scenario (era-check no-device-specified)
|
(define-scenario (era-check no-device-specified)
|
||||||
"Fail if no device specified"
|
"Fail if no device specified"
|
||||||
(receive (_ stderr) (run-fail "era_check")
|
(receive (_ stderr) (run-fail "era_check")
|
||||||
(assert-starts-with "No input file provided." stderr)))
|
(assert-starts-with "No input file provided." stderr)))
|
||||||
|
|
||||||
(define-scenario (era-check dev-not-exist)
|
(define-scenario (era-check dev-not-exist)
|
||||||
"Fail if specified device doesn't exist"
|
"Fail if specified device doesn't exist"
|
||||||
(receive (_ stderr) (run-fail "era_check /dev/unlikely")
|
(receive (_ stderr) (run-fail "era_check /dev/unlikely")
|
||||||
(assert-starts-with "/dev/unlikely: No such file or directory" stderr)))
|
(assert-starts-with "/dev/unlikely: No such file or directory" stderr)))
|
||||||
|
|
||||||
(define-scenario (era-check dev-is-a-directory)
|
(define-scenario (era-check dev-is-a-directory)
|
||||||
"Fail if given a directory instead of a file or device"
|
"Fail if given a directory instead of a file or device"
|
||||||
(receive (_ stderr) (run-fail "era_check /tmp")
|
(receive (_ stderr) (run-fail "era_check /tmp")
|
||||||
(assert-starts-with "/tmp: Not a block device or regular file" stderr)))
|
(assert-starts-with "/tmp: Not a block device or regular file" stderr)))
|
||||||
|
|
||||||
(define-scenario (era-check bad-permissions)
|
(define-scenario (era-check bad-permissions)
|
||||||
"Fail if given a device with inadequate access permissions"
|
"Fail if given a device with inadequate access permissions"
|
||||||
(with-temp-file-sized ((md "era.bin" (meg 4)))
|
(with-temp-file-sized ((md "era.bin" (meg 4)))
|
||||||
(run-ok "chmod -r" md)
|
(run-ok "chmod -r" md)
|
||||||
(receive (_ stderr) (run-fail "era_check" md)
|
(receive (_ stderr) (run-fail "era_check" md)
|
||||||
(assert-starts-with "syscall 'open' failed: Permission denied" stderr))))
|
(assert-starts-with "syscall 'open' failed: Permission denied" stderr))))
|
||||||
|
|
||||||
(define-scenario (era-check empty-dev)
|
(define-scenario (era-check empty-dev)
|
||||||
"Fail if given a file of zeroes"
|
"Fail if given a file of zeroes"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(run-fail "era_check" md)))
|
(run-fail "era_check" md)))
|
||||||
|
|
||||||
(define-scenario (era-check quiet)
|
(define-scenario (era-check quiet)
|
||||||
"Fail should give no output if --quiet"
|
"Fail should give no output if --quiet"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (stdout stderr) (run-fail "era_check --quiet" md)
|
(receive (stdout stderr) (run-fail "era_check --quiet" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr))))
|
(assert-eof stderr))))
|
||||||
|
|
||||||
(define-scenario (era-check q)
|
(define-scenario (era-check q)
|
||||||
"Fail should give no output if -q"
|
"Fail should give no output if -q"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (stdout stderr) (run-fail "era_check -q" md)
|
(receive (stdout stderr) (run-fail "era_check -q" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr))))
|
(assert-eof stderr))))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; era_restore scenarios
|
;;; era_restore scenarios
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
(define-scenario (era-restore v)
|
(define-scenario (era-restore v)
|
||||||
"era_restore -V"
|
"era_restore -V"
|
||||||
(receive (stdout _) (era-restore "-V")
|
(receive (stdout _) (era-restore "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (era-restore version)
|
(define-scenario (era-restore version)
|
||||||
"era_restore --version"
|
"era_restore --version"
|
||||||
(receive (stdout _) (era-restore "--version")
|
(receive (stdout _) (era-restore "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (era-restore h)
|
(define-scenario (era-restore h)
|
||||||
"era_restore -h"
|
"era_restore -h"
|
||||||
(receive (stdout _) (era-restore "-h")
|
(receive (stdout _) (era-restore "-h")
|
||||||
(assert-equal era-restore-help stdout)))
|
(assert-equal era-restore-help stdout)))
|
||||||
|
|
||||||
(define-scenario (era-restore help)
|
(define-scenario (era-restore help)
|
||||||
"era_restore --help"
|
"era_restore --help"
|
||||||
(receive (stdout _) (era-restore "--help")
|
(receive (stdout _) (era-restore "--help")
|
||||||
(assert-equal era-restore-help stdout)))
|
(assert-equal era-restore-help stdout)))
|
||||||
|
|
||||||
(define-scenario (era-restore input-unspecified)
|
(define-scenario (era-restore input-unspecified)
|
||||||
"Fails if no xml specified"
|
"Fails if no xml specified"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (_ stderr) (run-fail "era_restore" "-o" md)
|
(receive (_ stderr) (run-fail "era_restore" "-o" md)
|
||||||
(assert-starts-with "No input file provided." stderr))))
|
(assert-starts-with "No input file provided." stderr))))
|
||||||
|
|
||||||
(define-scenario (era-restore output-unspecified)
|
(define-scenario (era-restore output-unspecified)
|
||||||
"Fails if no metadata dev specified"
|
"Fails if no metadata dev specified"
|
||||||
(with-era-xml (xml)
|
(with-era-xml (xml)
|
||||||
(receive (_ stderr) (run-fail "era_restore" "-i" xml)
|
(receive (_ stderr) (run-fail "era_restore" "-i" xml)
|
||||||
(assert-starts-with "No output file provided." stderr))))
|
(assert-starts-with "No output file provided." stderr))))
|
||||||
|
|
||||||
(define-scenario (era-restore success)
|
(define-scenario (era-restore success)
|
||||||
"Succeeds with xml and metadata"
|
"Succeeds with xml and metadata"
|
||||||
(with-era-xml (xml)
|
(with-era-xml (xml)
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(era-restore "-i" xml "-o" md))))
|
(era-restore "-i" xml "-o" md))))
|
||||||
|
|
||||||
(define-scenario (era-restore quiet)
|
(define-scenario (era-restore quiet)
|
||||||
"No output with --quiet (succeeding)"
|
"No output with --quiet (succeeding)"
|
||||||
(with-era-xml (xml)
|
(with-era-xml (xml)
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (stdout stderr) (era-restore "--quiet" "-i" xml "-o" md)
|
(receive (stdout stderr) (era-restore "--quiet" "-i" xml "-o" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr)))))
|
(assert-eof stderr)))))
|
||||||
|
|
||||||
(define-scenario (era-restore q)
|
(define-scenario (era-restore q)
|
||||||
"No output with -q (succeeding)"
|
"No output with -q (succeeding)"
|
||||||
(with-era-xml (xml)
|
(with-era-xml (xml)
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (stdout stderr) (era-restore "-q" "-i" xml "-o" md)
|
(receive (stdout stderr) (era-restore "-q" "-i" xml "-o" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr)))))
|
(assert-eof stderr)))))
|
||||||
|
|
||||||
(define-scenario (era-restore quiet-fail)
|
(define-scenario (era-restore quiet-fail)
|
||||||
"No output with --quiet (failing)"
|
"No output with --quiet (failing)"
|
||||||
(with-temp-file ((bad-xml "era.xml"))
|
(with-temp-file ((bad-xml "era.xml"))
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (stdout stderr) (run-fail "era_restore" "--quiet" "-i" bad-xml "-o" md)
|
(receive (stdout stderr) (run-fail "era_restore" "--quiet" "-i" bad-xml "-o" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr)))))
|
(assert-eof stderr)))))
|
||||||
|
|
||||||
(define-scenario (era-restore q-fail)
|
(define-scenario (era-restore q-fail)
|
||||||
"No output with --q(failing)"
|
"No output with --q(failing)"
|
||||||
(with-temp-file ((bad-xml "era.xml"))
|
(with-temp-file ((bad-xml "era.xml"))
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (stdout stderr) (run-fail "era_restore" "-q" "-i" bad-xml "-o" md)
|
(receive (stdout stderr) (run-fail "era_restore" "-q" "-i" bad-xml "-o" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr)))))
|
(assert-eof stderr)))))
|
||||||
|
|
||||||
(define-scenario (era-dump restore-is-noop)
|
(define-scenario (era-dump restore-is-noop)
|
||||||
"era_dump followed by era_restore is a noop."
|
"era_dump followed by era_restore is a noop."
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(receive (d1-stdout _) (era-dump md)
|
(receive (d1-stdout _) (era-dump md)
|
||||||
(with-temp-file-containing ((xml "era.xml" d1-stdout))
|
(with-temp-file-containing ((xml "era.xml" d1-stdout))
|
||||||
(era-restore "-i" xml "-o" md)
|
(era-restore "-i" xml "-o" md)
|
||||||
(receive (d2-stdout _) (era-dump md)
|
(receive (d2-stdout _) (era-dump md)
|
||||||
(assert-equal d1-stdout d2-stdout))))))
|
(assert-equal d1-stdout d2-stdout))))))
|
||||||
)
|
)
|
||||||
|
@ -57,218 +57,218 @@
|
|||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
|
|
||||||
(define-scenario (thin-check v)
|
(define-scenario (thin-check v)
|
||||||
"thin_check -V"
|
"thin_check -V"
|
||||||
(receive (stdout _) (thin-check "-V")
|
(receive (stdout _) (thin-check "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-check version)
|
(define-scenario (thin-check version)
|
||||||
"thin_check --version"
|
"thin_check --version"
|
||||||
(receive (stdout _) (thin-check "--version")
|
(receive (stdout _) (thin-check "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-check h)
|
(define-scenario (thin-check h)
|
||||||
"print help (-h)"
|
"print help (-h)"
|
||||||
(receive (stdout _) (thin-check "-h")
|
(receive (stdout _) (thin-check "-h")
|
||||||
(assert-equal thin-check-help stdout)))
|
(assert-equal thin-check-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-check help)
|
(define-scenario (thin-check help)
|
||||||
"print help (--help)"
|
"print help (--help)"
|
||||||
(receive (stdout _) (thin-check "--help")
|
(receive (stdout _) (thin-check "--help")
|
||||||
(assert-equal thin-check-help stdout)))
|
(assert-equal thin-check-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-check bad-option)
|
(define-scenario (thin-check bad-option)
|
||||||
"Unrecognised option should cause failure"
|
"Unrecognised option should cause failure"
|
||||||
(run-fail "thin_check --hedgehogs-only"))
|
(run-fail "thin_check --hedgehogs-only"))
|
||||||
|
|
||||||
(define-scenario (thin-check superblock-only-valid)
|
(define-scenario (thin-check superblock-only-valid)
|
||||||
"--super-block-only check passes on valid metadata"
|
"--super-block-only check passes on valid metadata"
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(thin-check "--super-block-only" md)))
|
(thin-check "--super-block-only" md)))
|
||||||
|
|
||||||
(define-scenario (thin-check superblock-only-invalid)
|
(define-scenario (thin-check superblock-only-invalid)
|
||||||
"--super-block-only check fails with corrupt metadata"
|
"--super-block-only check fails with corrupt metadata"
|
||||||
(with-corrupt-metadata (md)
|
(with-corrupt-metadata (md)
|
||||||
(run-fail "thin_check --super-block-only" md)))
|
(run-fail "thin_check --super-block-only" md)))
|
||||||
|
|
||||||
(define-scenario (thin-check skip-mappings-valid)
|
(define-scenario (thin-check skip-mappings-valid)
|
||||||
"--skip-mappings check passes on valid metadata"
|
"--skip-mappings check passes on valid metadata"
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(thin-check "--skip-mappings" md)))
|
(thin-check "--skip-mappings" md)))
|
||||||
|
|
||||||
(define-scenario (thin-check ignore-non-fatal-errors)
|
(define-scenario (thin-check ignore-non-fatal-errors)
|
||||||
"--ignore-non-fatal-errors check passes on valid metadata"
|
"--ignore-non-fatal-errors check passes on valid metadata"
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(thin-check "--ignore-non-fatal-errors" md)))
|
(thin-check "--ignore-non-fatal-errors" md)))
|
||||||
|
|
||||||
(define-scenario (thin-check quiet)
|
(define-scenario (thin-check quiet)
|
||||||
"--quiet should give no output"
|
"--quiet should give no output"
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(receive (stdout stderr) (thin-check "--quiet" md)
|
(receive (stdout stderr) (thin-check "--quiet" md)
|
||||||
(assert-eof stdout)
|
(assert-eof stdout)
|
||||||
(assert-eof stderr))))
|
(assert-eof stderr))))
|
||||||
|
|
||||||
(define-scenario (thin-check clear-needs-check-flag)
|
(define-scenario (thin-check clear-needs-check-flag)
|
||||||
"Accepts --clear-needs-check-flag"
|
"Accepts --clear-needs-check-flag"
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(thin-check "--clear-needs-check-flag" md)))
|
(thin-check "--clear-needs-check-flag" md)))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; thin_restore scenarios
|
;;; thin_restore scenarios
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
|
|
||||||
(define-scenario (thin-restore print-version-v)
|
(define-scenario (thin-restore print-version-v)
|
||||||
"print help (-V)"
|
"print help (-V)"
|
||||||
(receive (stdout _) (thin-restore "-V")
|
(receive (stdout _) (thin-restore "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-restore print-version-long)
|
(define-scenario (thin-restore print-version-long)
|
||||||
"print help (--version)"
|
"print help (--version)"
|
||||||
(receive (stdout _) (thin-restore "--version")
|
(receive (stdout _) (thin-restore "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-restore h)
|
(define-scenario (thin-restore h)
|
||||||
"print help (-h)"
|
"print help (-h)"
|
||||||
(receive (stdout _) (thin-restore "-h")
|
(receive (stdout _) (thin-restore "-h")
|
||||||
(assert-equal thin-restore-help stdout)))
|
(assert-equal thin-restore-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-restore help)
|
(define-scenario (thin-restore help)
|
||||||
"print help (-h)"
|
"print help (-h)"
|
||||||
(receive (stdout _) (thin-restore "--help")
|
(receive (stdout _) (thin-restore "--help")
|
||||||
(assert-equal thin-restore-help stdout)))
|
(assert-equal thin-restore-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-restore no-input-file)
|
(define-scenario (thin-restore no-input-file)
|
||||||
"forget to specify an input file"
|
"forget to specify an input file"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (_ stderr) (run-fail "thin_restore" "-o" md)
|
(receive (_ stderr) (run-fail "thin_restore" "-o" md)
|
||||||
(assert-starts-with "No input file provided." stderr))))
|
(assert-starts-with "No input file provided." stderr))))
|
||||||
|
|
||||||
(define-scenario (thin-restore missing-input-file)
|
(define-scenario (thin-restore missing-input-file)
|
||||||
"the input file can't be found"
|
"the input file can't be found"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(receive (_ stderr) (run-fail "thin_restore -i no-such-file -o" md)
|
(receive (_ stderr) (run-fail "thin_restore -i no-such-file -o" md)
|
||||||
(assert-starts-with "Couldn't stat file" stderr))))
|
(assert-starts-with "Couldn't stat file" stderr))))
|
||||||
|
|
||||||
(define-scenario (thin-restore missing-output-file)
|
(define-scenario (thin-restore missing-output-file)
|
||||||
"the output file can't be found"
|
"the output file can't be found"
|
||||||
(with-thin-xml (xml)
|
(with-thin-xml (xml)
|
||||||
(receive (_ stderr) (run-fail "thin_restore -i " xml)
|
(receive (_ stderr) (run-fail "thin_restore -i " xml)
|
||||||
(assert-starts-with "No output file provided." stderr))))
|
(assert-starts-with "No output file provided." stderr))))
|
||||||
|
|
||||||
(define-scenario (thin-restore tiny-output-file)
|
(define-scenario (thin-restore tiny-output-file)
|
||||||
"Fails if the output file is too small."
|
"Fails if the output file is too small."
|
||||||
(with-temp-file-sized ((md "thin.bin" 4096))
|
(with-temp-file-sized ((md "thin.bin" 4096))
|
||||||
(with-thin-xml (xml)
|
(with-thin-xml (xml)
|
||||||
(receive (_ stderr) (run-fail "thin_restore" "-i" xml "-o" md)
|
(receive (_ stderr) (run-fail "thin_restore" "-i" xml "-o" md)
|
||||||
(assert-starts-with thin-restore-outfile-too-small-text stderr)))))
|
(assert-starts-with thin-restore-outfile-too-small-text stderr)))))
|
||||||
|
|
||||||
(define-scenario (thin-restore q)
|
(define-scenario (thin-restore q)
|
||||||
"thin_restore accepts -q"
|
"thin_restore accepts -q"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-thin-xml (xml)
|
(with-thin-xml (xml)
|
||||||
(receive (stdout _) (thin-restore "-i" xml "-o" md "-q")
|
(receive (stdout _) (thin-restore "-i" xml "-o" md "-q")
|
||||||
(assert-eof stdout)))))
|
(assert-eof stdout)))))
|
||||||
|
|
||||||
(define-scenario (thin-restore quiet)
|
(define-scenario (thin-restore quiet)
|
||||||
"thin_restore accepts --quiet"
|
"thin_restore accepts --quiet"
|
||||||
(with-empty-metadata (md)
|
(with-empty-metadata (md)
|
||||||
(with-thin-xml (xml)
|
(with-thin-xml (xml)
|
||||||
(receive (stdout _) (thin-restore "-i" xml "-o" md "--quiet")
|
(receive (stdout _) (thin-restore "-i" xml "-o" md "--quiet")
|
||||||
(assert-eof stdout)))))
|
(assert-eof stdout)))))
|
||||||
|
|
||||||
(define-scenario (thin-dump restore-is-noop)
|
(define-scenario (thin-dump restore-is-noop)
|
||||||
"thin_dump followed by thin_restore is a noop."
|
"thin_dump followed by thin_restore is a noop."
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(receive (d1-stdout _) (thin-dump md)
|
(receive (d1-stdout _) (thin-dump md)
|
||||||
(with-temp-file-containing ((xml "thin.xml" d1-stdout))
|
(with-temp-file-containing ((xml "thin.xml" d1-stdout))
|
||||||
(thin-restore "-i" xml "-o" md)
|
(thin-restore "-i" xml "-o" md)
|
||||||
(receive (d2-stdout _) (thin-dump md)
|
(receive (d2-stdout _) (thin-dump md)
|
||||||
(assert-equal d1-stdout d2-stdout))))))
|
(assert-equal d1-stdout d2-stdout))))))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; thin_rmap scenarios
|
;;; thin_rmap scenarios
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
|
|
||||||
(define-scenario (thin-rmap v)
|
(define-scenario (thin-rmap v)
|
||||||
"thin_rmap accepts -V"
|
"thin_rmap accepts -V"
|
||||||
(receive (stdout _) (thin-rmap "-V")
|
(receive (stdout _) (thin-rmap "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-rmap version)
|
(define-scenario (thin-rmap version)
|
||||||
"thin_rmap accepts --version"
|
"thin_rmap accepts --version"
|
||||||
(receive (stdout _) (thin-rmap "--version")
|
(receive (stdout _) (thin-rmap "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-rmap h)
|
(define-scenario (thin-rmap h)
|
||||||
"thin_rmap accepts -h"
|
"thin_rmap accepts -h"
|
||||||
(receive (stdout _) (thin-rmap "-h")
|
(receive (stdout _) (thin-rmap "-h")
|
||||||
(assert-equal thin-rmap-help stdout)))
|
(assert-equal thin-rmap-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-rmap help)
|
(define-scenario (thin-rmap help)
|
||||||
"thin_rmap accepts --help"
|
"thin_rmap accepts --help"
|
||||||
(receive (stdout _) (thin-rmap "--help")
|
(receive (stdout _) (thin-rmap "--help")
|
||||||
(assert-equal thin-rmap-help stdout)))
|
(assert-equal thin-rmap-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-rmap unrecognised-flag)
|
(define-scenario (thin-rmap unrecognised-flag)
|
||||||
"thin_rmap complains with bad flags."
|
"thin_rmap complains with bad flags."
|
||||||
(run-fail "thin_rmap --unleash-the-hedgehogs"))
|
(run-fail "thin_rmap --unleash-the-hedgehogs"))
|
||||||
|
|
||||||
(define-scenario (thin-rmap valid-region-format-should-pass)
|
(define-scenario (thin-rmap valid-region-format-should-pass)
|
||||||
"thin_rmap with a valid region format should pass."
|
"thin_rmap with a valid region format should pass."
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(thin-rmap "--region 23..7890" md)))
|
(thin-rmap "--region 23..7890" md)))
|
||||||
|
|
||||||
(define-scenario (thin-rmap invalid-region-should-fail)
|
(define-scenario (thin-rmap invalid-region-should-fail)
|
||||||
"thin_rmap with an invalid region format should fail."
|
"thin_rmap with an invalid region format should fail."
|
||||||
(for-each (lambda (pattern)
|
(for-each (lambda (pattern)
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(run-fail "thin_rmap --region" pattern md)))
|
(run-fail "thin_rmap --region" pattern md)))
|
||||||
'("23,7890" "23..six" "found..7890" "89..88" "89..89" "89.." "" "89...99")))
|
'("23,7890" "23..six" "found..7890" "89..88" "89..89" "89.." "" "89...99")))
|
||||||
|
|
||||||
(define-scenario (thin-rmap multiple-regions-should-pass)
|
(define-scenario (thin-rmap multiple-regions-should-pass)
|
||||||
"thin_rmap should handle multiple regions."
|
"thin_rmap should handle multiple regions."
|
||||||
(with-valid-metadata (md)
|
(with-valid-metadata (md)
|
||||||
(thin-rmap "--region 1..23 --region 45..78" md)))
|
(thin-rmap "--region 1..23 --region 45..78" md)))
|
||||||
|
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
;;; thin_delta scenarios
|
;;; thin_delta scenarios
|
||||||
;;;-----------------------------------------------------------
|
;;;-----------------------------------------------------------
|
||||||
(define-scenario (thin-delta v)
|
(define-scenario (thin-delta v)
|
||||||
"thin_delta accepts -V"
|
"thin_delta accepts -V"
|
||||||
(receive (stdout _) (thin-delta "-V")
|
(receive (stdout _) (thin-delta "-V")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-delta version)
|
(define-scenario (thin-delta version)
|
||||||
"thin_delta accepts --version"
|
"thin_delta accepts --version"
|
||||||
(receive (stdout _) (thin-delta "--version")
|
(receive (stdout _) (thin-delta "--version")
|
||||||
(assert-equal tools-version stdout)))
|
(assert-equal tools-version stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-delta h)
|
(define-scenario (thin-delta h)
|
||||||
"thin_delta accepts -h"
|
"thin_delta accepts -h"
|
||||||
(receive (stdout _) (thin-delta "-h")
|
(receive (stdout _) (thin-delta "-h")
|
||||||
(assert-equal thin-delta-help stdout)))
|
(assert-equal thin-delta-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-delta help)
|
(define-scenario (thin-delta help)
|
||||||
"thin_delta accepts --help"
|
"thin_delta accepts --help"
|
||||||
(receive (stdout _) (thin-delta "--help")
|
(receive (stdout _) (thin-delta "--help")
|
||||||
(assert-equal thin-delta-help stdout)))
|
(assert-equal thin-delta-help stdout)))
|
||||||
|
|
||||||
(define-scenario (thin-delta unrecognised-option)
|
(define-scenario (thin-delta unrecognised-option)
|
||||||
"Unrecognised option should cause failure"
|
"Unrecognised option should cause failure"
|
||||||
(run-fail "thin_delta --unleash-the-hedgehogs"))
|
(run-fail "thin_delta --unleash-the-hedgehogs"))
|
||||||
|
|
||||||
(define-scenario (thin-delta snap1-unspecified)
|
(define-scenario (thin-delta snap1-unspecified)
|
||||||
"Fails without --snap1 fails"
|
"Fails without --snap1 fails"
|
||||||
(receive (_ stderr) (run-fail "thin_delta --snap2 45 foo")
|
(receive (_ stderr) (run-fail "thin_delta --snap2 45 foo")
|
||||||
(assert-starts-with "--snap1 not specified." stderr)))
|
(assert-starts-with "--snap1 not specified." stderr)))
|
||||||
|
|
||||||
(define-scenario (thin-delta snap2-unspecified)
|
(define-scenario (thin-delta snap2-unspecified)
|
||||||
"Fails without --snap2 fails"
|
"Fails without --snap2 fails"
|
||||||
(receive (_ stderr) (run-fail "thin_delta --snap1 45 foo")
|
(receive (_ stderr) (run-fail "thin_delta --snap1 45 foo")
|
||||||
(assert-starts-with "--snap2 not specified." stderr)))
|
(assert-starts-with "--snap2 not specified." stderr)))
|
||||||
|
|
||||||
(define-scenario (thin-delta device-unspecified)
|
(define-scenario (thin-delta device-unspecified)
|
||||||
"Fails if no device given"
|
"Fails if no device given"
|
||||||
(receive (_ stderr) (run-fail "thin_delta --snap1 45 --snap2 46")
|
(receive (_ stderr) (run-fail "thin_delta --snap1 45 --snap2 46")
|
||||||
(assert-starts-with "No input device provided." stderr)))
|
(assert-starts-with "No input device provided." stderr)))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user