diff --git a/functional-tests/cache-functional-tests.scm b/functional-tests/cache-functional-tests.scm
index b8e2f41..42d3713 100644
--- a/functional-tests/cache-functional-tests.scm
+++ b/functional-tests/cache-functional-tests.scm
@@ -49,102 +49,6 @@
;; to run.
(define (register-cache-tests) #t)
- ;;;-----------------------------------------------------------
- ;;; cache_restore scenarios
- ;;;-----------------------------------------------------------
-
- (define-scenario (cache-restore v)
- "print version (-V flag)"
- (run-ok-rcv (stdout _) (cache-restore "-V")
- (assert-equal tools-version stdout)))
-
- (define-scenario (cache-restore version)
- "print version (--version flags)"
- (run-ok-rcv (stdout _) (cache-restore "--version")
- (assert-equal tools-version stdout)))
-
- (define-scenario (cache-restore h)
- "cache_restore -h"
- (run-ok-rcv (stdout _) (cache-restore "-h")
- (assert-equal cache-restore-help stdout)))
-
- (define-scenario (cache-restore help)
- "cache_restore --help"
- (run-ok-rcv (stdout _) (cache-restore "--help")
- (assert-equal cache-restore-help stdout)))
-
- (define-scenario (cache-restore no-input-file)
- "forget to specify an input file"
- (with-empty-metadata (md)
- (run-fail-rcv (_ stderr) (cache-restore "-o" md)
- (assert-starts-with "No input file provided." stderr))))
-
- (define-scenario (cache-restore missing-input-file)
- "the input file can't be found"
- (with-empty-metadata (md)
- (let ((bad-path "no-such-file"))
- (run-fail-rcv (_ stderr) (cache-restore "-i" bad-path "-o" md)
- (assert-superblock-all-zeroes md)
- (assert-starts-with
- (string-append bad-path ": No such file or directory")
- stderr)))))
-
- (define-scenario (cache-restore garbage-input-file)
- "the input file is just zeroes"
- (with-empty-metadata (md)
- (with-temp-file-sized ((xml "cache.xml" 4096))
- (run-fail-rcv (_ stderr) (cache-restore "-i" xml "-o" md)
- (assert-superblock-all-zeroes md)))))
-
- (define-scenario (cache-restore missing-output-file)
- "the output file can't be found"
- (with-cache-xml (xml)
- (run-fail-rcv (_ stderr) (cache-restore "-i" xml)
- (assert-starts-with "No output file provided." stderr))))
-
- (define-scenario (cache-restore tiny-output-file)
- "Fails if the output file is too small."
- (with-temp-file-sized ((md "cache.bin" (* 1024 4)))
- (with-cache-xml (xml)
- (run-fail-rcv (_ stderr) (cache-restore "-i" xml "-o" md)
- (assert-starts-with cache-restore-outfile-too-small-text stderr)))))
-
- (define-scenario (cache-restore successfully-restores)
- "Restore succeeds."
- (with-empty-metadata (md)
- (with-cache-xml (xml)
- (run-ok (cache-restore "-i" xml "-o" md)))))
-
- (define-scenario (cache-restore q)
- "cache_restore accepts -q"
- (with-empty-metadata (md)
- (with-cache-xml (xml)
- (run-ok-rcv (stdout stderr) (cache-restore "-i" xml "-o" md "-q")
- (assert-eof stdout)
- (assert-eof stderr)))))
-
- (define-scenario (cache-restore quiet)
- "cache_restore accepts --quiet"
- (with-empty-metadata (md)
- (with-cache-xml (xml)
- (run-ok-rcv (stdout stderr) (cache-restore "-i" xml "-o" md "--quiet")
- (assert-eof stdout)
- (assert-eof stderr)))))
-
- (define-scenario (cache-restore override-metadata-version)
- "we can set any metadata version"
- (with-empty-metadata (md)
- (with-cache-xml (xml)
- (run-ok
- (cache-restore "-i" xml "-o" md "--debug-override-metadata-version 10298")))))
-
- (define-scenario (cache-restore omit-clean-shutdown)
- "accepts --omit-clean-shutdown"
- (with-empty-metadata (md)
- (with-cache-xml (xml)
- (run-ok
- (cache-restore "-i" xml "-o" md "--omit-clean-shutdown")))))
-
;;;-----------------------------------------------------------
;;; cache_dump scenarios
;;;-----------------------------------------------------------
diff --git a/tests/cache_restore.rs b/tests/cache_restore.rs
new file mode 100644
index 0000000..41c133a
--- /dev/null
+++ b/tests/cache_restore.rs
@@ -0,0 +1,167 @@
+use anyhow::Result;
+
+mod common;
+
+use common::cache::*;
+use common::common_args::*;
+use common::fixture::*;
+use common::input_arg::*;
+use common::output_option::*;
+use common::process::*;
+use common::program::*;
+use common::target::*;
+use common::test_dir::*;
+
+//------------------------------------------
+
+const USAGE: &str = "Usage: cache_restore [options]\n\
+ Options:\n \
+ {-h|--help}\n \
+ {-i|--input} \n \
+ {-o|--output}