summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-24 15:41:37 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-24 15:41:37 +0100
commit80d29f3c8644c42d0006b66fd63036ad2c0eb439 (patch)
tree552115afc1a6a87926fbfd74d498038cf817e4dd
parenta8a43e3a11c65ef8032aad0e7420ef4318df78ae (diff)
downloadgitano-80d29f3c8644c42d0006b66fd63036ad2c0eb439.tar.gz
Add support for GPG and stdin for running things
-rw-r--r--testing/gitano-test-tool.in7
-rw-r--r--testing/keys/gnupg/pubring.gpgbin0 -> 722 bytes
-rw-r--r--testing/keys/gnupg/random_seedbin0 -> 600 bytes
-rw-r--r--testing/keys/gnupg/secring.gpgbin0 -> 1386 bytes
-rw-r--r--testing/keys/gnupg/trustdb.gpgbin0 -> 1280 bytes
-rw-r--r--testing/library.yarn12
6 files changed, 18 insertions, 1 deletions
diff --git a/testing/gitano-test-tool.in b/testing/gitano-test-tool.in
index fc422c6..a3f44c4 100644
--- a/testing/gitano-test-tool.in
+++ b/testing/gitano-test-tool.in
@@ -21,6 +21,7 @@ local sp = require "luxio.subprocess"
local argv = {...}
local basedir = (luxio.getenv "DATADIR") .. "/"
+local gnupghome = "testing/keys/gnupg"
local function user_home(username)
return basedir .. "user-home-" .. username
@@ -214,6 +215,12 @@ function cmd_serverlocation(repo)
print(table.concat({h, "repos", repo}, "/"))
end
+function cmd_gpg(...)
+ run_program{"chmod", "0700", gnupghome}
+ local args = {"gpg", "--homedir", gnupghome, ...}
+ run_program(args)
+end
+
local cmd = table.remove(argv, 1)
if _G['cmd_' .. cmd] then
_G['cmd_' .. cmd](unpack(argv))
diff --git a/testing/keys/gnupg/pubring.gpg b/testing/keys/gnupg/pubring.gpg
new file mode 100644
index 0000000..bc8deb4
--- /dev/null
+++ b/testing/keys/gnupg/pubring.gpg
Binary files differ
diff --git a/testing/keys/gnupg/random_seed b/testing/keys/gnupg/random_seed
new file mode 100644
index 0000000..94ae717
--- /dev/null
+++ b/testing/keys/gnupg/random_seed
Binary files differ
diff --git a/testing/keys/gnupg/secring.gpg b/testing/keys/gnupg/secring.gpg
new file mode 100644
index 0000000..bab5854
--- /dev/null
+++ b/testing/keys/gnupg/secring.gpg
Binary files differ
diff --git a/testing/keys/gnupg/trustdb.gpg b/testing/keys/gnupg/trustdb.gpg
new file mode 100644
index 0000000..dc99c57
--- /dev/null
+++ b/testing/keys/gnupg/trustdb.gpg
Binary files differ
diff --git a/testing/library.yarn b/testing/library.yarn
index 9eaa069..eea9320 100644
--- a/testing/library.yarn
+++ b/testing/library.yarn
@@ -108,12 +108,16 @@ Generic utility methods
-----------------------
IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*) runs ?(.*)
- $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 > $DATADIR/stdout 2> $DATADIR/stderr
+ if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi
+ $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 < $DATADIR/stdin > $DATADIR/stdout 2> $DATADIR/stderr
+ rm -f $DATADIR/stdin
IMPLEMENTS WHEN ([a-z][a-z0-9]*) ([a-z][a-z0-9]*),? expecting failure,? runs ?(.*)
+ if ! test -e $DATADIR/stdin; then touch $DATADIR/stdin; fi
if $GTT runcommand $MATCH_1 $MATCH_2 $MATCH_3 > $DATADIR/stdout 2> $DATADIR/stderr; then
false
fi
+ rm -f $DATADIR/stdin
IMPLEMENTS GIVEN ([^ ]+) contains (.+)
printf %s "$MATCH_2" >"$DATADIR/$MATCH_1"
@@ -139,3 +143,9 @@ Generic utility methods
cat stderr
/bin/false
+GPG Keyring related helpers
+---------------------------
+
+ IMPLEMENTS GIVEN gpg key ([0-9A-Fa-f]+) on stdin
+ $GTT gpg --armor --export $MATCH_1 > $DATADIR/stdin
+