blob: 7eeaf71b1c668b95a11c196ace8ae41ed14b01c6 [file] [log] [blame]
Tom Finegan0c358d62014-04-24 13:31:43 -07001#!/bin/sh
2##
3## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
4##
5## Use of this source code is governed by a BSD-style license
6## that can be found in the LICENSE file in the root of the source
7## tree. An additional intellectual property rights grant can be found
8## in the file PATENTS. All contributing project authors may
9## be found in the AUTHORS file in the root of the source tree.
10##
11## This file tests the libvpx simple_decoder example code. To add new tests to
12## this file, do the following:
13## 1. Write a shell function (this is your test).
14## 2. Add the function to simple_decoder_tests (on a new line).
15##
16. $(dirname $0)/tools_common.sh
17
18# Environment check: Make sure input is available:
19# $VP8_IVF_FILE and $VP9_IVF_FILE are required.
20simple_decoder_verify_environment() {
21 if [ ! -e "${VP8_IVF_FILE}" ] || [ ! -e "${VP9_IVF_FILE}" ]; then
22 echo "Libvpx test data must exist in LIBVPX_TEST_DATA_PATH."
23 return 1
24 fi
25}
26
27# Runs simple_decoder using $1 as input file. $2 is the codec name, and is used
28# solely to name the output file.
29simple_decoder() {
30 local decoder="${LIBVPX_BIN_PATH}/simple_decoder${VPX_TEST_EXE_SUFFIX}"
31 local input_file="$1"
32 local codec="$2"
33 local output_file="${VPX_TEST_OUTPUT_DIR}/simple_decoder_${codec}.raw"
34
Tom Finegan12672c22014-06-16 10:57:00 -070035 if [ ! -x "${decoder}" ]; then
36 elog "${decoder} does not exist or is not executable."
37 return 1
38 fi
Tom Finegan0c358d62014-04-24 13:31:43 -070039
Tom Finegan926a6f62014-07-10 15:17:05 -070040 eval "${VPX_TEST_PREFIX}" "${decoder}" "${input_file}" "${output_file}" \
41 ${devnull}
Tom Finegan0c358d62014-04-24 13:31:43 -070042
43 [ -e "${output_file}" ] || return 1
44}
45
46simple_decoder_vp8() {
47 if [ "$(vp8_decode_available)" = "yes" ]; then
48 simple_decoder "${VP8_IVF_FILE}" vp8 || return 1
49 fi
50}
51
52simple_decoder_vp9() {
53 if [ "$(vp9_decode_available)" = "yes" ]; then
54 simple_decoder "${VP9_IVF_FILE}" vp9 || return 1
55 fi
56}
57
58simple_decoder_tests="simple_decoder_vp8
59 simple_decoder_vp9"
60
61run_tests simple_decoder_verify_environment "${simple_decoder_tests}"