-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·48 lines (40 loc) · 1.29 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
echo "Clear test data ..."
## #./create_test_data -f ./test-data/test-das.h5 -d /dat -n 2 -s 12,16 -t 2 -r -m
##Clean data
rm ./test-data/dir-output/*
rm ./test-data/dir-decimate/*
###Create test data ends
echo "Start to run test ..."
# To test of running a command
# $1 command name
# $2 output data of the command (HDF5 format)
# $3 correct output of the command (HDF5 format)
function run_command(){
$1 > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Test run $1 ... [PASSED]"
else
echo "Test run $1 ... [FAILED]" >&2
fi
if [ "$#" -gt 1 ]; then
h5diff -d 0.0000000000001 -v ./test-data/$5/$2 ./test-data-good/$4 > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Checked output of $2 [PASSED]"
else
echo "Checked output of $2 [FAILED]" >&2
fi
h5diff -d 0.0000000000001 ./test-data/$5/$3 ./test-data-good/$4 > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "Checked output of $3 [PASSED]"
else
echo "Checked output of $3 [FAILED]" >&2
fi
fi
}
## Run the test code
run_command ./xcorrelation test-das-1.h5 test-das-2.h5 test-das-xcorr.h5 dir-output
run_command ./decimate test-das-1.h5 test-das-2.h5 test-das-dec.h5 dir-decimate