diff options
author | Hui Wang <hui.wang@canonical.com> | 2015-05-25 20:05:30 +0800 |
---|---|---|
committer | David Henningsson <david.henningsson@canonical.com> | 2015-05-25 14:35:34 +0200 |
commit | a7d41ef0439fe86466c96428af689145b513b913 (patch) | |
tree | f0437433ec1ff21c718c8a06b0c5b1d4ec27e51d /src/tests | |
parent | fec553170a02deff1c612e8d1d67818c749af074 (diff) |
tests: add tolerant variation for comparing the rewind result
On 32bits OS, this test case fails. The reason is when rewinding to
the middle of a block, some of float parameters in the saved_state
are stored in the memory from FPU registers, and those parameters will
be used for next time to process data with lfe. Here if FPU register
is over 32bits, the storing from FPU register to memory will introduce
some variation, and this small variation will introduce small
variation to the rewinding result.
So adding the tolerant variation for comparing the rewind result, make
this test case can work on both 64bits OS and 32bits OS.
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/lfe-filter-test.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tests/lfe-filter-test.c b/src/tests/lfe-filter-test.c index 2c6d5979b..ea8108c25 100644 --- a/src/tests/lfe-filter-test.c +++ b/src/tests/lfe-filter-test.c @@ -37,6 +37,7 @@ static uint8_t *ori_sample_ptr; #define ONE_BLOCK_SAMPLES 4096 #define TOTAL_SAMPLES 8192 +#define TOLERANT_VARIATION 1 static void save_data_block(struct lfe_filter_test *lft, void *d, pa_memblock *blk) { uint8_t *dst = d, *src; @@ -63,11 +64,12 @@ static pa_memblock* generate_data_block(struct lfe_filter_test *lft, int start) static int compare_data_block(struct lfe_filter_test *lft, void *a, void *b) { int ret = 0; uint32_t i; - uint32_t fz = pa_frame_size(lft->ss); - uint8_t *r = a, *u = b; + uint16_t *r = a, *u = b; + + pa_assert(lft->ss->format == PA_SAMPLE_S16NE); - for (i = 0; i < ONE_BLOCK_SAMPLES * fz; i++) { - if (*r++ != *u++) { + for (i = 0; i < ONE_BLOCK_SAMPLES; i++) { + if (abs(*r++ - *u++) > TOLERANT_VARIATION) { pa_log_error("lfe-filter-test: test failed, the output data in the position 0x%x of a block does not equal!\n", i); ret = -1; break; |