summaryrefslogtreecommitdiff
path: root/tests/test_opus_decode.c
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2011-12-14 02:03:50 -0500
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-01-25 12:04:17 +1300
commita26b2be2f922502b821e81e2cb084393f1ccf405 (patch)
tree0e56888cad2cc7bf3bcfd09dbd7284aded2755ce /tests/test_opus_decode.c
parent286f11efeaad88aec51559cd423322c3ab8206bc (diff)
downloadopus-a26b2be2f922502b821e81e2cb084393f1ccf405.tar.gz
Improvements to the tests, add a TEST_OPUS_NOFUZZ to disable testing corrupted input.
No changes to the codec itself.
Diffstat (limited to 'tests/test_opus_decode.c')
-rw-r--r--tests/test_opus_decode.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_opus_decode.c b/tests/test_opus_decode.c
index b2f78e31..8f37ddc0 100644
--- a/tests/test_opus_decode.c
+++ b/tests/test_opus_decode.c
@@ -44,7 +44,7 @@
#define MAX_FRAME_SAMP (5760)
extern int jackpot;
-int test_decoder_code0(void)
+int test_decoder_code0(int no_fuzz)
{
static const opus_int32 fsv[5]={48000,24000,16000,12000,8000};
int err,skip,plen;
@@ -239,6 +239,16 @@ int test_decoder_code0(void)
fprintf(stdout," dec[%3d] all 3-byte prefix for length 4, mode %2d OK.\n",t,lmodes[mode]);
}
+ if(no_fuzz)
+ {
+ fprintf(stdout," Skipping many tests which fuzz the decoder as requested.\n");
+ for(t=0;t<5*2;t++)opus_decoder_destroy(dec[t]);
+ printf(" Decoders stopped.\n");
+ free(outbuf_int);
+ free(packet);
+ return 0;
+ }
+
skip=fast_rand()%7;
for(i=0;i<64;i++)
{
@@ -360,7 +370,10 @@ int main(int _argc, char **_argv)
fprintf(stderr,"Testing %s decoder. Random seed: %u (%.4X)\n", oversion, iseed, fast_rand() % 65535);
if(env_used)fprintf(stderr," Random seed set from the environment (SEED=%s).\n", env_seed);
- test_decoder_code0();
+ /*Setting TEST_OPUS_NOFUZZ tells the tool not to send garbage data
+ into the decoders. This is helpful because garbage data
+ may cause the decoders to clip, which angers CLANG IOC.*/
+ test_decoder_code0(getenv("TEST_OPUS_NOFUZZ")!=NULL);
return 0;
}