File: mmn.t

package info (click to toggle)
apache2 2.4.66-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 59,884 kB
  • sloc: ansic: 212,340; python: 13,830; perl: 11,307; sh: 7,266; php: 1,320; javascript: 1,314; awk: 749; makefile: 715; lex: 374; yacc: 161; xml: 2
file content (42 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use strict;
use warnings FATAL => 'all';

use Apache::Test;

#
# check that the comment and the #define in ap_mmn.h are equal 
#

plan tests => 2, need_apache 2;

my $config = Apache::TestConfig->thaw();
my $filename = $config->apxs('INCLUDEDIR') . '/ap_mmn.h';

my $cmajor;
my $cminor;
my $major;
my $minor;
my $skip;
if (open(my $fh, "<", $filename)) {
    while (defined (my $line = <$fh>)) {
        if ($line =~ m/^\s+[*]\s+(\d{8})[.](\d+)\s+\([\d.]+(?:-dev)?\)\s/ ) {
            $cmajor = $1;
            $cminor = $2;
        }
        elsif ($line =~ m{^#define\s+MODULE_MAGIC_NUMBER_MAJOR\s+(\d+)(?:\s|$)}) 
        {
            $major = $1;
        }
        elsif ($line =~ m{^#define\s+MODULE_MAGIC_NUMBER_MINOR\s+(\d+)(?:\s|$)}) 
        {
            $minor = $1;
        }
    }
    close($fh);
}
else {
    $skip = "Skip if can't read $filename";
}

skip($skip, $major, $cmajor);
skip($skip, $minor, $cminor);