summaryrefslogtreecommitdiff
path: root/testing/gitano-test-tool.in
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-05-17 10:18:17 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-05-17 10:18:17 +0100
commit5f1429e7747cb62ecdd30297d489fba52a1cdfa0 (patch)
treebdd6fe67270b75ff84b584af2f98d9769d6f9813 /testing/gitano-test-tool.in
parenta5f2e7debbbf35ceeeca33bc35db0596c8ed814f (diff)
downloadgitano-5f1429e7747cb62ecdd30297d489fba52a1cdfa0.tar.gz
Add support for cached ssh keys for testing. Shaves 20% off test runtime
Diffstat (limited to 'testing/gitano-test-tool.in')
-rw-r--r--testing/gitano-test-tool.in28
1 files changed, 22 insertions, 6 deletions
diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in
index 1a04b31..e892474 100644
--- a/testing/gitano-test-tool.in
+++ b/testing/gitano-test-tool.in
@@ -109,12 +109,28 @@ end
function cmd_createsshkey(username, keyname, optionaltype)
optionaltype = optionaltype or "rsa"
- run_program {
- "ssh-keygen", "-q",
- "-t", optionaltype,
- "-C", username .. "-" .. optionaltype .. "@" .. keyname,
- "-f", ssh_key_file(username, keyname),
- "-N", "" }
+ local targetkey = ssh_key_file(username, keyname)
+ local sourcekey = table.concat {
+ "testing/keys/", username, "@", keyname, "_", optionaltype }
+ local fh = io.open(sourcekey, "r")
+ if not fh then
+ run_program {
+ "ssh-keygen", "-q",
+ "-t", optionaltype,
+ "-C", username .. "-" .. optionaltype .. "@" .. keyname,
+ "-f", sourcekey,
+ "-N", "" }
+ fh = assert(io.open(sourcekey, "r"))
+ end
+ local ofh = assert(io.open(targetkey, "w"))
+ ofh:write(fh:read("*a"))
+ fh:close()
+ ofh:close()
+ fh = assert(io.open(sourcekey .. ".pub", "r"))
+ ofh = assert(io.open(targetkey .. ".pub", "w"))
+ ofh:write(fh:read("*a"))
+ fh:close()
+ ofh:close()
end
function cmd_setupstandard(owning_user, master_key)