From b57d61159ba04d6aa209fb56d731bd139aa402b0 Mon Sep 17 00:00:00 2001
From: Roman Tsisyk <roman@tsisyk.com>
Date: Fri, 22 Jan 2016 19:42:09 +0300
Subject: [PATCH] box/fiber.test.lua: stop flooding the logs during busy-wait

---
 test/box/fiber.result   | 24 +++++++++++++++++-------
 test/box/fiber.test.lua | 15 ++++++++-------
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/test/box/fiber.result b/test/box/fiber.result
index 9b94d2d198..e214b8d356 100644
--- a/test/box/fiber.result
+++ b/test/box/fiber.result
@@ -610,11 +610,8 @@ test_run:cmd("setopt delimiter ';'")
 ---
 - true
 ...
-function testfun(ch)
-    while fiber.self().storage.key == nil do
-        print('wait')
-        fiber.sleep(0)
-    end
+function testfun(mgmt, ch)
+    mgmt:get()
     ch:put(fiber.self().storage.key)
 end;
 ---
@@ -623,15 +620,22 @@ test_run:cmd("setopt delimiter ''");
 ---
 - true
 ...
-ch = fiber.channel(1)
+mgmt = fiber.channel()
 ---
 ...
-f = fiber.create(testfun, ch)
+ch = fiber.channel()
+---
+...
+f = fiber.create(testfun, mgmt, ch)
 ---
 ...
 f.storage.key = 'some value'
 ---
 ...
+mgmt:put("wakeup plz")
+---
+- true
+...
 ch:get()
 ---
 - some value
@@ -639,9 +643,15 @@ ch:get()
 ch:close()
 ---
 ...
+mgmt:close()
+---
+...
 ch = nil
 ---
 ...
+mgmt = nil
+---
+...
 fiber.self().storage.key -- our local storage is not affected by f
 ---
 - 48
diff --git a/test/box/fiber.test.lua b/test/box/fiber.test.lua
index b321fdb5b2..df8fc8f7ee 100644
--- a/test/box/fiber.test.lua
+++ b/test/box/fiber.test.lua
@@ -223,20 +223,21 @@ fiber.self().storage.key = 48
 fiber.self().storage.key
 
 test_run:cmd("setopt delimiter ';'")
-function testfun(ch)
-    while fiber.self().storage.key == nil do
-        print('wait')
-        fiber.sleep(0)
-    end
+function testfun(mgmt, ch)
+    mgmt:get()
     ch:put(fiber.self().storage.key)
 end;
 test_run:cmd("setopt delimiter ''");
-ch = fiber.channel(1)
-f = fiber.create(testfun, ch)
+mgmt = fiber.channel()
+ch = fiber.channel()
+f = fiber.create(testfun, mgmt, ch)
 f.storage.key = 'some value'
+mgmt:put("wakeup plz")
 ch:get()
 ch:close()
+mgmt:close()
 ch = nil
+mgmt = nil
 fiber.self().storage.key -- our local storage is not affected by f
 -- attempt to access local storage of dead fiber raises error
 pcall(function(f) return f.storage end, f)
-- 
GitLab