]> git.imager.perl.org - imager.git/blame - errep.perl
long delayed renaming of m_fatal() to i_fatal() to match Imager's
[imager.git] / errep.perl
CommitLineData
02d1d628
AMH
1
2
3use Config;
4
5@precommands=('uname -a','perl -V');
6@manpages=('dlopen','shl_load','dlsym','dlclose');
7@postcommands=map { "man $_ | col -bf | cat -s" } @manpages;
8
9print <<EOF;
10
11 This script will gather information about your system in order to
12 help debugging the problem compiling or testing Imager on your
13 system.
14
15 Make sure that you are in the same directory as errep.perl is when
16 running the script. Also make sure that the environment variables
17 are the same as when running perl Makefile.PL
18
19 It issues: uname -a, perl -V and gets the %Config hash from the
20 build of the perl binary. Then it tries to build and test the
21 module (but not install it). It dumps out the test logs if there
22 are any. It ends by dumping out some manpages.
23
24 All the results are saved to the file 'report.txt'
25
26 Continue [Y/n]?
27
28EOF
29
30$a=<STDIN>;
31chomp($a);
32die "Aborted!\n" if $a =~ /^n/i;
33
34print "Generating info about system\n";
35
36open OSTD, '>&STDOUT' or die $!;
37open STDOUT, '>report.txt' or die $!;
38open STDERR, '>&STDOUT' or die $!;
39
40rcomm('rm testout/*');
41rcomm(@precommands);
42rcomm("$^X Makefile.PL") || rcomm("make") || rcomm("make test");
43head("Logfiles from run");
44dumplogs();
45
46pconf();
47rcomm(@postcommands);
48
49sub pconf {
50 head("perl Config parameters");
51 for(sort keys %Config) { print $_,"=>",(defined $Config{$_} ? $Config{$_} : '(undef)'),"\n"; }
52 print "\n";
53}
54
55
56sub rcomm {
57 my @commands=@_;
58 my ($comm,$R);
59 for $comm(@commands) {
60 print "Executing '$comm'\n";
61 print OSTD "Executing '$comm'\n";
62 $R=system($comm);
63 print "warning - rc=$R\n" if $R;
64 print "=====================\n\n";
65 }
66 return $R;
67}
68
69sub head {
70 my $h=shift;
71 print "=========================\n";
72 print $h;
73 print "\n=========================\n";
74}
75
76sub dumplogs {
77 opendir(DH,"testout") || die "Cannot open dir testout: $!\n";
78 my @fl=sort grep(/\.log$/,readdir(DH));
79
80 for my $f (@fl) {
81 print "::::::::::::::\ntestout/$f\n::::::::::::::\n";
82 open(FH,"testout/$f") || warn "Cannot open testout/$f: $!\n";
83 print while(<FH>);
84 close(FH);
85 }
86}
87
88
89
90
91
92
93
94
95
96