source: other-projects/diffcol/trunk/diffcol/gdbdiff.pm@ 21711

Last change on this file since 21711 was 21711, checked in by oranfry, 14 years ago

bringing across the diffcol project

File size: 1.2 KB
Line 
1package gdbdiff;
2
3BEGIN {
4 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
5 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
6 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
7 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
8}
9
10use util;
11use diffutil;
12use Text::Diff;
13
14sub readin_gdb
15{
16 my ($cmd) = @_;
17
18 open(PIN,"$cmd|")
19 || die "Unable to open pipe to $cmd: $!\n";
20
21 my $text_content = "";
22
23 while (defined (my $line = <PIN>)) {
24 $text_content .= $line;
25 }
26
27 close(PIN);
28 return $text_content;
29}
30
31
32sub test_gdb
33{
34 my ($full_modeldb, $full_testdb) = @_;
35
36
37 # print "Now is testing database\n";
38
39 my $model_cmd = "db2txt $full_modeldb 2>&1";
40 my $test_cmd = "db2txt $full_testdb 2>&1";
41
42 my $model_text = readin_gdb($model_cmd);
43 my $test_text = readin_gdb($test_cmd);
44 my $report_type = "OldStyle"; # Can not change this type.
45 my $diff_gdb = diff \$model_text, \$test_text, { STYLE => $report_type };
46
47 $diff_gdb = &diffutil::GenerateOutput($diff_gdb,"^<lastmodified>.*");
48
49 if($diff_gdb eq "")
50 {
51 return "";
52 }
53 else
54 {
55 return "Difference Report: Differences found in the Database file: \n$diff_gdb";
56 }
57 # Call diff?
58}
59
601;
Note: See TracBrowser for help on using the repository browser.