summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Dachary <ldachary@redhat.com>2014-12-15 12:31:00 +0100
committerLoic Dachary <ldachary@redhat.com>2014-12-15 18:17:18 +0100
commit11dc3fcb82c049d88081ffaa0849786e416a4b5f (patch)
treee121f2c11059ca1f5d4e640a57cce03f124654d5
parent1be39b85504e6d3c892a31313de3763a55e18dcd (diff)
downloadjerasure-11dc3fcb82c049d88081ffaa0849786e416a4b5f.tar.gz
tests: add minimal encoder/decoder test
Add a test to run with make check to run encoder and decoder to make sure they work at least in one simple case. It is also useful as a documentation about how to use them. Signed-off-by: Loic Dachary <loic@dachary.org>
-rw-r--r--Examples/Makefile.am2
-rwxr-xr-xExamples/encode_decode.sh21
2 files changed, 22 insertions, 1 deletions
diff --git a/Examples/Makefile.am b/Examples/Makefile.am
index 9e20f1c..defd139 100644
--- a/Examples/Makefile.am
+++ b/Examples/Makefile.am
@@ -27,7 +27,7 @@ bin_PROGRAMS = jerasure_01 \
check_PROGRAMS =
-TESTS=test_all_gfs.sh $(check_PROGRAMS)
+TESTS=test_all_gfs.sh encode_decode.sh $(check_PROGRAMS)
dist_noinst_SCRIPTS = test_all_gfs.sh time_all_gfs_argv_init.sh
diff --git a/Examples/encode_decode.sh b/Examples/encode_decode.sh
new file mode 100755
index 0000000..7f2fded
--- /dev/null
+++ b/Examples/encode_decode.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+#
+# Copyright (C) 2014 Red Hat <contact@redhat.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library Public License for more details.
+#
+trap "rm -fr T Coding" EXIT
+
+dd if=/dev/urandom of=T bs=4096 count=1
+./encoder T 3 2 reed_sol_van 8 0 0
+./decoder T