gio: gmemorymonitorpsi: Fix test error since memory free ratio test can be skipped when performing the test

The memory free ratio test can be skipped when we run the test. If
proc_override is TRUE and proc path is overridden, the memory free
ratio test can be skipped.
This commit is contained in:
Kate Hsuan
2025-07-23 19:22:25 +08:00
parent e9b0fe2879
commit 7e7c452d4a

View File

@@ -178,11 +178,15 @@ g_memory_monitor_low_trigger_cb (GMemoryMonitorPsi *monitor,
mem_ratio = g_memory_monitor_base_query_mem_ratio ();
/* if mem free ratio > 0.5, don't signal */
if (mem_ratio < 0.0)
return G_SOURCE_REMOVE;
else if (mem_ratio > 0.5)
return G_SOURCE_CONTINUE;
/* if the test is running, skip memory ratio test */
if (!monitor->proc_override)
{
/* if mem free ratio > 0.5, don't signal */
if (mem_ratio < 0.0)
return G_SOURCE_REMOVE;
if (mem_ratio > 0.5)
return G_SOURCE_CONTINUE;
}
g_memory_monitor_base_send_event_to_user (G_MEMORY_MONITOR_BASE (monitor), level_type);