123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- #parse argument
- architecture=$1
- permutation=$2
- matrix_decompressed_file=$3
- matrix_comp_file=$4
- output_dir=$5
- lorem_ipsum_file=$6
- if [ $permutation -eq 0 ] ; then
- permutation_str=""
- else
- permutation_str=" -no-permutation-key "
- fi
- # useful scripts
- # write zero
- # dd if=/dev/zero of=binary.dat bs=1c count=1
- # append zero
- # dd if=/dev/zero oflag=append conv=notrunc of=binary.dat bs=1c count=1
- # count zeros
- # xxd -b infile | awk 'NF{NF-=1};1' | sed 's/^.*://' | tr -d '\n' | tr -d ' ' | sed 's/1//g' | wc -c
- # count last 1024 zeros
- # xxd -b running_warning.bin | awk 'NF{NF-=1};1' | sed 's/^.*://' | tr -d '\n' | tr -d ' ' | tail -c 1024 | tr -d '1' | wc -c
- # create two files
- str="
- head -c 256 </dev/urandom >$output_dir/rnd_file.bin
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- echo -n $'\xf0' > $output_dir/balanced_file.bin ; \
- for i in {1..255} ; do echo -n $'\x0f' >> $output_dir/balanced_file.bin ; done
- "
- echo ""; echo $str; echo ""
- eval $str
- # trigger constant warning
- # the balanced_file has in the buffer at the end 64 zeroes and 64 ones
- # to trigger a warning and not an error we need to add (704-64) ones (or zeros) at the end of the file
- str="
- cp $output_dir/balanced_file.bin $output_dir/disparity_warning.bin ; \
- for i in {1..32} ; do echo -n $'\xff' >> $output_dir/disparity_warning.bin ; done ; \
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -no-running-err -disparity-war-th 640 -disparity-err-th 704 -no-password \
- --encoding-conf -no-param \
- --logging-conf -lib-error-log $output_dir/disparity_warning.err -lib-warning-log $output_dir/disparity_warning.war \
- --decode-encode -to-decode $output_dir/disparity_warning.bin -to-encode $output_dir/dummy ; \
- rm $output_dir/dummy
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- nlwar=$( cat $output_dir/disparity_warning.war | wc -l ) ; \
- nlerr=$( cat $output_dir/disparity_warning.err | wc -l ) ; \
- if [ \$nlwar != '1' ] || [ \$nlerr != '0' ] ; then echo FAIL ; exit ; fi ; \
- "
- echo ""; echo $str; echo ""
- eval $str
- # trigger constant error
- # the balanced_file has in the buffer at the end 64 zeroes and 64 ones
- # to trigger a warning and not an error we need to add (704-64) ones (or zeros) at the end of the file
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -no-running-err -disparity-war-th 639 -disparity-err-th 640 -no-password \
- --encoding-conf -no-param \
- --logging-conf -lib-error-log $output_dir/disparity_error.err -lib-warning-log $output_dir/disparity_error.war \
- --decode-encode -to-decode $output_dir/disparity_warning.bin -to-encode $output_dir/dummy ; \
- rm $output_dir/dummy
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- nlwar=$( cat $output_dir/disparity_error.war | wc -l ) ; \
- nlerr=$( cat $output_dir/disparity_error.err | grep -v 'generic error' | wc -l ) ; \
- if [ \$nlwar != '0' ] || [ \$nlerr != '1' ] ; then echo FAIL ; exit ; fi ; \
- "
- echo ""; echo $str; echo ""
- eval $str
- # do not trigger error or warnings
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -no-running-err -no-disparity-err -no-password \
- --encoding-conf -no-param \
- --logging-conf -lib-error-log $output_dir/no_disparity_error.err -lib-warning-log $output_dir/no_disparity_error.war \
- --decode-encode -to-decode $output_dir/disparity_warning.bin -to-encode $output_dir/dummy ; \
- rm $output_dir/dummy
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- nlwar=$( cat $output_dir/no_disparity_error.war | wc -l ) ; \
- nlerr=$( cat $output_dir/no_disparity_error.err | grep -v 'generic error' | wc -l ) ; \
- if [ \$nlwar != '0' ] || [ \$nlerr != '0' ] ; then echo FAIL ; exit ; fi ; \
- "
- echo ""; echo $str; echo ""
- eval $str
- # trigger running warning
- # the rnd_file has in the buffer mixed zeros and ones
- # to trigger a warning and not an error we need to add (32 consecutives bits) ones
- str="
- cp $output_dir/rnd_file.bin $output_dir/running_warning.bin ; \
- echo -n $'\x0f' >> $output_dir/running_warning.bin ; \
- for i in {1..3} ; do echo -n $'\xff' >> $output_dir/running_warning.bin ; done ; \
- echo -n $'\xf0' >> $output_dir/running_warning.bin
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -running-war-th 32 -running-err-th 36 -no-password \
- --encoding-conf -no-param \
- --logging-conf -lib-error-log $output_dir/running_warning.err -lib-warning-log $output_dir/running_warning.war \
- --decode-encode -to-decode $output_dir/running_warning.bin -to-encode $output_dir/dummy ; \
- rm $output_dir/dummy
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- nlwar=$( cat $output_dir/running_warning.war | wc -l ) ; \
- nlerr=$( cat $output_dir/running_warning.err | wc -l ) ; \
- if [ \$nlwar != '1' ] || [ \$nlerr != '0' ] ; then echo FAIL ; exit ; fi ; \
- "
- echo ""; echo $str; echo ""
- eval $str
- # trigger running error
- # the rnd_file has in the buffer mixed zeros and ones
- # to trigger a warning and not an error we need to add (32 consecutives bits) ones
- str="
- cp $output_dir/rnd_file.bin $output_dir/running_error.bin ; \
- echo -n $'\x0f' >> $output_dir/running_error.bin ; \
- for i in {1..3} ; do echo -n $'\xff' >> $output_dir/running_error.bin ; done ; \
- echo -n $'\xff' >> $output_dir/running_error.bin
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- xrnlib-cli \
- --decoding-conf -compiled-param -running-war-th 32 -running-err-th 36 -no-password \
- --encoding-conf -no-param \
- --logging-conf -lib-error-log $output_dir/running_error.err -lib-warning-log $output_dir/running_error.war \
- --decode-encode -to-decode $output_dir/running_error.bin -to-encode $output_dir/dummy ; \
- rm $output_dir/dummy
- "
- echo ""; echo $str; echo ""
- eval $str
- str="
- nlwar=$( cat $output_dir/running_error.war | wc -l ) ; \
- nlerr=$( cat $output_dir/running_error.err | grep -v 'generic error' | wc -l ) ; \
- if [ \$nlwar != '0' ] || [ \$nlerr != '1' ] ; then echo FAIL ; exit ; fi ; \
- "
- echo ""; echo $str; echo ""
- eval $str
|