From: Uli Schlachter <psychon@znc.in>
Subject: [PATCH] Replace busy loop with usleep call

tests/glib.lua counts to one million in an attempt to spend some time so
that it can test that GLib's Timer correctly nootices that some
timepassed. The "count to one million"-loop needs about three
milliseconds here with Lua 5.2. LuaJIT is likely faster than this.

Instead of relying on this loop being slow enough, replace it with a
call to g_usleep to sleep for a millisecond.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Debian-Bug: https://bugs.debian.org/880410
Origin: upstream, https://github.com/pavouk/lgi/commit/d695b42c7a4bf225ebe285c0635e21c2f1e6bea3
---
 tests/glib.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/glib.lua b/tests/glib.lua
index 42523f6..4b037a3 100644
--- a/tests/glib.lua
+++ b/tests/glib.lua
@@ -34,7 +34,7 @@ function glib.timer()
    check(type(el1) == 'number')
    check(type(ms1) == 'number')
 
-   for i = 1, 1000000 do end
+   lgi.GLib.usleep(1000) -- wait one millisecond
 
    local el2, ms2 = timer:elapsed()
    check(el1 < el2)
