Changeset 28661 for other-projects/nightly-tasks/diffcol/trunk/diffcol
- Timestamp:
- 2013-11-20T17:34:45+13:00 (10 years ago)
- Location:
- other-projects/nightly-tasks/diffcol/trunk/diffcol
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl
r28609 r28661 50 50 my ($gv_test_os, $gv_model_os); # still just file globals 51 51 52 $gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/model-collect"); 53 $gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/collect"); 52 if($ENV{'GSDL3SRCHOME'}) { 53 $gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'},"web","sites","localsite","/model-collect"); 54 $gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'},"web","sites","localsite","/collect"); 55 } else { 56 $gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/model-collect"); 57 $gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/collect"); 58 } 54 59 55 60 $gv_blnErrorStop = "false"; -
other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm
r28238 r28661 34 34 } 35 35 36 sub read_db 37 { 38 # need to sort text output of both test and model col database files, to normalise them for the comparison 39 # the -sort option to db2txt was added specifically to support diffcol 40 my($db_file) = @_; 41 my $db_cmd = "db2txt -sort $db_file 2>&1"; 42 if($db_file =~ m/\.jdb$/) { 43 print STDERR "NOT YET IMPLEMENTED\n"; 44 #$db_cmd = "jdb2txt -sort $db_file 2>&1"; 45 } 46 47 my $db_text = readin_gdb($db_cmd); 48 return $db_text; 49 } 50 51 sub text_to_db_to_text 52 { 53 my($db_text, $db_filename) = @_; 54 55 # http://stackoverflow.com/questions/1909262/how-can-i-pipe-input-into-a-java-command-from-perl 56 open PIPE, "| txt2db $db_filename"; 57 print PIPE "$db_text"; 58 close(PIPE); 59 60 return &read_db("$db_filename"); 61 } 62 36 63 # for debugging. Prints txt contents of db to file 37 64 sub print_string_to_file 38 65 { 39 40 41 66 my ($text, $outfile) = @_; 67 68 open(FOUT, ">$outfile") or die "ERROR failed to write to $outfile: $!\n"; 42 69 print FOUT $text; 43 70 close(FOUT); … … 51 78 my ($dbname, $dirname, $suffix)= &File::Basename::fileparse($full_testdb, "\\.[^\\.]+\$"); 52 79 53 # need to sort text output of both test and model col database files, to normalise them for the comparison 54 # the -sort option to db2txt was added specifically to support diffcol 55 my $model_cmd = "db2txt -sort $full_modeldb 2>&1"; 56 my $test_cmd = "db2txt -sort $full_testdb 2>&1"; 57 58 my $model_text = readin_gdb($model_cmd); 59 my $test_text = readin_gdb($test_cmd); 80 my $model_text = read_db($full_modeldb); 81 my $test_text = read_db($full_testdb); 60 82 61 83 # my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory … … 244 266 # so that we get the tmp files in the same order in both model and test collections 245 267 246 # http://stackoverflow.com/questions/1909262/how-can-i-pipe-input-into-a-java-command-from-perl 247 open PIPE, "| txt2db model.gdb"; 248 print PIPE "$model_text"; 249 close(PIPE); 250 open PIPE, "| txt2db test.gdb"; 251 print PIPE "$test_text"; 252 close(PIPE); 253 254 $model_cmd = " db2txt -sort model.gdb 2>&1"; 255 $test_cmd = "db2txt -sort test.gdb 2>&1"; 256 $model_text = readin_gdb($model_cmd); 257 $test_text = readin_gdb($test_cmd); 268 $model_text = text_to_db_to_text($model_text, "model.gdb"); 269 $test_text = text_to_db_to_text($test_text, "test.gdb"); 258 270 } 259 271
Note:
See TracChangeset
for help on using the changeset viewer.