http://www.perlmonks.org?node_id=1116659


in reply to make test hangs

Ignore "make test" for right now. Tests will run with perl or prove, so let's use them. I tried not to make it too complex but simple, the way you wrote it. Here's my version that I ran:
#!/usr/bin/perl BEGIN { $ENV{'HARNESS_ACTIVE'} = 1; $ENV{'HARNESS_VERBOSE'} = 1; } use strict; use warnings; use Test::More tests => 1; my $log_file = './test_log'; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); my $timestamp = sprintf( "%4d-%02d-%02d %02d:%02d:%02d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec ); open( OUT, '>', $log_file ) or die "Could not open OUT! $!\n"; binmode OUT, ":encoding(UTF-8)"; print OUT "### START################################################## +##\n"; print OUT "\t $timestamp \n"; ok 1, "running the test $0..."; print OUT "ok 1 - running the test $0"; close(OUT);
You'll notice that I used environmental variables. It sure makes things easier. I also used binmode. If I'm going to open a file, then I usually binmode it. Don't forget to close the file or filehandle.

Here's the result, using perl:

###START#################################################### 2015-02-13 11:44:06 ok 1 - running the test /root/Desktop/test_hangs.t.tdy
Here's the result, using prove
###START#################################################### 2015-02-13 11:22:31 ok 1 - running the test /root/Desktop/test_hangs.t
One last thing: Most of the tests that fail can be unhung by using your keyboard. You can use Esc, or Pause/Break. Give it try. It'll take some experimentation and some time. Be patient:). I usually use Num/Lock--Pause/Break--back arrow.

Replies are listed 'Best First'.
Re^2: make test hangs
by WolliK (Acolyte) on Feb 14, 2015 at 21:19 UTC

    Hi Khen1950fx,
    it is not the script, ist is also not the prove scriptin /usr/bin, is is the APP:PROOVE witch calls some TAP functions that will not give the control back to my shell.
    I've put some additional logging into the /usr/bin/prove script to see what happened. It:
    - creates the $app
    - processses the $app
    - executes by running the app ($app->run)
    - exits with the either 0 or 1 depending on the previous return value

    The test script is fired up, runs and logs after the entries done by the prove run.

    But the shell where I started the prove command just hangs and waits for ever even if the test script has finished successfull.
    wollik

      Have you tried to test with prove -v against just one little standard test script
      #!/usr/bin/perl -w use strict; use Test::More qw( no_plan ); ok(1);
      as described above to be sure that the test indeed finishes. Please do so and post the results.

        Hi hotpelmen,
        like I've allready replied, the warn messages will be not displayed because they are discharged by the test::harness. I've run it again with your script this small script also hangs.
        The problem is not the script !! is is the calling procedures within the TEST::HARNESS module, that is also used by the prove script.
        wollik

      Hi Khen1950fx,
      What do you mean by using different break keys? I fond lots of ways to break out of the opertation and get my shell back, but all these results in quit messages, so the prove or make test routines will not proceed because of the break or quit return value.
      wollik

        You don't want the shell back, but you want to unhang the test. Pause/Break for unhanging; Ctrl-C for quiting. Remember: experiment and breathe once in awhile:).