added better error handling to vault writing, always use a tmp

vault file for writing. added matching unittest to check if
the code catches a disk full error.
This commit is contained in:
TLINDEN
2013-11-09 13:46:40 +01:00
parent bccdaf4ff2
commit 1a772e15b8
28 changed files with 930 additions and 1560 deletions

View File

@@ -34,10 +34,17 @@ pwhashes_SOURCES = pwhashes.c
AM_CPPFLAGS = -I$(top_builddir)/src
#
# Note: some of these unit tests run only on freebsd.
# required sudo settings:
# %wheel ALL = NOPASSWD: /sbin/umount
# %wheel ALL = NOPASSWD: /sbin/mdmfs
test: check
rm -f test* v* stresstest/*
./unittests.pl unittests.cfg $(CHECK)
@echo "To run a single test only, type: 'make test CHECK=testname'"
sudo umount -f env
stresstest: check
./unittests.pl stresstests.cfg

View File

@@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.12.6 from Makefile.am.
# Makefile.in generated by automake 1.12.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
@@ -549,10 +549,17 @@ uninstall-am:
tags uninstall uninstall-am
#
# Note: some of these unit tests run only on freebsd.
# required sudo settings:
# %wheel ALL = NOPASSWD: /sbin/umount
# %wheel ALL = NOPASSWD: /sbin/mdmfs
test: check
rm -f test* v* stresstest/*
./unittests.pl unittests.cfg $(CHECK)
@echo "To run a single test only, type: 'make test CHECK=testname'"
sudo umount -f env
stresstest: check
./unittests.pl stresstests.cfg

View File

@@ -329,7 +329,7 @@ dxmorg@florida.cops.gov
<test check-testkey-invalid-id>
prepare = ./invalidkeys
cmd = $pcp -V $vault -S -I testkey-invalid-id
expect /invalid key id/
expect /(invalid key id|could not decode input)/
</test>
<test check-testkey-not-encrypted>
@@ -401,6 +401,13 @@ dxmorg@florida.cops.gov
expect = /ok/
</test>
# this one only works on freebsd for my user. sorrry
<test check-vault-disk-full>
prepare = sudo mdmfs -s 1M -w 1001:1001 md env && dd if=/dev/zero of=env/b bs=1024 count=700
cmd = ./jot 100 | while read N; do if ! (echo a; echo b) | $pcp -V env/v1 -k -x x; then break; fi; done
expect = /Failed to copy/
</test>
#
# input handling tests
<test check-large-meta>

View File

@@ -104,7 +104,7 @@ sub runtest {
my $ret = run($cfg->{cmd},
$cfg->{input},
\$out, \$error, 5, 0, undef);
\$out, \$error, 10, 0, undef);
$output = $out . $error;