Natools

Check-in [9347f4362d]
Login
Overview
Comment:tools/test.sh: test suite for tools
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9347f4362d137088dc23c54c83d7145d16ee5dd9
User & Date: nat on 2014-04-11 20:10:20
Other Links: manifest | tags
Context
2014-04-12
16:19
natools-references: add support of references to constant check-in: 8c650fd927 user: nat tags: trunk
2014-04-11
20:10
tools/test.sh: test suite for tools check-in: 9347f4362d user: nat tags: trunk
2014-04-10
21:48
hmac-main: new option to provide the key through a file or standard input check-in: 7527f90336 user: nat tags: trunk
Changes

Modified coverage.sh from [4e0df98a36] to [0c2b3fd4ac].

1
2
3
4
5
6
7
8

9
10

11
12
13
#!/bin/sh

: ${GNATPATH:=/usr/local/gcc-aux/bin}
: ${LCOV_DATA:=coverage/test-info.dat}
: ${LCOV_HTML_DIR:=coverage}
: ${TEST_LOG:=coverage.log}

${GNATPATH}/gnatmake -p -Ptests -XMODE=Coverage || exit $?

lcov --directory coverage/obj --zerocounters
coverage/bin/test_all > "${TEST_LOG}"

tail -n 4  "${TEST_LOG}"
lcov --gcov-tool ${GNATPATH}/gcov --directory coverage/obj --output "${LCOV_DATA}" --capture || exit $?
genhtml --output-dir "${LCOV_HTML_DIR}" "${LCOV_DATA}"








>


>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

: ${GNATPATH:=/usr/local/gcc-aux/bin}
: ${LCOV_DATA:=coverage/test-info.dat}
: ${LCOV_HTML_DIR:=coverage}
: ${TEST_LOG:=coverage.log}

${GNATPATH}/gnatmake -p -Ptests -XMODE=Coverage || exit $?
${GNATPATH}/gnatmake -p -Ptools -XMODE=Coverage || exit $?
lcov --directory coverage/obj --zerocounters
coverage/bin/test_all > "${TEST_LOG}"
tools/tests.sh coverage/bin
tail -n 4  "${TEST_LOG}"
lcov --gcov-tool ${GNATPATH}/gcov --directory coverage/obj --output "${LCOV_DATA}" --capture || exit $?
genhtml --output-dir "${LCOV_HTML_DIR}" "${LCOV_DATA}"

Added tools/tests.sh version [a89c6587cb].



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/bin/sh

: ${BIN_DIR:=${1:-$(dirname $0)}}
: ${TMP_TEMPLATE:=/tmp/tmp.XXXXXX}

RET_VAL="0"

if ! test -x ${BIN_DIR}/hmac-md5 \
   -o -x ${BIN_DIR}/hmac-sha1 \
   -o -x ${BIN_DIR}/hmac-sha256; then
	echo "Unable to find tested executables in ${BIN_DIR}, aborting" >&2
	exit 2
fi


####################
# Test of hmac-md5 #
####################

if test -x ${BIN_DIR}/hmac-md5; then
	OUTPUT=$("${BIN_DIR}"/hmac-md5 '' '')
	if test "${OUTPUT}" != "74e6f7298a9c2d168935f58c001bad88"; then
		echo "Wrong output for HMAC-MD5('', ''): ${OUTPUT}"
		RET_VAL="1"
	fi;

	MSG="what do ya want for nothing?"
	OUTPUT=$(printf "Jefe\n${MSG}" \
	    | "${BIN_DIR}"/hmac-md5 -r -f - \
	    | xxd -p)
	if test "${OUTPUT}" != "750c783e6ab0b503eaa86e310a5db738"; then
		echo "Wrong output for HMAC-MD5('Jefe', '${MSG}'): ${OUTPUT}"
		RET_VAL="1"
	fi;
else
	echo "${BIN_DIR}/hmac-md5 not found"
fi


#####################
# Test of hmac-sha1 #
#####################

if test -x ${BIN_DIR}/hmac-sha1; then
	OUTPUT=$("${BIN_DIR}"/hmac-sha1 -H '' '')
	if test "${OUTPUT}" != "FBDB1D1B18AA6C08324B7D64B71FB76370690E1D"; then
		echo "Wrong output for HMAC-SHA1('', ''): ${OUTPUT}"
		RET_VAL="1"
	fi;

	MSG="The quick brown fox jumps over the lazy dog"
	OUTPUT=$(echo -n "${MSG}" \
	    | "${BIN_DIR}"/hmac-sha1 -b "key")
	if test "${OUTPUT}" != "3nybhbi3iqa8ino29wqQcBydtNk="; then
		echo "Wrong output for HMAC-SHA1('key', '${MSG}'): ${OUTPUT}"
		RET_VAL="1"
	fi;
else
	echo "${BIN_DIR}/hmac-sha1 not found"
fi


#######################
# Test of hmac-sha256 #
#######################

if test -x ${BIN_DIR}/hmac-sha256; then
	TMP_FILE=$(mktemp "${TMP_TEMPLATE}")
	OUTPUT=$("${BIN_DIR}"/hmac-sha256 -h -f "${TMP_FILE}" '')
	if test "${OUTPUT}" != "b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad"; then
		echo "Wrong output for HMAC-SHA256('', ''): ${OUTPUT}"
		RET_VAL="1"
	fi;

	echo 0102030405060708090a0b0c0d0e0f10111213141516171819 \
	    | xxd -r -p \
	    >"${TMP_FILE}"

	OUTPUT=$(echo cdcdcdcdcdcdcdcdcdcd cdcdcdcdcdcdcdcdcdcd \
	              cdcdcdcdcdcdcdcdcdcd cdcdcdcdcdcdcdcdcdcd \
	              cdcdcdcdcdcdcdcdcdcd \
	    | xxd -r -p \
	    | "${BIN_DIR}"/hmac-sha256 -b -f "${TMP_FILE}")
	if test "${OUTPUT}" != "glWKOJpEPA6kzIGYmfIIOoXw+qPlePgHei4/9GcpZls="; then
		echo "Wrong output for HMAC-SHA256(...): ${OUTPUT}"
		RET_VAL="1"
	fi;
	rm "${TMP_FILE}"
else
	echo "${BIN_DIR}/hmac-sha256 not found"
fi

exit ${RET_VAL}