Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Totktonada opened this issue Aug 27, 2018 · 0 comments · Fixed by #394
Closed

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

Totktonada opened this issue Aug 27, 2018 · 0 comments · Fixed by #394
Labels
bug Something isn't working

Comments

@Totktonada
Copy link
Member

Totktonada commented Aug 27, 2018

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).
@Totktonada Totktonada changed the title A hang tap test does not show an output A hang core = app test does not show an output Aug 27, 2018
@Totktonada Totktonada added the bug Something isn't working label Sep 3, 2018
@kyukhin kyukhin added this to the wishlist milestone Oct 15, 2021
@kyukhin kyukhin added the teamQ label Nov 3, 2021
@kyukhin kyukhin removed this from the wishlist milestone Nov 3, 2021
@kyukhin kyukhin added the 5856 label Feb 17, 2022
@Totktonada Totktonada removed the 5856 label Apr 8, 2022
Totktonada added a commit that referenced this issue May 29, 2023
Totktonada added a commit that referenced this issue May 29, 2023
Totktonada added a commit that referenced this issue May 29, 2023
Totktonada added a commit that referenced this issue May 29, 2023
Totktonada added a commit that referenced this issue May 30, 2023
Totktonada added a commit that referenced this issue May 30, 2023
ylobankov pushed a commit that referenced this issue May 31, 2023
ylobankov pushed a commit that referenced this issue May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants