[functional-tests] Move thin_check functional tests to Rust.
They'll be run as part of 'cargo test' now.
This commit is contained in:
@ -67,86 +67,6 @@
|
||||
;; to run.
|
||||
(define (register-thin-tests) #t)
|
||||
|
||||
;;;-----------------------------------------------------------
|
||||
;;; thin_check scenarios
|
||||
;;;-----------------------------------------------------------
|
||||
|
||||
(define-scenario (thin-check v)
|
||||
"thin_check -V"
|
||||
(run-ok-rcv (stdout _) (thin-check "-V")
|
||||
(assert-equal tools-version stdout)))
|
||||
|
||||
(define-scenario (thin-check version)
|
||||
"thin_check --version"
|
||||
(run-ok-rcv (stdout _) (thin-check "--version")
|
||||
(assert-equal tools-version stdout)))
|
||||
|
||||
(define-scenario (thin-check h)
|
||||
"print help (-h)"
|
||||
(run-ok-rcv (stdout _) (thin-check "-h")
|
||||
(assert-equal thin-check-help stdout)))
|
||||
|
||||
(define-scenario (thin-check help)
|
||||
"print help (--help)"
|
||||
(run-ok-rcv (stdout _) (thin-check "--help")
|
||||
(assert-equal thin-check-help stdout)))
|
||||
|
||||
(define-scenario (thin-check bad-option)
|
||||
"Unrecognised option should cause failure"
|
||||
(run-fail (thin-check "--hedgehogs-only")))
|
||||
|
||||
(define-scenario (thin-check superblock-only-valid)
|
||||
"--super-block-only check passes on valid metadata"
|
||||
(with-valid-metadata (md)
|
||||
(run-ok (thin-check "--super-block-only" md))))
|
||||
|
||||
(define-scenario (thin-check superblock-only-invalid)
|
||||
"--super-block-only check fails with corrupt metadata"
|
||||
(with-corrupt-metadata (md)
|
||||
(run-fail (thin-check "--super-block-only" md))))
|
||||
|
||||
(define-scenario (thin-check skip-mappings-valid)
|
||||
"--skip-mappings check passes on valid metadata"
|
||||
(with-valid-metadata (md)
|
||||
(run-ok (thin-check "--skip-mappings" md))))
|
||||
|
||||
(define-scenario (thin-check ignore-non-fatal-errors)
|
||||
"--ignore-non-fatal-errors check passes on valid metadata"
|
||||
(with-valid-metadata (md)
|
||||
(run-ok (thin-check "--ignore-non-fatal-errors" md))))
|
||||
|
||||
(define-scenario (thin-check quiet)
|
||||
"--quiet should give no output"
|
||||
(with-valid-metadata (md)
|
||||
(run-ok-rcv (stdout stderr) (thin-check "--quiet" md)
|
||||
(assert-eof stdout)
|
||||
(assert-eof stderr))))
|
||||
|
||||
(define-scenario (thin-check clear-needs-check-flag)
|
||||
"Accepts --clear-needs-check-flag"
|
||||
(with-valid-metadata (md)
|
||||
(run-ok (thin-check "--clear-needs-check-flag" md))))
|
||||
|
||||
(define-scenario (thin-check tiny-metadata)
|
||||
"Prints helpful message in case tiny metadata given"
|
||||
(with-temp-file-sized ((md "thin.bin" 1024))
|
||||
(run-fail-rcv (_ stderr) (thin-check md)
|
||||
(assert-starts-with "Metadata device/file too small. Is this binary metadata?" stderr))))
|
||||
|
||||
(define-scenario (thin-check spot-accidental-xml-data)
|
||||
"Prints helpful message if XML metadata given"
|
||||
(with-thin-xml (xml)
|
||||
(system (fmt #f "man bash >> " xml))
|
||||
(run-fail-rcv (_ stderr) (thin-check xml)
|
||||
(assert-matches ".*This looks like XML. thin_check only checks the binary metadata format." stderr))))
|
||||
|
||||
(define-scenario (thin-check info-fields)
|
||||
"Outputs info fields"
|
||||
(with-valid-metadata (md)
|
||||
(run-ok-rcv (stdout stderr) (thin-check md)
|
||||
(assert-matches ".*TRANSACTION_ID=[0-9]+.*" stdout)
|
||||
(assert-matches ".*METADATA_FREE_BLOCKS=[0-9]+.*" stdout))))
|
||||
|
||||
;;;-----------------------------------------------------------
|
||||
;;; thin_restore scenarios
|
||||
;;;-----------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user