diff --git a/tests/Makefile.am b/tests/Makefile.am index 6273b333..d79c4c49 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,17 +1,17 @@ TESTS = $(check_PROGRAMS) \ - test_external_symbols.bash \ - test_gop.bash \ - test_interlace.bash \ - test_intra.bash \ - test_invalid_input.bash \ - test_mv_constraint.bash \ - test_owf_wpp_tiles.bash \ - test_rate_control.bash \ - test_slices.bash \ - test_smp.bash \ - test_tools.bash \ - test_weird_shapes.bash + test_external_symbols.sh \ + test_gop.sh \ + test_interlace.sh \ + test_intra.sh \ + test_invalid_input.sh \ + test_mv_constraint.sh \ + test_owf_wpp_tiles.sh \ + test_rate_control.sh \ + test_slices.sh \ + test_smp.sh \ + test_tools.sh \ + test_weird_shapes.sh check_PROGRAMS = kvazaar_tests diff --git a/tests/test_external_symbols.bash b/tests/test_external_symbols.sh similarity index 86% rename from tests/test_external_symbols.bash rename to tests/test_external_symbols.sh index bc9b16b7..b9b3d595 100755 --- a/tests/test_external_symbols.bash +++ b/tests/test_external_symbols.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/sh # Check for external symbols without kvz_ prefix. -set -euo pipefail +set -eu${BASH+o pipefail} if nm -go --defined-only ../src/.libs/libkvazaar.a | grep -v ' kvz_'; then printf '%s\n' 'Only symbols prefixed with "kvz_" should be exported from libkvazaar.' diff --git a/tests/test_gop.bash b/tests/test_gop.sh similarity index 93% rename from tests/test_gop.bash rename to tests/test_gop.sh index ce26912f..c8905fe9 100755 --- a/tests/test_gop.bash +++ b/tests/test_gop.sh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh # Test GOP, with and without OWF. set -eu -source util.bash +. "${0%/*}/util.sh" common_args='-p0 --threads=2 --wpp --rd=0 --no-rdoq --no-deblock --no-sao --no-signhide --subme=0 --pu-depth-inter=1-3 --pu-depth-intra=2-3' valgrind_test 264x130 10 $common_args --gop=8 -p0 --owf=1 diff --git a/tests/test_interlace.bash b/tests/test_interlace.sh similarity index 78% rename from tests/test_interlace.bash rename to tests/test_interlace.sh index 58a1c875..3a61e842 100755 --- a/tests/test_interlace.bash +++ b/tests/test_interlace.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh set -eu -source util.bash +. "${0%/*}/util.sh" valgrind_test 264x130 10 --source-scan-type=tff -p0 --preset=ultrafast --threads=2 --owf=1 --wpp diff --git a/tests/test_intra.bash b/tests/test_intra.sh similarity index 88% rename from tests/test_intra.bash rename to tests/test_intra.sh index 49f520d1..9215ab29 100755 --- a/tests/test_intra.bash +++ b/tests/test_intra.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh # Test all-intra coding. set -eu -source util.bash +. "${0%/*}/util.sh" common_args='264x130 10 -p1 --threads=2 --owf=1 --no-rdoq --no-deblock --no-sao --no-signhide' valgrind_test $common_args --rd=1 diff --git a/tests/test_invalid_input.bash b/tests/test_invalid_input.sh similarity index 72% rename from tests/test_invalid_input.bash rename to tests/test_invalid_input.sh index a00a9811..b7cf7369 100755 --- a/tests/test_invalid_input.bash +++ b/tests/test_invalid_input.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/sh # Test trying to use invalid input dimensions. set -eu -source util.bash +. "${0%/*}/util.sh" encode_test 1x65 1 1 diff --git a/tests/test_mv_constraint.bash b/tests/test_mv_constraint.sh similarity index 88% rename from tests/test_mv_constraint.bash rename to tests/test_mv_constraint.sh index 8b31c1d6..52882a4a 100755 --- a/tests/test_mv_constraint.bash +++ b/tests/test_mv_constraint.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh set -eu -source util.bash +. "${0%/*}/util.sh" valgrind_test 264x130 10 --threads=2 --owf=1 --preset=ultrafast --pu-depth-inter=0-3 --mv-constraint=frametilemargin valgrind_test 264x130 10 --threads=2 --owf=1 --preset=ultrafast --subme=4 --mv-constraint=frametilemargin diff --git a/tests/test_owf_wpp_tiles.bash b/tests/test_owf_wpp_tiles.sh similarity index 96% rename from tests/test_owf_wpp_tiles.bash rename to tests/test_owf_wpp_tiles.sh index 174df2fe..d479c9e3 100755 --- a/tests/test_owf_wpp_tiles.bash +++ b/tests/test_owf_wpp_tiles.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/sh # Test OWF, WPP and tiles. There is lots of separate branches of code # related to owf == 0 and owf != 0, which is why all permutations are # tried. set -eu -source util.bash +. "${0%/*}/util.sh" common_args='-p4 --rd=0 --no-rdoq --no-deblock --no-sao --no-signhide --subme=0 --pu-depth-inter=1-3 --pu-depth-intra=2-3' valgrind_test 264x130 10 $common_args -r1 --owf=1 --threads=0 --no-wpp diff --git a/tests/test_rate_control.bash b/tests/test_rate_control.sh similarity index 86% rename from tests/test_rate_control.bash rename to tests/test_rate_control.sh index 6db206b1..95c68f0e 100755 --- a/tests/test_rate_control.bash +++ b/tests/test_rate_control.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh set -eu -source util.bash +. "${0%/*}/util.sh" valgrind_test 264x130 10 --bitrate=500000 -p0 -r1 --owf=1 --threads=2 --rd=0 --no-rdoq --no-deblock --no-sao --no-signhide --subme=0 --pu-depth-inter=1-3 --pu-depth-intra=2-3 diff --git a/tests/test_slices.bash b/tests/test_slices.sh similarity index 85% rename from tests/test_slices.bash rename to tests/test_slices.sh index 26c38a11..d7e34b46 100755 --- a/tests/test_slices.bash +++ b/tests/test_slices.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh set -eu -source util.bash +. "${0%/*}/util.sh" valgrind_test 512x256 10 --threads=2 --owf=1 --preset=ultrafast --tiles=2x2 --slices=tiles valgrind_test 264x130 10 --threads=2 --owf=1 --preset=ultrafast --slices=wpp diff --git a/tests/test_smp.bash b/tests/test_smp.sh similarity index 87% rename from tests/test_smp.bash rename to tests/test_smp.sh index 7b80c6fd..1e3d92ed 100755 --- a/tests/test_smp.bash +++ b/tests/test_smp.sh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh # Test SMP and AMP blocks. set -eu -source util.bash +. "${0%/*}/util.sh" valgrind_test 264x130 4 --threads=2 --owf=1 --wpp --smp valgrind_test 264x130 4 --threads=2 --owf=1 --wpp --amp diff --git a/tests/test_tools.bash b/tests/test_tools.sh similarity index 92% rename from tests/test_tools.bash rename to tests/test_tools.sh index a6d6fd93..e6e02542 100755 --- a/tests/test_tools.bash +++ b/tests/test_tools.sh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh # Test RDOQ, SAO, deblock and signhide and subme. set -eu -source util.bash +. "${0%/*}/util.sh" common_args='264x130 10 -p0 -r1 --threads=2 --wpp --owf=1 --rd=0' diff --git a/tests/test_weird_shapes.bash b/tests/test_weird_shapes.sh similarity index 86% rename from tests/test_weird_shapes.bash rename to tests/test_weird_shapes.sh index d4a3b8f5..99a2504b 100755 --- a/tests/test_weird_shapes.bash +++ b/tests/test_weird_shapes.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh set -eu -source util.bash +. "${0%/*}/util.sh" valgrind_test 16x16 10 --threads=2 --owf=1 --preset=veryslow valgrind_test 256x16 10 --threads=2 --owf=1 --preset=veryslow diff --git a/tests/util.bash b/tests/util.sh similarity index 80% rename from tests/util.bash rename to tests/util.sh index bd74a6c5..89a1e0fc 100644 --- a/tests/util.bash +++ b/tests/util.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/bin/sh # Helper functions for test scripts. -set -euo pipefail +set -eu${BASH+o pipefail} # Temporary files for encoder input and output. -yuvfile="$(mktemp --tmpdir tmp.XXXXXXXXXX.yuv)" -hevcfile="$(mktemp --tmpdir tmp.XXXXXXXXXX.hevc)" +yuvfile="$(mktemp)" +hevcfile="$(mktemp)" cleanup() { - rm -rf ${yuvfile} ${hevcfile} + rm -rf "${yuvfile}" "${hevcfile}" } trap cleanup EXIT @@ -22,7 +22,7 @@ prepare() { cleanup print_and_run \ ffmpeg -f lavfi -i "mandelbrot=size=${1}" \ - -vframes "${2}" -pix_fmt yuv420p \ + -vframes "${2}" -pix_fmt yuv420p -f yuv4mpegpipe \ "${yuvfile}" } @@ -61,5 +61,5 @@ encode_test() { ../src/kvazaar -i "${yuvfile}" "--input-res=${dimensions}" -o "${hevcfile}" "$@" actual_status="$?" set -e - [[ ${actual_status} = ${expected_status} ]] + [ ${actual_status} -eq ${expected_status} ] }