tests: assert mandatory values are present
authorLuca BRUNO <luca.bruno@coreos.com>
Fri, 10 Dec 2021 11:29:29 +0000 (11:29 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Fri, 10 Dec 2021 11:33:35 +0000 (11:33 +0000)
This adds a couple of string assertions to make sure that
the test run is sane.

tests/libostreetest.c

index b82b27c31568661556be5abf654871d12ac3d6b8..d5671a1eabd650ea797242601c64c05c55912f67 100644 (file)
@@ -31,12 +31,14 @@ gboolean
 ot_test_run_libtest (const char *cmd, GError **error)
 {
   const char *srcdir = g_getenv ("G_TEST_SRCDIR");
-  g_autoptr(GPtrArray) argv = g_ptr_array_new ();
-  g_autoptr(GString) cmdstr = g_string_new ("");
+  g_assert (srcdir != NULL);
+  g_assert (cmd != NULL);
 
+  g_autoptr(GPtrArray) argv = g_ptr_array_new ();
   g_ptr_array_add (argv, "bash");
   g_ptr_array_add (argv, "-c");
 
+  g_autoptr(GString) cmdstr = g_string_new ("");
   g_string_append (cmdstr, "set -xeuo pipefail; . ");
   g_string_append (cmdstr, srcdir);
   g_string_append (cmdstr, "/tests/libtest.sh; ");