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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.