@@ -44,6 +44,7 @@ bool fail_next_asprintf = false;
4444bool fail_next_connect = false ;
4545bool fail_next_getaddrinfo = false ;
4646bool fail_next_getaddrinfo_empty_res = false ;
47+ bool fail_next_getloadavg = false ;
4748bool fail_next_malloc = false ;
4849bool fail_next_mkdir = false ;
4950bool fail_next_open = false ;
@@ -156,7 +157,6 @@ void start_capture(bool debug)
156157 setenv (" G_MESSAGES_DEBUG" , " all" , 1 );
157158#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 79
158159 // https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3710
159- std::cout << " Resetting G_MESSAGES_DEBUG env var in runtime no longer has an effect.\n " ;
160160 const gchar *domains[] = {" all" , NULL };
161161 g_log_writer_default_set_debug_domains (domains);
162162#endif
@@ -170,6 +170,7 @@ std::tuple<std::string, std::string> end_capture(bool print)
170170{
171171 setenv (" G_MESSAGES_DEBUG" , " " , 1 );
172172#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 79
173+ // https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3710
173174 g_log_writer_default_set_debug_domains (NULL );
174175#endif
175176 foreground = 0 ;
@@ -343,6 +344,16 @@ extern "C" {
343344 return getaddrinfo (node, service, hints, res);
344345 }
345346
347+ int mocked_getloadavg (double loadavg[], int nelem)
348+ {
349+ if (fail_next_getloadavg) {
350+ fail_next_getloadavg = false ;
351+ return -1 ;
352+ }
353+
354+ return getloadavg (loadavg, nelem);
355+ }
356+
346357 void *mocked_malloc (size_t size)
347358 {
348359 if (fail_next_malloc) {
0 commit comments