Commit ea71173c authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

implify the way to make checks

parent 9af90947
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2011 - 2016)
# Author: Arnaud Blanchard (November 2016)
# Basic Libraries And Applications for Robotics (BLAAR)
# Copyright ETIS — ENSEA, University of Cergy-Pontoise, CNRS (2011 - 2017)
# Author: Arnaud Blanchard
#
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
......@@ -9,25 +11,24 @@
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cd `dirname $0`
project=`basename $PWD`
log="/tmp/${project}_test.log"
#!/usr/bin/env bash #Use your $PATH to find bash
set -o errexit #Exit on first error
set -o nounset #Error if a variable is used but nont defined
set -o pipefail #Error if a pipe fail
log="/tmp/${project}_test.log"
cd $(dirname $0)
blaar_dir="$PWD"/../..
echo
echo "Checking blc_core"
echo "================="
echo
echo "log in $log"
echo "$project" > $log #We erase previous logs
test="t_array"
../compile.sh $test >> $log 2>&1 || { echo "ERROR: Fail compiling $test"; exit 1; } # 2>&1 : stderr is redirected like stdout
( cd .. && bin/$test >> $log 2>&1 ) || { echo "ERROR: Fail executing bin/$test"; exit 2; } # 2>&1 : stderr is redirected like stdout
git diff --exit-code $test/array.tsv >> $log 2>&1 || { echo "ERROR: The result of t_array/array.tsv is not the one expected"; exit 3; }
git diff --exit-code $test/array.blc >> $log 2>&1 || { echo "ERROR: The result of t_array/array.blc is not the one expected"; exit 3; }
$blaar_dir/compile.sh $test || { echo "ERROR: Fail compiling $test"; exit 1; }
(cd $blaar_dir bin/$test ) || { echo "ERROR: Fail executing bin/$test"; exit 2; }
git diff --exit-code $test/array.tsv || { echo "ERROR: The result of t_array/array.tsv is not the one expected"; exit 3; }
git diff --exit-code $test/array.blc || { echo "ERROR: The result of t_array/array.blc is not the one expected"; exit 3; }
echo
echo "- t_array: compilation:OK, execution:OK and result:OK."
echo
......
......@@ -56,11 +56,11 @@ int main(int argc, char **argv){
matrix.fprint_tsv(stderr);
//We save the value as a blc file that we will be able to reread
matrix.save_blc_file("blc_core/t_array/array.blc");
matrix.save_tsv_file("blc_core/t_array/array.tsv"); //Bigger but readable in text mode or within spreadsheet, excel, matlab
matrix.save_blc_file("bl/blc_core/t_array/array.blc");
matrix.save_tsv_file("bl/blc_core/t_array/array.tsv"); //Bigger but readable in text mode or within spreadsheet, excel, matlab
//We reload the matrix which should be identical
matrix_copy.init_with_blc_file("blc_core/t_array/array.blc");
matrix_copy.init_with_blc_file("bl/blc_core/t_array/array.blc");
//we compare the content of the two matrixes
if (memcmp(matrix.data, matrix_copy.data, matrix.size)!=0) EXIT_ON_ARRAY_ERROR(&matrix,"The content of the saved and reloaded matrix are not the same");
......@@ -68,7 +68,7 @@ int main(int argc, char **argv){
fprintf(stderr, "\nWe load an array of intensities and display the values\n\n");
//Load the array
pixel_array.init_with_blc_file("blc_core/lena32.blc");
pixel_array.init_with_blc_file("bl/blc_core/lena32.blc");
//Display the array as a array of decimals)
pixel_array.fprint_surface_uchars(stderr);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment