]> git.imager.perl.org - imager.git/blob - errep.perl
- error messages when writing TIFF images were always
[imager.git] / errep.perl
1
2
3 use 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
9 print <<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
28 EOF
29
30 $a=<STDIN>;
31 chomp($a);
32 die "Aborted!\n" if $a =~ /^n/i;
33
34 print "Generating info about system\n";
35
36 open OSTD, '>&STDOUT' or die $!;
37 open STDOUT, '>report.txt' or die $!;
38 open STDERR, '>&STDOUT' or die $!;
39
40 rcomm('rm testout/*');
41 rcomm(@precommands);
42 rcomm("$^X Makefile.PL") || rcomm("make") || rcomm("make test");
43 head("Logfiles from run");
44 dumplogs();
45
46 pconf();
47 rcomm(@postcommands);
48
49 sub pconf {
50     head("perl Config parameters");
51     for(sort keys %Config) {  print $_,"=>",(defined $Config{$_} ? $Config{$_} : '(undef)'),"\n"; }
52     print "\n";
53 }
54
55
56 sub 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
69 sub head {
70     my $h=shift;
71     print "=========================\n";
72     print $h;
73     print "\n=========================\n";
74 }
75
76 sub 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