aboutsummaryrefslogtreecommitdiff
path: root/stm32/unittest/scripts/tst_api_mod_check
blob: 060d230200d78ddbed0fc2862ad26c700160e548 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
#
# tst_api_mod_check
#
# Setup input and reference data for one of several versions of this test.

# Find the scripts directory
SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

# Setup common variables
source $SCRIPTS/run_tests_common.sh

# RUN_DIR - Directory where test will be run
RUN_DIR="${UNITTEST_BASE}/test_run/${FULL_TEST_NAME}"

# Call common setup function to make the directory
setup_common "${RUN_DIR}"

# Change to test directory
cd "${RUN_DIR}"


#####################################################################
## Test CHECK actions:

declare -i Fails=0

case "${TEST_OPT}" in

    700D_TEST)
        #
        echo -e "\nReference check"
        if freedv_rx 700D ref_mod.raw ref_rx.raw --testframes; then
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
        #
        echo -e "\nTarget check"
        if freedv_rx 700D stm_out.raw stm_rx.raw --testframes; then
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
        #
        echo -e "\nCompare output binary data"
        if compare_ints -s -b2 -t4 ref_mod.raw stm_out.raw; then 
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
	;;

    700D_CODEC)
        #
        echo -e "\nCompare output binary data"
        if compare_ints -s -b2 -t4 ref_mod.raw stm_out.raw; then 
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
	;;

    700E_TEST)
        #
        echo -e "\nReference check"
        if freedv_rx 700E ref_mod.raw ref_rx.raw --testframes; then
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
        #
        echo -e "\nTarget check"
        if freedv_rx 700E stm_out.raw stm_rx.raw --testframes; then
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
        #
        echo -e "\nCompare output binary data"
        if compare_ints -s -b2 -t4 ref_mod.raw stm_out.raw; then 
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
	;;

    700E_CODEC)
        #
        echo -e "\nCompare output binary data"
        if compare_ints -s -b2 -t4 ref_mod.raw stm_out.raw; then 
            echo "Passed"
        else
            echo "Failed"
            let Fails=($Fails + 1)
        fi
	;;

    esac

if (( $Fails == 0 )); then
    echo -e "\nTest PASSED"
else
    echo -e "\nTest FAILED!"
fi


exit $Fails