Skip to content

A hang core = app test does not show an outputΒ #119

Closed
@Totktonada

Description

@Totktonada

We can simulate hang 'core = app' test like so:

diff --git a/test/app-tap/tap.test.lua b/test/app-tap/tap.test.lua
index 0e1de7f1c..26db04448 100755
--- a/test/app-tap/tap.test.lua
+++ b/test/app-tap/tap.test.lua
@@ -136,6 +136,16 @@ test:test('like', function(t)
     t:unlike('abcde', 'acd', 'unlike(abcde, acd)')
 end)
 
+if (os.getenv('FLOOD') or ''):len() > 0 then
+    for i = 1, 10000 do
+        print(string.rep('x', 1024))
+    end
+end
+
+while true do
+    require('fiber').sleep(1)
+end
+
 --
 -- Finish root test. Since we used non-callback variant, we have to
 -- call check explicitly.

When 'FLOOD' is set it produces much output to debug w/o paying attention to bufferization.

I tried it with the patch #110 applied. And the following patch applied at top of it:

diff --git a/lib/app_server.py b/lib/app_server.py
index 1346866..de8de04 100644
--- a/lib/app_server.py
+++ b/lib/app_server.py
@@ -16,11 +16,8 @@ from test import TestRunGreenlet, TestExecutionError
 
 
 def run_server(execs, cwd, server, logfile, retval):
-    server.process = Popen(execs, stdout=PIPE, stderr=PIPE, cwd=cwd)
-    stdout, stderr = server.process.communicate()
-    sys.stdout.write(stdout)
     with open(logfile, 'a') as f:
-        f.write(stderr)
+        server.process = Popen(execs, stdout=sys.stdout, stderr=f, cwd=cwd)
     retval['returncode'] = server.process.wait()
     server.process = None
 
diff --git a/lib/test.py b/lib/test.py
index 03360de..2d7aa31 100644
--- a/lib/test.py
+++ b/lib/test.py
@@ -88,6 +88,9 @@ class FilteredStream:
     def flush(self):
         self.stream.flush()
 
+    def fileno(self):
+        return self.stream.fileno()
+
 
 def get_filename_by_test(postfix, test_name):
     rg = re.compile('\.test.*')

TEST_RUN_TESTS=app-tap/tap.test.lua make test does not show any output. But FLOOD=1 TEST_RUN_TESTS=app-tap/tap.test.lua make test does. So we have at least two problems:

  • Popen.communicate() does not give us output until a process exits (but please, note, the patch below brokes filters in FilteredStream).
  • Despite per-line bufferization set in FilteredStream.__init__() a test inherits a stdout file descriptior that bufferizes output (or smth like so).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions