Browse Source

tests: Add a complete functional test.

Add a test script that splits a file and immediately attempts to
reconstruct it, as a complete test of the whole thing.
master
Damien Goutte-Gattat 3 months ago
parent
commit
61d4acf042
  1. 1
      .gitignore
  2. 6
      tests/Makefile.am
  3. 23
      tests/t-split-restore.sh

1
.gitignore

@ -26,6 +26,7 @@ lib/lib*.a
tests/test-suite.log
tests/t-*
!tests/t-*.c
!tests/t-*.sh
tests/.deps
info/*.info
info/version.texi

6
tests/Makefile.am

@ -1,6 +1,8 @@
TESTS = t-parseuri t-parseconfig
TESTS = $(noinst_PROGRAMS) t-split-restore.sh
noinst_PROGRAMS = $(TESTS)
noinst_PROGRAMS = t-parseuri t-parseconfig
EXTRA_DIST = t-split-restore.sh
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/src
LDADD = $(top_builddir)/src/libgfsec.a \

23
tests/t-split-restore.sh

@ -0,0 +1,23 @@
#!/bin/bash
../src/gfsec-split -k -c $$.conf Makefile \
file://$PWD/$$.share file://$PWD/$$.share file://$PWD/$$.share
if [ $? != 0 ]; then
echo "t-split-restore: gfsec-split failed" >&2
exit 1
fi
../src/gfsec-use -c $$.conf -k -o $$.rebuilt
if [ $? != 0 ]; then
echo "t-split-restore: gfsec-use failed" >&2
exit 1
fi
if [ "$(md5sum Makefile | cut -d' ' -f1)" != "$(md5sum $$.rebuilt | cut -d' ' -f1)" ]; then
echo "t-split-restore: Reconstructed file differs from the original file"
exit 1
fi
rm -f $$.*
exit 0
Loading…
Cancel
Save