[vlc-commits] [Git][videolan/vlc][master] 3 commits: test: factor environment setup in separate function

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri May 31 09:13:04 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c0a25700 by Alexandre Janniaux at 2024-05-31T08:52:12+00:00
test: factor environment setup in separate function

- - - - -
78c1c5c8 by Alexandre Janniaux at 2024-05-31T08:52:12+00:00
test: keystore: use test_setup for environment

Using relative path for plugin path leads to the test failing to launch
depending on where it is being launched from.

- - - - -
8f09a0c4 by Alexandre Janniaux at 2024-05-31T08:52:12+00:00
test: meson.build: add dependency to keystore modules

The memory and file keystore are always used when running the test from
meson, so ensure they are built before.

- - - - -


3 changed files:

- test/libvlc/test.h
- test/modules/keystore/test.c
- test/src/meson.build


Changes:

=====================================
test/libvlc/test.h
=====================================
@@ -63,6 +63,12 @@ static const char test_default_sample[] = "mock://";
 
 #define test_log( ... ) printf( "testapi: " __VA_ARGS__ );
 
+static inline void test_setup(void)
+{
+    setenv("VLC_PLUGIN_PATH", TOP_BUILDDIR"/modules", 1);
+    setenv("VLC_LIB_PATH", TOP_BUILDDIR, 1);
+}
+
 static inline void test_init (void)
 {
     (void)test_default_sample; /* This one may not be used */
@@ -84,8 +90,7 @@ static inline void test_init (void)
     if (alarm_timeout != 0)
         alarm (alarm_timeout);
 
-    setenv( "VLC_PLUGIN_PATH", TOP_BUILDDIR"/modules", 1 );
-    setenv( "VLC_LIB_PATH", TOP_BUILDDIR, 1 );
+    test_setup();
 }
 
 #endif /* TEST_H */


=====================================
test/modules/keystore/test.c
=====================================
@@ -35,6 +35,8 @@
 #undef NDEBUG
 #include <assert.h>
 
+#include "libvlc/test.h"
+
 /*
  * Build and exec all keystore tests:
  * $ cd vlc/build-<name>/test
@@ -297,14 +299,14 @@ test_module(const char *psz_module, bool b_test_all, bool b_persistent,
 int
 main(int i_argc, char *ppsz_argv[])
 {
+    test_setup();
+
     /* If b_test_all is true, this test could pollute the developer´s keystores */
     bool b_test_all = i_argc > 1 && strcmp(ppsz_argv[1], "-a") == 0;
 
     if (!b_test_all)
         alarm(3);
 
-    setenv("VLC_PLUGIN_PATH", "../modules", 1);
-
     /* Create a dummy libvlc to initialize module bank, needed by module_exists */
     libvlc_instance_t *p_libvlc = libvlc_new(0, NULL);
     assert(p_libvlc != NULL);


=====================================
test/src/meson.build
=====================================
@@ -147,6 +147,7 @@ vlc_tests += {
     'sources' : files('misc/keystore.c'),
     'suite' : ['src', 'test_src'],
     'link_with' : [libvlc, libvlccore],
+    'module_depends' : ['memory_keystore', 'file_keystore'],
 }
 
 if host_system == 'darwin'



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cfd0fbf58a12cd09fd16929c7f2072c9f2d0a30f...8f09a0c410bb8a4293f14a5339fa1644dd5b741c

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cfd0fbf58a12cd09fd16929c7f2072c9f2d0a30f...8f09a0c410bb8a4293f14a5339fa1644dd5b741c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list