]>
git.proxmox.com Git - pve-cluster.git/blob - data/test/corosync_parser_test.pl
18ee4f7b2630d8e7631878d0f02802449b6f982f
12 sub parser_self_check
{
15 my $outfile = "$cfg_fn.write";
16 my ($config1, $config2, $raw1, $raw2);
20 $raw1 = PVE
::Tools
::file_get_contents
($cfg_fn);
21 $config1 = PVE
::Corosync
::parse_conf
($cfg_fn, $raw1);
24 $raw2 = PVE
::Corosync
::write_conf
(undef, $config1);
25 # do not actually write cfg, but you can outcomment to do so, e.g. if
26 # you want to use diff for easy comparision
27 #PVE::Tools::file_set_contents($outfile, $raw2);
29 # reparse written config (must be the same as config1)
30 $config2 = PVE
::Corosync
::parse_conf
(undef, $raw2);
33 # do not care for whitespace differences
34 delete $config1->{digest
};
35 delete $config2->{digest
};
37 is_deeply
($config1, $config2, "self check hash: $cfg_fn");
39 # do not care about extra new lines
40 $raw1 =~ s/^\s*\n+//mg;
41 $raw2 =~ s/^\s*\n+//mg;
43 is($raw1, $raw2, "self check raw: $cfg_fn");
47 if (my $file = shift) {
48 parser_self_check
($file);
50 foreach my $file (<corosync_configs
/*.conf
>) {
51 parser_self_check
($file);