Commit e0c08172 authored by Michael Terry's avatar Michael Terry

tests: also regulate the environment variable PASSPHRASE

parent bab08eeb
......@@ -76,6 +76,7 @@ rv = 0
expected_args = []
delay = 0
script = ''
passphrase = None
while len(lines) > curline and lines[curline].strip():
tokens = lines[curline].split()
......@@ -87,12 +88,18 @@ while len(lines) > curline and lines[curline].strip():
delay = int(tokens[1])
elif tokens[0] == 'SCRIPT:':
script = ' '.join(tokens[1:])
elif tokens[0] == 'PASSPHRASE:':
passphrase = tokens[1] if len(tokens) > 1 else ''
curline += 1
if expected_args != sys.argv[1:]:
print >> logfd, "TESTFAIL: expected\n%s\nvs\n%s" % (expected_args, sys.argv[1:])
sys.exit(-1)
if passphrase != os.environ.get('PASSPHRASE'):
print >> logfd, "TESTFAIL: expected passphrase '%s', but got '%s'" % (passphrase, os.environ.get('PASSPHRASE'))
sys.exit(-1)
curline = skip_whitespace(curline)
while len(lines) > curline and lines[curline] != "=== deja-dup ===\n":
......
......@@ -348,6 +348,7 @@ void process_duplicity_run_block(KeyFile keyfile, string run, BackupRunner br) t
bool encrypted = false;
bool cancel = false;
bool stop = false;
bool passphrase = false;
string script = null;
Mode mode = Mode.NONE;
......@@ -369,6 +370,8 @@ void process_duplicity_run_block(KeyFile keyfile, string run, BackupRunner br) t
outputscript = replace_keywords(keyfile.get_comment(group, "Output"));
else if (keyfile.has_key(group, "OutputScript") && keyfile.get_boolean(group, "OutputScript"))
outputscript = run_script(replace_keywords(keyfile.get_comment(group, "OutputScript")));
if (keyfile.has_key(group, "Passphrase"))
passphrase = keyfile.get_boolean(group, "Passphrase");
if (keyfile.has_key(group, "Stop"))
stop = keyfile.get_boolean(group, "Stop");
if (keyfile.has_key(group, "Script"))
......@@ -411,6 +414,11 @@ void process_duplicity_run_block(KeyFile keyfile, string run, BackupRunner br) t
if (script != null)
dupscript += "\n" + "SCRIPT: " + script;
if (passphrase)
dupscript += "\n" + "PASSPHRASE: test";
else if (!encrypted) // when not encrypted, we always expect empty string
dupscript += "\n" + "PASSPHRASE:";
if (outputscript != null && outputscript != "")
dupscript += "\n\n" + outputscript + "\n";
......
......@@ -20,23 +20,29 @@ Encrypted=true
#. ['duplicity.gpg']
Output=true
Encrypted=true
Passphrase=true
[Duplicity dry 2]
Encrypted=true
Passphrase=true
[Duplicity backup 1]
#ERROR 31
Output=true
Encrypted=true
Passphrase=true
[Duplicity status 3]
#DEBUG 1
#. ['duplicity.gpg']
Output=true
Encrypted=true
Passphrase=true
[Duplicity dry 3]
Encrypted=true
Passphrase=true
[Duplicity backup 2]
Encrypted=true
Passphrase=true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment