Testsuite: the munge for SRS must accept a variable-length timestamp element
[exim.git] / test / aux-fixed / 0498.fudge
1 # This is a little perl script for test 581. It reads the first failed time
2 # from test-stdout, turns it back into an integer, and forces the received
3 # time in the -H file of the current message.
4
5 use Time::Local;
6
7 opendir(DIR, "spool/input");
8 while (($_ = readdir(DIR)))
9   {
10   if (/.*-H$/)
11     {
12     $hfile = $_;
13     break;
14     }    
15   }
16 closedir(DIR);    
17
18 @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", 
19            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
20
21 open(IN, "test-stdout") || die "can't open test-stdout\n";
22
23 $_ = <IN>;
24 $_ = <IN>;
25 $_ = <IN>;
26
27 close(IN);
28
29 ($mday,$mon,$year,$hour,$min,$sec) = 
30   /(\d\d)-(\w\w\w)-(\d\d\d\d) (\d\d):(\d\d):(\d\d)/;
31   
32 for ($i = 0; $i < 12; $i++)
33   {
34   if ($mon eq $months[$i])
35     {
36     $mon = $i;
37     break;  
38     }   
39   }
40   
41 $t = timelocal($sec,$min,$hour,$mday,$mon,$year);
42
43 open(IN, "spool/input/$hfile") || die "can't open spool/input/$hfile";
44
45 open(OUT, ">test-H");
46
47 $_ = <IN>; print OUT;
48 $_ = <IN>; print OUT;
49 $_ = <IN>; print OUT;
50 $_ = <IN>;
51 print OUT "$t 0\n";
52 print OUT while (<IN>);
53
54 close(IN);
55 close(OUT);
56
57 rename("test-H", "spool/input/$hfile") || die "rename failed\n";
58
59 # End