Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add unit tests.
On Tue, Jun 26, 2018 at 09:28:01AM -0700, Jacob Trimble wrote: > On Mon, Jun 25, 2018 at 5:30 PM Michael Niedermayer > wrote: > > > > On Fri, Jun 01, 2018 at 12:51:48PM -0700, Jacob Trimble wrote: > > > Signed-off-by: Jacob Trimble > > > --- > > > libavutil/Makefile| 1 + > > > libavutil/encryption_info.h | 2 +- > > > libavutil/tests/.gitignore| 2 + > > > libavutil/tests/encryption_info.c | 176 ++ > > > tests/fate/libavutil.mak | 4 + > > > tests/ref/fate/encryption-info| 0 > > > 6 files changed, 184 insertions(+), 1 deletion(-) > > > create mode 100644 libavutil/tests/encryption_info.c > > > create mode 100644 tests/ref/fate/encryption-info > > > > > > diff --git a/libavutil/Makefile b/libavutil/Makefile > > > index d0632f16a6..9ed24cfc82 100644 > > > --- a/libavutil/Makefile > > > +++ b/libavutil/Makefile > > > @@ -200,6 +200,7 @@ TESTPROGS = adler32 > > > \ > > > des \ > > > dict\ > > > display \ > > > +encryption_info \ > > > error \ > > > eval\ > > > file\ > > > > > diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h > > > index 9140968fde..8fe7ebfe43 100644 > > > --- a/libavutil/encryption_info.h > > > +++ b/libavutil/encryption_info.h > > > @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo { > > > * > > > * @param subsample_count The number of subsamples. > > > * @param key_id_size The number of bytes in the key ID, should be 16. > > > - * @param key_id_size The number of bytes in the IV, should be 16. > > > + * @param iv_size The number of bytes in the IV, should be 16. > > > * > > > * @return The new AVEncryptionInfo structure, or NULL on error. > > > */ > > > > How is this related to adding a test ? > > > > I guess it's unrelated, created a separate patch for it. > > > > > > > > diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore > > > index 71f75a8ee9..9d90827954 100644 > > > --- a/libavutil/tests/.gitignore > > > +++ b/libavutil/tests/.gitignore > > > @@ -17,6 +17,7 @@ > > > /dict > > > /display > > > /error > > > +/encryption_info > > > /eval > > > /fifo > > > /file > > > > > @@ -24,6 +25,7 @@ > > > /hmac > > > /hwdevice > > > /imgutils > > > +/integer > > > /lfg > > > /lls > > > /log > > > > this also looks unrelated > > Same. > > > > > > > [...] > > -- > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > Opposition brings concord. Out of discord comes the fairest harmony. > > -- Heraclitus > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > libavutil/Makefile|1 > libavutil/tests/.gitignore|1 > libavutil/tests/encryption_info.c | 176 > ++ > tests/fate/libavutil.mak |4 > tests/ref/fate/encryption-info|1 > 5 files changed, 182 insertions(+), 1 deletion(-) > 11d60eb571de4510ecbd313cacfaff2e6d89b16e > 0001-libavutil-encryption_info-Add-unit-tests-v2.patch > From c97e44904020944e469faec18b9c279cb6d89b46 Mon Sep 17 00:00:00 2001 > From: Jacob Trimble > Date: Fri, 1 Jun 2018 11:38:05 -0700 > Subject: [PATCH] libavutil/encryption_info: Add unit tests. > > Signed-off-by: Jacob Trimble > --- > libavutil/Makefile| 1 + > libavutil/tests/.gitignore| 1 + > libavutil/tests/encryption_info.c | 176 ++ > tests/fate/libavutil.mak | 4 + > tests/ref/fate/encryption-info| 0 > 5 files changed, 182 insertions(+) > create mode 100644 libavutil/tests/encryption_info.c > create mode 100644 tests/ref/fate/encryption-info will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add unit tests.
On Mon, Jun 25, 2018 at 5:30 PM Michael Niedermayer wrote: > > On Fri, Jun 01, 2018 at 12:51:48PM -0700, Jacob Trimble wrote: > > Signed-off-by: Jacob Trimble > > --- > > libavutil/Makefile| 1 + > > libavutil/encryption_info.h | 2 +- > > libavutil/tests/.gitignore| 2 + > > libavutil/tests/encryption_info.c | 176 ++ > > tests/fate/libavutil.mak | 4 + > > tests/ref/fate/encryption-info| 0 > > 6 files changed, 184 insertions(+), 1 deletion(-) > > create mode 100644 libavutil/tests/encryption_info.c > > create mode 100644 tests/ref/fate/encryption-info > > > > diff --git a/libavutil/Makefile b/libavutil/Makefile > > index d0632f16a6..9ed24cfc82 100644 > > --- a/libavutil/Makefile > > +++ b/libavutil/Makefile > > @@ -200,6 +200,7 @@ TESTPROGS = adler32 > > \ > > des \ > > dict\ > > display \ > > +encryption_info \ > > error \ > > eval\ > > file\ > > > diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h > > index 9140968fde..8fe7ebfe43 100644 > > --- a/libavutil/encryption_info.h > > +++ b/libavutil/encryption_info.h > > @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo { > > * > > * @param subsample_count The number of subsamples. > > * @param key_id_size The number of bytes in the key ID, should be 16. > > - * @param key_id_size The number of bytes in the IV, should be 16. > > + * @param iv_size The number of bytes in the IV, should be 16. > > * > > * @return The new AVEncryptionInfo structure, or NULL on error. > > */ > > How is this related to adding a test ? > I guess it's unrelated, created a separate patch for it. > > > > diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore > > index 71f75a8ee9..9d90827954 100644 > > --- a/libavutil/tests/.gitignore > > +++ b/libavutil/tests/.gitignore > > @@ -17,6 +17,7 @@ > > /dict > > /display > > /error > > +/encryption_info > > /eval > > /fifo > > /file > > > @@ -24,6 +25,7 @@ > > /hmac > > /hwdevice > > /imgutils > > +/integer > > /lfg > > /lls > > /log > > this also looks unrelated Same. > > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Opposition brings concord. Out of discord comes the fairest harmony. > -- Heraclitus > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel From c97e44904020944e469faec18b9c279cb6d89b46 Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Fri, 1 Jun 2018 11:38:05 -0700 Subject: [PATCH] libavutil/encryption_info: Add unit tests. Signed-off-by: Jacob Trimble --- libavutil/Makefile| 1 + libavutil/tests/.gitignore| 1 + libavutil/tests/encryption_info.c | 176 ++ tests/fate/libavutil.mak | 4 + tests/ref/fate/encryption-info| 0 5 files changed, 182 insertions(+) create mode 100644 libavutil/tests/encryption_info.c create mode 100644 tests/ref/fate/encryption-info diff --git a/libavutil/Makefile b/libavutil/Makefile index d0632f16a6..9ed24cfc82 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -200,6 +200,7 @@ TESTPROGS = adler32 \ des \ dict\ display \ +encryption_info \ error \ eval\ file\ diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore index 71f75a8ee9..d7de295617 100644 --- a/libavutil/tests/.gitignore +++ b/libavutil/tests/.gitignore @@ -17,6 +17,7 @@ /dict /display /error +/encryption_info /eval /fifo /file diff --git a/libavutil/tests/encryption_info.c b/libavutil/tests/encryption_info.c new file mode 100644 index 00..d489612b7d --- /dev/null +++ b/libavutil/tests/encryption_info.c @@ -0,0 +1,176 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the
Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add unit tests.
On Fri, Jun 01, 2018 at 12:51:48PM -0700, Jacob Trimble wrote: > Signed-off-by: Jacob Trimble > --- > libavutil/Makefile| 1 + > libavutil/encryption_info.h | 2 +- > libavutil/tests/.gitignore| 2 + > libavutil/tests/encryption_info.c | 176 ++ > tests/fate/libavutil.mak | 4 + > tests/ref/fate/encryption-info| 0 > 6 files changed, 184 insertions(+), 1 deletion(-) > create mode 100644 libavutil/tests/encryption_info.c > create mode 100644 tests/ref/fate/encryption-info > > diff --git a/libavutil/Makefile b/libavutil/Makefile > index d0632f16a6..9ed24cfc82 100644 > --- a/libavutil/Makefile > +++ b/libavutil/Makefile > @@ -200,6 +200,7 @@ TESTPROGS = adler32 > \ > des \ > dict\ > display \ > +encryption_info \ > error \ > eval\ > file\ > diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h > index 9140968fde..8fe7ebfe43 100644 > --- a/libavutil/encryption_info.h > +++ b/libavutil/encryption_info.h > @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo { > * > * @param subsample_count The number of subsamples. > * @param key_id_size The number of bytes in the key ID, should be 16. > - * @param key_id_size The number of bytes in the IV, should be 16. > + * @param iv_size The number of bytes in the IV, should be 16. > * > * @return The new AVEncryptionInfo structure, or NULL on error. > */ How is this related to adding a test ? > diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore > index 71f75a8ee9..9d90827954 100644 > --- a/libavutil/tests/.gitignore > +++ b/libavutil/tests/.gitignore > @@ -17,6 +17,7 @@ > /dict > /display > /error > +/encryption_info > /eval > /fifo > /file > @@ -24,6 +25,7 @@ > /hmac > /hwdevice > /imgutils > +/integer > /lfg > /lls > /log this also looks unrelated [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add unit tests.
Now that the patches have been merged this doesn't depend on anything. On Fri, Jun 1, 2018 at 12:54 PM Jacob Trimble wrote: > On Fri, Jun 1, 2018 at 12:52 PM Jacob Trimble wrote: > > > > Signed-off-by: Jacob Trimble > > --- > > libavutil/Makefile| 1 + > > libavutil/encryption_info.h | 2 +- > > libavutil/tests/.gitignore| 2 + > > libavutil/tests/encryption_info.c | 176 ++ > > tests/fate/libavutil.mak | 4 + > > tests/ref/fate/encryption-info| 0 > > 6 files changed, 184 insertions(+), 1 deletion(-) > > create mode 100644 libavutil/tests/encryption_info.c > > create mode 100644 tests/ref/fate/encryption-info > > > > diff --git a/libavutil/Makefile b/libavutil/Makefile > > index d0632f16a6..9ed24cfc82 100644 > > --- a/libavutil/Makefile > > +++ b/libavutil/Makefile > > @@ -200,6 +200,7 @@ TESTPROGS = adler32 >\ > > des > \ > > dict > \ > > display > \ > > +encryption_info > \ > > error > \ > > eval > \ > > file > \ > > diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h > > index 9140968fde..8fe7ebfe43 100644 > > --- a/libavutil/encryption_info.h > > +++ b/libavutil/encryption_info.h > > @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo { > > * > > * @param subsample_count The number of subsamples. > > * @param key_id_size The number of bytes in the key ID, should be 16. > > - * @param key_id_size The number of bytes in the IV, should be 16. > > + * @param iv_size The number of bytes in the IV, should be 16. > > * > > * @return The new AVEncryptionInfo structure, or NULL on error. > > */ > > diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore > > index 71f75a8ee9..9d90827954 100644 > > --- a/libavutil/tests/.gitignore > > +++ b/libavutil/tests/.gitignore > > @@ -17,6 +17,7 @@ > > /dict > > /display > > /error > > +/encryption_info > > /eval > > /fifo > > /file > > @@ -24,6 +25,7 @@ > > /hmac > > /hwdevice > > /imgutils > > +/integer > > /lfg > > /lls > > /log > > diff --git a/libavutil/tests/encryption_info.c > b/libavutil/tests/encryption_info.c > > new file mode 100644 > > index 00..d489612b7d > > --- /dev/null > > +++ b/libavutil/tests/encryption_info.c > > @@ -0,0 +1,176 @@ > > +/* > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * version 2.1 of the License, or (at your option) any later version. > > + * > > + * FFmpeg is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * Lesser General Public License for more details. > > + * > > + * You should have received a copy of the GNU Lesser General Public > > + * License along with FFmpeg; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > 02110-1301 USA > > + */ > > + > > +#include "libavutil/encryption_info.h" > > + > > +#include > > +#include > > + > > +#include "libavutil/avassert.h" > > + > > +static const AVSubsampleEncryptionInfo test_subsamples[] = {{1, 2}, {3, > 4}, {5, 6}, {7, 8}}; > > +static const size_t test_subsample_count = sizeof(test_subsamples) / > sizeof(test_subsamples[0]); > > +static const uint8_t test_iv[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, > 0x17, 0x18}; > > +static const uint8_t test_key_id[] = {0x21, 0x22, 0x23, 0x24}; > > +static const uint8_t test_key_id_2[] = {0x31, 0x32, 0x33, 0x34}; > > +static const uint8_t test_system_id[] = {0x41, 0x42, 0x43}; > > +static const uint8_t test_data[] = {0x51, 0x52}; > > + > > +static int compare_encryption_info(const AVEncryptionInfo *a, const > AVEncryptionInfo *b) { > > +if (!a || !b || a->scheme != b->scheme || a->crypt_byte_block != > b->crypt_byte_block || > > +a->skip_byte_block != b->skip_byte_block || a->key_id_size != > b->key_id_size || > > +a->iv_size != b->iv_size || a->subsample_count != > b->subsample_count) > > +return 1; > > + > > +if (memcmp(a->key_id, b->key_id, a->key_id_size) != 0 || > > +memcmp(a->iv, b->iv, a->iv_size) != 0 || > > +memcmp(a->subsamples, b->subsamples, a->subsample_count * > sizeof(a->subsamples[0]))) > > +return 1; > > + > > +return 0; > > +} > > + > > +static int compare_encryption_init_info(const AVEncryptionInitInfo *a, > const AVEncryptionInitInfo *b) { > > +if (!a || !b || a->system_id_size != b->system_id_size || > > +a->num_key_ids != b->num_key_ids || a->key_id_size != > b->key_id_size || > > +a->data_size != b->data_size) > > +return 1; > > + > > +if (memcmp(a->system_id,
Re: [FFmpeg-devel] [PATCH] libavutil/encryption_info: Add unit tests.
On Fri, Jun 1, 2018 at 12:52 PM Jacob Trimble wrote: > > Signed-off-by: Jacob Trimble > --- > libavutil/Makefile| 1 + > libavutil/encryption_info.h | 2 +- > libavutil/tests/.gitignore| 2 + > libavutil/tests/encryption_info.c | 176 ++ > tests/fate/libavutil.mak | 4 + > tests/ref/fate/encryption-info| 0 > 6 files changed, 184 insertions(+), 1 deletion(-) > create mode 100644 libavutil/tests/encryption_info.c > create mode 100644 tests/ref/fate/encryption-info > > diff --git a/libavutil/Makefile b/libavutil/Makefile > index d0632f16a6..9ed24cfc82 100644 > --- a/libavutil/Makefile > +++ b/libavutil/Makefile > @@ -200,6 +200,7 @@ TESTPROGS = adler32 > \ > des \ > dict\ > display \ > +encryption_info \ > error \ > eval\ > file\ > diff --git a/libavutil/encryption_info.h b/libavutil/encryption_info.h > index 9140968fde..8fe7ebfe43 100644 > --- a/libavutil/encryption_info.h > +++ b/libavutil/encryption_info.h > @@ -129,7 +129,7 @@ typedef struct AVEncryptionInitInfo { > * > * @param subsample_count The number of subsamples. > * @param key_id_size The number of bytes in the key ID, should be 16. > - * @param key_id_size The number of bytes in the IV, should be 16. > + * @param iv_size The number of bytes in the IV, should be 16. > * > * @return The new AVEncryptionInfo structure, or NULL on error. > */ > diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore > index 71f75a8ee9..9d90827954 100644 > --- a/libavutil/tests/.gitignore > +++ b/libavutil/tests/.gitignore > @@ -17,6 +17,7 @@ > /dict > /display > /error > +/encryption_info > /eval > /fifo > /file > @@ -24,6 +25,7 @@ > /hmac > /hwdevice > /imgutils > +/integer > /lfg > /lls > /log > diff --git a/libavutil/tests/encryption_info.c > b/libavutil/tests/encryption_info.c > new file mode 100644 > index 00..d489612b7d > --- /dev/null > +++ b/libavutil/tests/encryption_info.c > @@ -0,0 +1,176 @@ > +/* > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "libavutil/encryption_info.h" > + > +#include > +#include > + > +#include "libavutil/avassert.h" > + > +static const AVSubsampleEncryptionInfo test_subsamples[] = {{1, 2}, {3, 4}, > {5, 6}, {7, 8}}; > +static const size_t test_subsample_count = sizeof(test_subsamples) / > sizeof(test_subsamples[0]); > +static const uint8_t test_iv[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, > 0x18}; > +static const uint8_t test_key_id[] = {0x21, 0x22, 0x23, 0x24}; > +static const uint8_t test_key_id_2[] = {0x31, 0x32, 0x33, 0x34}; > +static const uint8_t test_system_id[] = {0x41, 0x42, 0x43}; > +static const uint8_t test_data[] = {0x51, 0x52}; > + > +static int compare_encryption_info(const AVEncryptionInfo *a, const > AVEncryptionInfo *b) { > +if (!a || !b || a->scheme != b->scheme || a->crypt_byte_block != > b->crypt_byte_block || > +a->skip_byte_block != b->skip_byte_block || a->key_id_size != > b->key_id_size || > +a->iv_size != b->iv_size || a->subsample_count != b->subsample_count) > +return 1; > + > +if (memcmp(a->key_id, b->key_id, a->key_id_size) != 0 || > +memcmp(a->iv, b->iv, a->iv_size) != 0 || > +memcmp(a->subsamples, b->subsamples, a->subsample_count * > sizeof(a->subsamples[0]))) > +return 1; > + > +return 0; > +} > + > +static int compare_encryption_init_info(const AVEncryptionInitInfo *a, const > AVEncryptionInitInfo *b) { > +if (!a || !b || a->system_id_size != b->system_id_size || > +a->num_key_ids != b->num_key_ids || a->key_id_size != b->key_id_size > || > +a->data_size != b->data_size) > +return 1; > + > +