|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +script_path="${PWD}/test" |
| 4 | +. ${script_path}/helpers.sh |
| 5 | + |
| 6 | +# test disabled on macOS and Windows |
| 7 | +if [[ "${OSTYPE}" == "darwin"* ]] || [ -n "${WSL}" ] ; then |
| 8 | + exit 77 |
| 9 | +fi |
| 10 | + |
| 11 | +while read line ; do |
| 12 | + file="$(basename "$(echo "${line}" | cut -d' ' -f1)")" |
| 13 | + path="$(dirname "$(echo "${line}" | cut -d' ' -f1)")" |
| 14 | + want="$(echo "${line}" | cut -d' ' -f2)" |
| 15 | + test=$(basename "${path}") |
| 16 | + |
| 17 | + if [ ! -e "${files_path}/${path}/${file}" ] ; then |
| 18 | + echo "NOK: ${test}/${file}, file not found" >&${fd} |
| 19 | + status=1 |
| 20 | + continue |
| 21 | + fi |
| 22 | + |
| 23 | + pushd "${files_path}/${path}" >/dev/null 2>&1 |
| 24 | + if [[ ${file} == *".exr" ]]; then |
| 25 | + encode_extra="--check" |
| 26 | + fi |
| 27 | + run_rawcooked -y --conch --encode --file ${encode_extra} -d "${file}" |
| 28 | + |
| 29 | + # check expected result |
| 30 | + if [ "${want}" == "fail" ] ; then |
| 31 | + if check_failure "file rejected at input" "file accepted at input" ; then |
| 32 | + echo "OK: ${test}/${file}, file rejected at input" >&${fd} |
| 33 | + fi |
| 34 | + continue |
| 35 | + else |
| 36 | + check_success "file rejected at input" "file accepted at input" || continue |
| 37 | + fi |
| 38 | + |
| 39 | + if [ ! -e "${file}.rawcooked_reversibility_data" ] ; then |
| 40 | + echo "NOK: ${test}/${file}, reversibility_data is missing" >&${fd} |
| 41 | + status=1 |
| 42 | + clean |
| 43 | + continue |
| 44 | + fi |
| 45 | + source_warnings=$(echo "${cmd_stderr}" | grep "Warning: ") |
| 46 | + |
| 47 | + # check result file generation |
| 48 | + for variant in swdpx hwdpx ; do |
| 49 | + test="$(basename "${path}") (${variant})" |
| 50 | + |
| 51 | + cmd_stdout="${cmd_stdout/-xerror/-xerror -init_hw_device vulkan=vk:0,debug=0}" |
| 52 | + if [ "${variant}" == "hwdpx" ] ; then |
| 53 | + cmd_stdout="${cmd_stdout/-xerror/-xerror -hwaccel vulkan -hwaccel_output_format vulkan}" |
| 54 | + fi |
| 55 | + cmd_stdout="${cmd_stdout/-c:v ffv1/-vf hwupload -c:v ffv1_vulkan}" |
| 56 | + cmd_stdout="${cmd_stdout/-context 1/}" |
| 57 | + run_ffmpeg "${cmd_stdout}" |
| 58 | + |
| 59 | + if [ ! -e "${file}.mkv" ] ; then |
| 60 | + echo "NOK: ${test}/${file}, mkv not generated" >&${fd} |
| 61 | + status=1 |
| 62 | + continue |
| 63 | + fi |
| 64 | + |
| 65 | + # check decoding |
| 66 | + run_rawcooked -y --conch --decode "${file}.mkv" |
| 67 | + if ! check_success "mkv decoding failed" "mkv decoded" ; then |
| 68 | + rm -f "${file}.mkv" |
| 69 | + continue |
| 70 | + fi |
| 71 | + |
| 72 | + decoded_warnings=$(echo "${cmd_stderr}" | grep "Warning: ") |
| 73 | + if [ "${source_warnings}" != "${decoded_warnings}" ] ; then |
| 74 | + echo "NOK: ${test}/${file}, warnings differs between the source and the decoded files" >&${fd} |
| 75 | + status=1 |
| 76 | + rm -fr "${file}.mkv" "${file}.mkv.RAWcooked" |
| 77 | + continue |
| 78 | + fi |
| 79 | + check_files "${file}" "${file}.mkv.RAWcooked/${file}" |
| 80 | + done |
| 81 | + clean |
| 82 | + popd >/dev/null 2>&1 |
| 83 | +done < "${script_path}/vulkan.txt" |
| 84 | + |
| 85 | +exit ${status} |
0 commit comments