[functional-tests] fix up some tests.

This commit is contained in:
Joe Thornber 2017-09-20 17:13:03 +01:00
parent 5814fea96a
commit 7079b1ec9e
3 changed files with 13 additions and 10 deletions

View File

@ -170,7 +170,7 @@
(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-starts-with "Couldn't stat file" stderr)))))
(define-scenario (era-restore q-fail) (define-scenario (era-restore q-fail)
"No output with --q(failing)" "No output with --q(failing)"
@ -178,7 +178,7 @@
(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-starts-with "Couldn't stat file" 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."

View File

@ -49,16 +49,18 @@
(if (pred exit-code) (if (pred exit-code)
(values stdout stderr) (values stdout stderr)
(begin (begin
(info (fmt #f (dsp "stdout: ") stdout)) (let ((msg (fmt #f "unexpected exit code (" exit-code ")")))
(info (fmt #f (dsp "stderr: ") stderr)) (info msg)
(fail (fmt #f (dsp "unexpected exit code (") (fail msg))))))
(num exit-code)
(dsp ")")))))))
(define (run-ok . cmd-and-args) (define (run-ok . cmd-and-args)
(run-with-exit-code zero? cmd-and-args)) (run-with-exit-code zero? cmd-and-args))
;; Exit code 139 is a segfault, which is not acceptable
(define (run-fail . cmd-and-args) (define (run-fail . cmd-and-args)
(define (not-zero? x) (not (zero? x))) (define (fails? x) (not
(or (= 139 x)
(zero? x))))
(run-with-exit-code fails? cmd-and-args)))
(run-with-exit-code not-zero? cmd-and-args)))

View File

@ -109,13 +109,14 @@ Options:
{--repair}") {--repair}")
(define cache-metadata-size-help (define cache-metadata-size-help
"Usage: cache_metadata_size [options] "Usage: cache_metadata_size [options]
Options: Options:
{-h|--help} {-h|--help}
{-V|--version} {-V|--version}
{--block-size <sectors>} {--block-size <sectors>}
{--device-size <sectors>} {--device-size <sectors>}
{--nr-blocks <natural>} {--nr-blocks <natural>}
{--max-hint-width <nr bytes>}
These all relate to the size of the fast device (eg, SSD), rather These all relate to the size of the fast device (eg, SSD), rather
than the whole cached device.") than the whole cached device.")