Merge branch 'fix-tests'

This commit is contained in:
Arttu Ylä-Outinen 2015-07-17 10:47:13 +03:00
commit 97cd5600b4
5 changed files with 36 additions and 12 deletions

View file

@ -1,12 +1,20 @@
#!/bin/sh
set -ev
if [ -z "$VALGRIND_TEST" ]; then
cd src
make
make tests
else
if [ -n "$VALGRIND_TEST" ]; then
cd src
make debug
valgrind --leak-check=full --error-exitcode=1 ./kvazaar_debug -i ../mandelbrot_${TEST_DIM}.yuv --input-res=${TEST_DIM} -o /dev/null $VALGRIND_TEST
elif [ -n "$EXPECTED_STATUS" ]; then
cd src
make
set +e
./kvazaar $PARAMS
EXIT_STATUS=$?
set -e
[ "$EXIT_STATUS" = "$EXPECTED_STATUS" ]
else
cd src
make
make tests
fi

View file

@ -53,6 +53,9 @@ matrix:
- env: TEST_FRAMES=20 VALGRIND_TEST="--gop=8 -p0 --threads=2 --wpp --owf=1 --rd=0 --no-rdoq --no-deblock --no-sao --no-signhide --subme=0 --pu-depth-inter=1-3 --pu-depth-intra=2-3"
- env: TEST_FRAMES=20 VALGRIND_TEST="--gop=8 -p0 --threads=2 --wpp --owf=0 --rd=0 --no-rdoq --no-deblock --no-sao --no-signhide --subme=0 --pu-depth-inter=1-3 --pu-depth-intra=2-3"
# Tests trying to use invalid input dimensions
- env: EXPECTED_STATUS=1 PARAMS="-i kvazaar --input-res=1x65 -o /dev/null"
before_install:
# Work around a weird bug in Travis-ci, where compiler is set wrong.
- if [ "$CC" = "[gcc]" ]; then export CC=gcc; gcc --version; fi

View file

@ -210,7 +210,7 @@ debug: CFLAGS := $(filter-out -O3 -O2 -flto, $(CFLAGS))
debug: $(DEBUG)
tests: build_tests
$(TESTS)
./$(TESTS)
build_tests: CFLAGS := $(filter-out -Werror, $(CFLAGS))
build_tests: init_submodules $(TESTS)

View file

@ -460,7 +460,22 @@ int config_validate(const kvz_config *const cfg)
int error = 0;
if (cfg->width <= 0) {
fprintf(stderr, "Input error: width is not positive\n");
fprintf(stderr, "Input error: width must be positive\n");
error = 1;
}
if (cfg->height <= 0) {
fprintf(stderr, "Input error: height must be positive\n");
error = 1;
}
if (cfg->width % 2 != 0) {
fprintf(stderr, "Input error: width must be a multiple of two\n");
error = 1;
}
if (cfg->height % 2 != 0) {
fprintf(stderr, "Input error: height must be a multiple of two\n");
error = 1;
}
@ -469,11 +484,6 @@ int config_validate(const kvz_config *const cfg)
error = 1;
}
if (cfg->height <= 0) {
fprintf(stderr, "Input error: height is not positive\n");
error = 1;
}
if (cfg->gop_len &&
cfg->intra_period &&
cfg->intra_period % cfg->gop_len != 0) {

View file

@ -85,6 +85,9 @@ int yuv_io_read(FILE* file,
unsigned input_width, unsigned input_height,
kvz_picture *img_out)
{
assert(input_width % 2 == 0);
assert(input_height % 2 == 0);
const unsigned y_size = input_width * input_height;
const unsigned uv_input_width = input_width / 2;
const unsigned uv_input_height = input_height / 2;