Subject: bug#42399: closed (Re: bug#42399: DejaGnu randomly truncates lines in runtest output)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 13 Aug 2020 02:53:02 +0000

Your bug report

#42399: DejaGnu randomly truncates lines in runtest output

which was filed against the dejagnu package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
42399: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42399
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#42399: DejaGnu randomly truncates lines in runtest output
From: Jacob Bachmeyer <[email-masked]>
To: Alex Coplan <[email-masked]>
Cc: [email-masked], nd <[email-masked]>, Andreas Schwab <[email-masked]>
Date: Wed, 12 Aug 2020 21:51:58 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Alex Coplan wrote:
>> -----Original Message-----
>> From: Jacob Bachmeyer <[email-masked]>
>> Sent: 18 July 2020 00:19
>> To: Andreas Schwab <[email-masked]>
>> Cc: Alex Coplan <[email-masked]>; [email-masked]; nd <[email-masked]>
>> Subject: Re: bug#42399: DejaGnu randomly truncates lines in runtest output
>>
>> [...]
>> This bug will be fixed in 1.6.4, but whether it will be fixed or a known
>> bug in 1.6.3 is not yet determined.

The code fix landed on master at commit 
1e4010a4d2a8b63c3215dd7492eba38f056bb6e3, while the last of the 
associated fixes for the manual was commit 
aa173cea24b94d3f714f07bbbfda85740e8e77db just now.  With these commits, 
this bug should be fixed and is now closed, but please do not hesitate 
to reopen the bug (after verifying that you are actually using DejaGnu's 
host_execute procedure and not an out-of-tree fork thereof) if the issue 
somehow persists.

-- Jacob

Subject: DejaGnu randomly truncates lines in runtest output
From: Alex Coplan <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 16 Jul 2020 15:30:46 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

I've run into a DejaGnu bug while working on the GCC testsuite
(specifically the libgccjit testsuite). The issue is that runtest ends
up randomly truncating lines in the output.

To reproduce the issue, in a new directory, create a file bug.c with the
following contents:

  #include <dejagnu.h>

  int main(void)
  {
    for (int i = 0; i < 200; i++) {
      pass("This is a really long string and maybe it will be truncated because of the bug.");
    }
  }

Then, create a subdirectory bug.dg, containing a single file bug.exp
with the following contents:

  global text

  spawn "./a.out"

  set prefix "\[^\r\n\]*"
  expect {
    -re "^$prefix\tPASSED:${text}*" {
      regsub "\[\n\r\t\]*PASSED: $text\r\n" $expect_out(0,string) "" output
      set output [string range $output 8 end]
      pass "$output"
      exp_continue
    }
    -re "^$prefix\r\n" {
      exp_continue
    }
  }

Now compile bug.c, and verify the output is as expected:

$ gcc bug.c
$ ./a.out | uniq -c
    200         PASSED: This is a really long string and maybe it will be truncated because of the bug.

Now to reproduce the bug:

$ runtest --all 2>&1 | uniq -c

I see:

   1 WARNING: No tool specified
   1 Test run by alecop01 on Thu Jul 16 14:33:58 2020
   1 Native configuration is x86_64-pc-linux-gnu
   1 
   1 		===  tests ===
   1 
   1 Schedule of variations:
   1     unix
   1 
   1 Running target unix
   1 Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
   1 Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
   1 WARNING: Couldn't find tool config file for unix, using default.
   1 Running ./bug.dg/bug.exp ...
  49 PASS:  This is a really long string and maybe it will be truncated because of the bug.
   1 PASS:  This is a really long string and mayb
  90 PASS:  This is a really long string and maybe it will be truncated because of the bug.
   1 PASS:  This is a really long string and mayb
  59 PASS:  This is a really long string and maybe it will be truncated because of the bug.
   1 
   1 		===  Summary ===
   1 
   1 # of expected passes		200

That is, some of the lines in the output have been truncated.

Running the last step multiple times, you should be able to see that the
truncation happens at different points in the output each time. This
nondeterministic behaviour makes it especially problematic since it is
now quite difficult to compare results across multiple test runs.

If it helps with reproducing the issue, I'm running Ubuntu 18.04 on
x86_64 and my software versions are as follows:

$ runtest --version
DejaGnu version	1.6.1
Expect version	5.45.4
Tcl version	8.6

Many thanks in advance for any assistance with this issue.

Best Regards,
Alex