diff --git a/Examples/makefile b/Examples/makefile index df6f17b..21ea13d 100644 --- a/Examples/makefile +++ b/Examples/makefile @@ -61,6 +61,8 @@ ALL = jerasure_01 \ reed_sol_02 \ reed_sol_03 \ reed_sol_04 \ + reed_sol_test_gf \ + reed_sol_time_gf \ cauchy_01 \ cauchy_02 \ cauchy_03 \ @@ -186,3 +188,11 @@ encoder: encoder.o galois.o jerasure.o liberation.o reed_sol.o cauchy.o decoder.o: galois.h liberation.h jerasure.h reed_sol.h cauchy.h decoder: decoder.o galois.o jerasure.o liberation.o reed_sol.o cauchy.o $(CC) $(CFLAGS) -o decoder decoder.o liberation.o jerasure.o galois.o reed_sol.o cauchy.o -lgf_complete + +reed_sol_test_gf.o: galois.h reed_sol.h jerasure.h +reed_sol_test_gf: reed_sol_test_gf.o galois.o ${LIBDIR}/gf_complete.a jerasure.o reed_sol.o + $(CC) $(CFLAGS) -o reed_sol_test_gf reed_sol_test_gf.o reed_sol.o jerasure.o galois.o ${LIBDIR}/gf_complete.a + +reed_sol_time_gf.o: galois.h reed_sol.h jerasure.h +reed_sol_time_gf: reed_sol_time_gf.o galois.o ${LIBDIR}/gf_complete.a jerasure.o reed_sol.o + $(CC) $(CFLAGS) -o reed_sol_time_gf reed_sol_time_gf.o reed_sol.o jerasure.o galois.o ${LIBDIR}/gf_complete.a diff --git a/Test/reed_sol_test_01.c b/Examples/reed_sol_test_gf.c similarity index 94% rename from Test/reed_sol_test_01.c rename to Examples/reed_sol_test_gf.c index 32e65a0..63f6c07 100644 --- a/Test/reed_sol_test_01.c +++ b/Examples/reed_sol_test_gf.c @@ -45,11 +45,6 @@ POSSIBILITY OF SUCH DAMAGE. */ - -/* - revised by S. Simmerman - 2/25/08 -*/ #include #include #include @@ -74,15 +69,17 @@ static void free16(void *ptr) { usage(char *s) { - fprintf(stderr, "usage: reed_sol_test_01 k m w [additional GF args]- Tests Reed-Solomon in GF(2^w).\n"); + fprintf(stderr, "usage: reed_sol_test_gf k m w [additional GF args]- Tests Reed-Solomon in GF(2^w).\n"); fprintf(stderr, " \n"); - fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w. It sets up a classic\n"); - fprintf(stderr, " Vandermonde-based distribution matrix and encodes k devices of\n"); + fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w.\n"); + fprintf(stderr, " See the README for information on the additional GF args.\n"); + fprintf(stderr, " Set up a Vandermonde-based distribution matrix and encodes k devices of\n"); fprintf(stderr, " %d bytes each with it. Then it decodes.\n", BUFSIZE); fprintf(stderr, " \n"); fprintf(stderr, "This tests: jerasure_matrix_encode()\n"); fprintf(stderr, " jerasure_matrix_decode()\n"); fprintf(stderr, " jerasure_print_matrix()\n"); + fprintf(stderr, " galois_change_technique()\n"); fprintf(stderr, " reed_sol_vandermonde_coding_matrix()\n"); if (s != NULL) fprintf(stderr, "%s\n", s); exit(1); diff --git a/Test/reed_sol_test_02.c b/Examples/reed_sol_time_gf.c similarity index 92% rename from Test/reed_sol_test_02.c rename to Examples/reed_sol_time_gf.c index 37aff98..77dcf57 100644 --- a/Test/reed_sol_test_02.c +++ b/Examples/reed_sol_time_gf.c @@ -46,10 +46,6 @@ POSSIBILITY OF SUCH DAMAGE. */ -/* - revised by S. Simmerman - 2/25/08 -*/ #include #include #include @@ -92,15 +88,17 @@ timer_split (const double *t) usage(char *s) { - fprintf(stderr, "usage: reed_sol_test_01 k m w iterations bufsize [additional GF args]- Tests Reed-Solomon in GF(2^w).\n"); + fprintf(stderr, "usage: reed_sol_test_gf k m w [additional GF args]- Test and time Reed-Solomon in a particular GF(2^w).\n"); fprintf(stderr, " \n"); - fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w. It sets up a classic\n"); - fprintf(stderr, " Vandermonde-based distribution matrix and encodes k devices of\n"); - fprintf(stderr, " bytes each with it. Then it decodes.\n"); + fprintf(stderr, " w must be 8, 16 or 32. k+m must be <= 2^w.\n"); + fprintf(stderr, " See the README for information on the additional GF args.\n"); + fprintf(stderr, " Set up a Vandermonde-based distribution matrix and encodes k devices of\n"); + fprintf(stderr, " %d bytes each with it. Then it decodes.\n", BUFSIZE); fprintf(stderr, " \n"); fprintf(stderr, "This tests: jerasure_matrix_encode()\n"); fprintf(stderr, " jerasure_matrix_decode()\n"); fprintf(stderr, " jerasure_print_matrix()\n"); + fprintf(stderr, " galois_change_technique()\n"); fprintf(stderr, " reed_sol_vandermonde_coding_matrix()\n"); if (s != NULL) fprintf(stderr, "%s\n", s); exit(1); diff --git a/Test/test_all_gfs.sh b/Examples/test_all_gfs.sh similarity index 74% rename from Test/test_all_gfs.sh rename to Examples/test_all_gfs.sh index af2e0fa..f997b2b 100755 --- a/Test/test_all_gfs.sh +++ b/Examples/test_all_gfs.sh @@ -2,38 +2,54 @@ GF_COMPLETE_DIR=/usr/local/bin GF_METHODS=${GF_COMPLETE_DIR}/gf_methods k=12 m=3 +FAIL= # Test all w=8 ${GF_METHODS} | awk -F: '{ if ($1 == "w=8") print $2; }' | while read method; do echo "Testing ${k} ${m} 8 ${method}" - ./reed_sol_test_01 ${k} ${m} 8 ${method} + ./reed_sol_test_gf ${k} ${m} 8 ${method} if [[ $? != "0" ]]; then echo "Failed test for ${k} ${m} 8 ${method}" + FAIL=1 exit 1 fi done +if [ -n ${FAIL} ]; then + exit 1 +fi + # Test all w=16 ${GF_METHODS} | awk -F: '{ if ($1 == "w=16") print $2; }' | while read method; do echo "Testing ${k} ${m} 16 ${method}" - ./reed_sol_test_01 ${k} ${m} 16 ${method} + ./reed_sol_test_gf ${k} ${m} 16 ${method} if [[ $? != "0" ]]; then echo "Failed test for ${k} ${m} 16 ${method}" + FAIL=1 exit 1 fi done +if [ -n ${FAIL} ]; then + exit 1 +fi + # Test all w=32 ${GF_METHODS} | awk -F: '{ if ($1 == "w=32") print $2; }' | while read method; do echo "Testing ${k} ${m} 32 ${method}" - ./reed_sol_test_01 ${k} ${m} 32 ${method} + ./reed_sol_test_gf ${k} ${m} 32 ${method} if [[ $? != "0" ]]; then echo "Failed test for ${k} ${m} 32 ${method}" + FAIL=1 exit 1 fi done +if [ -n ${FAIL} ]; then + exit 1 +fi + echo "Passed all tests!" diff --git a/Test/time_all_gfs.sh b/Examples/time_all_gfs.sh similarity index 74% rename from Test/time_all_gfs.sh rename to Examples/time_all_gfs.sh index e4c90c6..d6313b7 100755 --- a/Test/time_all_gfs.sh +++ b/Examples/time_all_gfs.sh @@ -3,39 +3,55 @@ GF_METHODS=${GF_COMPLETE_DIR}/gf_methods ITERATIONS=128 BUFSIZE=65536 k=12 -m=2 +m=3 +FAIL= # Test all w=8 ${GF_METHODS} | awk -F: '{ if ($1 == "w=8") print $2; }' | while read method; do echo "Testing ${k} ${m} 8 ${ITERATIONS} ${BUFSIZE} ${method}" - ./reed_sol_test_02 ${k} ${m} 8 ${ITERATIONS} ${BUFSIZE} ${method} + ./reed_sol_time_gf ${k} ${m} 8 ${ITERATIONS} ${BUFSIZE} ${method} if [[ $? != "0" ]]; then echo "Failed test for ${k} ${m} 8 ${ITERATIONS} ${BUFSIZE} ${method}" + FAIL=1 exit 1 fi done +if [ -n ${FAIL} ]; then + exit 1 +fi + # Test all w=16 ${GF_METHODS} | grep -v 'TABLE' | awk -F: '{ if ($1 == "w=16") print $2; }' | while read method; do echo "Testing ${k} ${m} 16 ${ITERATIONS} ${BUFSIZE} ${method}" - ./reed_sol_test_02 ${k} ${m} 16 ${ITERATIONS} ${BUFSIZE} ${method} + ./reed_sol_time_gf ${k} ${m} 16 ${ITERATIONS} ${BUFSIZE} ${method} if [[ $? != "0" ]]; then echo "Failed test for ${k} ${m} 16 ${ITERATIONS} ${BUFSIZE} ${method}" + FAIL=1 exit 1 fi done +if [ -n ${FAIL} ]; then + exit 1 +fi + # Test all w=32 ${GF_METHODS} | awk -F: '{ if ($1 == "w=32") print $2; }' | while read method; do echo "Testing ${k} ${m} 32 ${ITERATIONS} ${BUFSIZE} ${method}" - ./reed_sol_test_02 ${k} ${m} 32 ${ITERATIONS} ${BUFSIZE} ${method} + ./reed_sol_time_gf ${k} ${m} 32 ${ITERATIONS} ${BUFSIZE} ${method} if [[ $? != "0" ]]; then echo "Failed test for ${k} ${m} 32 ${ITERATIONS} ${BUFSIZE} ${method}" + FAIL=1 exit 1 fi done +if [ -n ${FAIL} ]; then + exit 1 +fi + echo "Passed all tests!" diff --git a/Test/makefile b/Test/makefile deleted file mode 100644 index f31827c..0000000 --- a/Test/makefile +++ /dev/null @@ -1,103 +0,0 @@ -# Examples/makefile -# Jerasure - A C/C++ Library for a Variety of Reed-Solomon and RAID-6 Erasure Coding Techniques -# -# Revision 1.2A -# May 24, 2011 -# -# James S. Plank -# Department of Electrical Engineering and Computer Science -# University of Tennessee -# Knoxville, TN 37996 -# plank@cs.utk.edu -# -# Copyright (c) 2011, James S. Plank -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# - Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# - Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# - Neither the name of the University of Tennessee nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -# WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -PREFIX=/usr/local -BINDIR=${PREFIX}/bin -LIBDIR=${PREFIX}/lib -INCDIR=${PREFIX}/include -CC = gcc -CFLAGS = -O3 -I$(HOME)/include - -ALL = reed_sol_test_01 reed_sol_test_02 - -all: $(ALL) - -clean: - rm -f core *.o $(ALL) a.out cauchy.h cauchy.c liberation.h liberation.c reed_sol.c reed_sol.h\ - jerasure.c jerasure.h galois.c galois.h - -.SUFFIXES: .c .o -.c.o: - $(CC) $(CFLAGS) -c $*.c - -liberation.h: ../liberation.h - rm -f liberation.h ; cp ../liberation.h . ; chmod 0444 liberation.h - -liberation.c: ../liberation.c - rm -f liberation.c ; cp ../liberation.c . ; chmod 0444 liberation.c - -cauchy.h: ../cauchy.h - rm -f cauchy.h ; cp ../cauchy.h . ; chmod 0444 cauchy.h - -cauchy.c: ../cauchy.c - rm -f cauchy.c ; cp ../cauchy.c . ; chmod 0444 cauchy.c - -reed_sol.h: ../reed_sol.h - rm -f reed_sol.h ; cp ../reed_sol.h . ; chmod 0444 reed_sol.h - -reed_sol.c: ../reed_sol.c - rm -f reed_sol.c ; cp ../reed_sol.c . ; chmod 0444 reed_sol.c - -jerasure.h: ../jerasure.h - rm -f jerasure.h ; cp ../jerasure.h . ; chmod 0444 jerasure.h - -jerasure.c: ../jerasure.c - rm -f jerasure.c ; cp ../jerasure.c . ; chmod 0444 jerasure.c - -galois.h: ../galois.h - rm -f galois.h ; cp ../galois.h . ; chmod 0444 galois.h - -galois.c: ../galois.c - rm -f galois.c ; cp ../galois.c . ; chmod 0444 galois.c - -galois.o ${LIBDIR}/gf_complete.a: galois.h -jerasure.o: jerasure.h galois.h - -reed_sol_test_01.o: galois.h reed_sol.h jerasure.h -reed_sol_test_01: reed_sol_test_01.o galois.o ${LIBDIR}/gf_complete.a jerasure.o reed_sol.o - $(CC) $(CFLAGS) -o reed_sol_test_01 reed_sol_test_01.o reed_sol.o jerasure.o galois.o ${LIBDIR}/gf_complete.a - -reed_sol_test_02.o: galois.h reed_sol.h jerasure.h -reed_sol_test_02: reed_sol_test_02.o galois.o ${LIBDIR}/gf_complete.a jerasure.o reed_sol.o - $(CC) $(CFLAGS) -o reed_sol_test_02 reed_sol_test_02.o reed_sol.o jerasure.o galois.o ${LIBDIR}/gf_complete.a