Skip to content

Commit 317352f

Browse files
committed
Add tests for compute-output-hash options
Signed-off-by: Maxime Gervais <gervais.maxime@gmail.com>
1 parent 1b26786 commit 317352f

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

Project/GNU/CLI/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ man1_MANS = ../../../Source/CLI/rawcooked.1
7676

7777
AM_TESTS_FD_REDIRECT = 9>&2
7878

79-
TESTS = test/test1.sh test/test1b.sh test/test2.sh test/test3.sh test/avi.sh test/pcm.sh test/reversibilityfile.sh test/paddingbits.sh test/check.sh test/legacy.sh test/multiple.sh test/valgrind.sh test/overwrite.sh test/increasingdigitcount.sh test/gaps.sh test/slices.sh test/framerate.sh test/notfound.sh test/version.sh
79+
TESTS = test/test1.sh test/test1b.sh test/test2.sh test/test3.sh test/avi.sh test/pcm.sh test/reversibilityfile.sh test/paddingbits.sh test/check.sh test/legacy.sh test/multiple.sh test/valgrind.sh test/overwrite.sh test/increasingdigitcount.sh test/gaps.sh test/slices.sh test/framerate.sh test/hash.sh test/notfound.sh test/version.sh
8080

8181
TESTING_DIR = test/TestingFiles
8282

Project/GNU/CLI/test/hash.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
3+
script_path="${PWD}/test"
4+
. ${script_path}/helpers.sh
5+
6+
test="hash"
7+
8+
while read file ; do
9+
if [ ! -e "${files_path}/${file}" ] ; then
10+
echo "NOK: ${test}/${file}, file not found" >&${fd}
11+
status=1
12+
continue
13+
fi
14+
15+
output="${files_path}/${file}.mkv"
16+
17+
# --output-version 1
18+
run_rawcooked --file --all --compute-output-hash "${files_path}/${file}"
19+
check_success "file rejected at input" "file accepted at input"
20+
21+
computed_md5=$(echo "${cmd_stdout}" | sed -nE 's/.*MD5 is ([a-f0-9]{32}).*/\1/p')
22+
output_md5=$(${md5cmd} "${output}" | cut -d' ' -f1)
23+
24+
# check result
25+
if [ "${computed_md5}" != "${output_md5}" ] ; then
26+
echo "NOK: ${test}/${file}, computed and output md5 differs, computed: ${computed_md5}, output: ${output_md5} " >&${fd}
27+
status=1
28+
clean
29+
continue
30+
fi
31+
32+
clean
33+
34+
# --output-version 2
35+
run_rawcooked --file --all --compute-output-hash --output-version 2 "${files_path}/${file}"
36+
check_success "file rejected at input" "file accepted at input"
37+
38+
computed_md5=$(echo "${cmd_stdout}" | sed -nE 's/.*MD5 is ([a-f0-9]{32}).*/\1/p')
39+
output_md5=$(${md5cmd} "${output}" | cut -d' ' -f1)
40+
41+
# check result
42+
if [ "${computed_md5}" != "${output_md5}" ] ; then
43+
echo "NOK: ${test}/${file}, computed and output md5 differs, computed: ${computed_md5}, output: ${output_md5} " >&${fd}
44+
status=1
45+
clean
46+
continue
47+
fi
48+
49+
clean
50+
done < "${script_path}/hash.txt"
51+
52+
exit ${status}

Project/GNU/CLI/test/hash.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Features/AV_Package/818_DCDM_P3_IA_FIC_000918/818_OV
2+
Formats/TIFF/Flavors/Raw_RGBA_16_U_LE/testsrc_Raw_RGBA_16_LE.tiff
3+
Formats/AVI/Flavors/v210_44100_16_1_S_LE/v210_44100_16_1_S_LE.avi
4+
Formats/AIFF/Flavors/44100_8_1_S/44100_8_1_S.aiff
5+
Formats/AIFF/Flavors/44100_8_1_U/44100_8_1_U.aiff
6+
Formats/WAV/Flavors/44100_16_1_S_LE/44100_16_1_S_LE.wav

0 commit comments

Comments
 (0)