rtmpdh: Do global initialization before running the test

Message ID 1479936908-25956-1-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Nov. 23, 2016, 9:35 p.m.
The rtmpdh code can use crypto libraries which may require
a process global init. (gcrypt is one of the libraries
where the rtmpdh test code can fail if global init hasn't been
done, depending on gcrypt version.)
---
 libavformat/tests/rtmpdh.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Luca Barbato Nov. 24, 2016, 12:02 a.m. | #1
On 23/11/2016 22:35, Martin Storsjö wrote:
> The rtmpdh code can use crypto libraries which may require
> a process global init. (gcrypt is one of the libraries
> where the rtmpdh test code can fail if global init hasn't been
> done, depending on gcrypt version.)
> ---
>  libavformat/tests/rtmpdh.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/tests/rtmpdh.c b/libavformat/tests/rtmpdh.c
> index c25ca91..be7ea5a 100644
> --- a/libavformat/tests/rtmpdh.c
> +++ b/libavformat/tests/rtmpdh.c
> @@ -17,6 +17,7 @@
>   */
>  
>  #include "libavformat/rtmpdh.c"
> +#include "libavformat/avformat.h"
>  
>  #include <stdio.h>
>  
> @@ -150,6 +151,7 @@ fail:
>  
>  int main(void)
>  {
> +    avformat_network_init();
>      if (test_random_shared_secret() < 0)
>          return 1;
>      if (test_ref_data() < 0)
> 

Sure.
Diego Biurrun Nov. 24, 2016, 9:34 a.m. | #2
On Wed, Nov 23, 2016 at 11:35:08PM +0200, Martin Storsjö wrote:
> The rtmpdh code can use crypto libraries which may require
> a process global init. (gcrypt is one of the libraries
> where the rtmpdh test code can fail if global init hasn't been
> done, depending on gcrypt version.)
> ---
>  libavformat/tests/rtmpdh.c | 2 ++
>  1 file changed, 2 insertions(+)

As you predicted, this does not fail my particular test case.

> --- a/libavformat/tests/rtmpdh.c
> +++ b/libavformat/tests/rtmpdh.c
> @@ -17,6 +17,7 @@
>  
>  #include "libavformat/rtmpdh.c"
> +#include "libavformat/avformat.h"

nit: order

> @@ -150,6 +151,7 @@ fail:
>  
>  int main(void)
>  {
> +    avformat_network_init();
>      if (test_random_shared_secret() < 0)
>          return 1;
>      if (test_ref_data() < 0)

LGTM

Please push to the 12 branch as well.

Diego

Patch

diff --git a/libavformat/tests/rtmpdh.c b/libavformat/tests/rtmpdh.c
index c25ca91..be7ea5a 100644
--- a/libavformat/tests/rtmpdh.c
+++ b/libavformat/tests/rtmpdh.c
@@ -17,6 +17,7 @@ 
  */
 
 #include "libavformat/rtmpdh.c"
+#include "libavformat/avformat.h"
 
 #include <stdio.h>
 
@@ -150,6 +151,7 @@  fail:
 
 int main(void)
 {
+    avformat_network_init();
     if (test_random_shared_secret() < 0)
         return 1;
     if (test_ref_data() < 0)