Ignore:
Timestamp:
08/27/13 21:03:55 (7 years ago)
Author:
ak19
Message:

task.pl now takes a model_os param as argument to the run_test command and passes in the test_OS and model_OS variables to diffcol.pl. These specify on what Operating System the model collections were built and what the current OS is, on which the test collections will be built when the tests are run and diffed. This will provide a more foolproof way for diffcol to work out on what OS the model collection was generated and what the current OS is (or what OS task.pl chooses to specify as the current OS for test collections).

Location:
other-projects/nightly-tasks/diffcol/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl

    r28107 r28172  
    4848
    4949#--Global Variables Declaration-----------
     50my ($gv_test_os, $gv_model_os); # still just file globals
     51
    5052$gv_strModelColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/model-collect");
    5153$gv_strTestColRoot = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"/collect");
     
    327329    {
    328330    #my $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb);
    329     $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb,$strColName);
     331    $strGdbError = gdbdiff::test_gdb($strModelGdb, $strTestGdb, $strColName,$gv_test_os, $gv_model_os);
    330332    if($strGdbError ne "")
    331333    {
     
    656658        # equalise/normalise the two doc.xml/docmets.xml files for OS differences, if there are any
    657659        # before comparing a windows test with a linux model or vice-versa
    658         my $testIsWin = &isDocOrMETSXMLFileWindows($test_contents);
    659         my $modelIsWin = &isDocOrMETSXMLFileWindows($model_contents);
     660        my $testIsWin = ($gv_test_os ne "compute") ? ($gv_test_os eq "windows") : &isDocOrMETSXMLFileWindows($test_contents);
     661        my $modelIsWin = ($gv_model_os ne "compute") ? ($gv_model_os eq "windows") : &isDocOrMETSXMLFileWindows($model_contents);
    660662       
    661663        if($testIsWin != $modelIsWin) { # one of the 2 collections is built on windows, the other on linux, so need to make newlines constant
     
    943945sub main
    944946{
    945     my ($intVerbosity,$strErrorStop,$strErrorShow,$strMode);
     947    my ($intVerbosity,$strErrorStop,$strErrorShow,$strMode,$test_os,$model_os);
    946948    my $strProgName = $0;
    947949    my $intArgc = scalar(@ARGV);
     
    953955        'verbosity/\d+/1', \$intVerbosity,
    954956        'mode/[\w\-]+/all', \$strMode,
    955         'output/[\w\-]+/text', \$strOutputFormat
     957        'output/[\w\-]+/text', \$strOutputFormat,
     958        'testos/(windows|linux|darwin|compute)/compute', \$test_os, # param-name,regex,default
     959        'modelos/(windows|linux|darwin|compute)/compute', \$model_os # actually defaults to linux in task.pl
    956960        )) {
    957961        PrintUsage($strProgName);
     
    963967        die "\n";
    964968    }
     969
     970    $gv_test_os = $test_os; # if not specified, defaults to "compute"
     971    $gv_model_os = $model_os; # tends to be linux
    965972
    966973    $gv_blnErrorStop = $strErrorStop;
  • other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm

    r28086 r28172  
    4646sub test_gdb
    4747{
    48     my ($full_modeldb, $full_testdb,$strColName) = @_;
     48    my ($full_modeldb, $full_testdb, $strColName, $test_os, $model_os) = @_;
    4949
    5050   # print "Now is testing database\n";
     
    7878    # in test and model collection to an even base for comparison
    7979   
    80     my $testIsWin = &isDBWindowsSensitive($dbname, $test_text);
    81     my $modelIsWin = &isDBWindowsSensitive($dbname, $model_text);
     80    my $testIsWin = ($test_os ne "compute") ? ($test_os eq "windows") : &isDBWindowsSensitive($dbname, $test_text);
     81    my $modelIsWin = ($model_os ne "compute") ? ($model_os eq "windows") : &isDBWindowsSensitive($dbname, $model_text);
    8282   
    8383    if($testIsWin == $modelIsWin) {     
  • other-projects/nightly-tasks/diffcol/trunk/task.pl

    r28114 r28172  
    4747}
    4848
     49my $test_os = $isWin ? "windows" : ($isMac ? "darwin" : "linux");
     50my $model_os = "linux"; # default
    4951
    5052# TASK_HOME should be the toplevel diffcol folder
     
    98100my @collections = ();
    99101
     102# run_test can take any number of args
    100103if(scalar(@ARGV) > 1 && $ARGV[0] ne "run_test") {
     104    print STDERR "**** Wrong number of arguments\n";
    101105    &printusage();
    102106    exit -1;
     
    111115    case qr/^(setup_greenstone|run_test|summarise|upload|all)$/ { $action=$ARGV[0]; }
    112116    else {
    113         print STDERR "Bad subcommand.\n";
     117        print STDERR "**** Bad subcommand.\n";
    114118        &printusage;
    115119        exit -1;
     
    117121    }
    118122   
    119     # run_test action can take a subaction: nosvn|justdiff.
     123    # run_test action can take a subaction: nosvn|justdiff. It can also take --modelOS (windows|linux|darwin)
    120124    # nosvn: uses the model-collect as static and copies it over to collect, rebuilding what's currently in model-collect instead of copying
    121125    # it out from the svn model-collect again.
     
    125129        shift @collections; # remove action from array
    126130       
    127         if($ARGV[1] =~ m@^--@) {
    128             shift @collections; # remove subaction from array
     131        for (my $i=0; $i < scalar(@ARGV); $i++) {
     132            if($ARGV[$i] =~ m@^--@) {
     133            shift @collections; # remove subaction/flag from array
    129134           
    130             $subaction = $ARGV[1];         
     135            $subaction = $ARGV[$i];
    131136            if($subaction eq "--justdiff") {
    132                 $use_local_rebuild = $use_static_model = 1;
     137                $use_local_rebuild = $use_static_model = 1;
    133138            } elsif ($subaction eq "--nosvn") {
    134                 $use_static_model = 1;
     139                $use_static_model = 1;
     140            #} elsif ($subaction =~ m/\-\-testOS/i && defined $ARGV[$i+1]) {
     141            #    $test_os = $ARGV[$i+1];
     142            #    $i++;
     143            #    shift @collections; # remove test_os value from array
     144            } elsif ($subaction =~ m/\-\-modelOS/i && defined $ARGV[$i+1] && $ARGV[$i+1] =~ m/windows|linux|darwin/i) {
     145                $model_os = $ARGV[$i+1];
     146                $i++;
     147                shift @collections; # remove model_os value from array
     148                #print STDERR "Model_os specified: $model_os\n";
    135149            } else {
    136                 print STDERR "Bad subaction.\n";
    137                 &printusage;
    138                 exit -1;
    139             }           
     150                print STDERR "**** Bad subaction/value: ".$ARGV[$i]."\n";
     151                &printusage;
     152                exit -1;
     153            }
     154            }
    140155        }
    141156       
     
    238253sub printusage
    239254{
    240     print STDERR "Run as: $0 (help|setup_greenstone|run_test <--justdiff|--nosvn> <col1 col2 ...> |summarise|upload|all)\n";
     255#    print STDERR "Run as: $0 (help|setup_greenstone|run_test <--modelOS windows|darwin|linux> <--justdiff|--nosvn> <col1 col2 ...> |summarise|upload|all)\n";
     256    print STDERR "Run as: $0 (help|setup_greenstone|run_test|summarise|upload|all)\n";
     257    print STDERR "where run_test can further take the following optional parameters:\n";
     258    print STDERR "\t--modelOS (windows|darwin|linux)\n";
     259    print STDERR "\t--justdiff|--nosvn\n";
     260    print STDERR "\t<col1 col2 ...>\n";
    241261}
    242262
     
    510530        if(-d "collect") {
    511531            for my $col (@collections) {
    512                 &File::Path::remove_tree("collect$col") || die "Error could not delete collect: $!";           
     532                if(-d "collect$col") {
     533                &File::Path::remove_tree("collect$col") || die "Error could not delete collect: $!";
     534                }           
    513535            }   
    514536        }
     
    604626    print STDERR "$collection - Diffing:\n";
    605627    my $diffcol_dir = &filename_concat($ENV{'TASK_HOME'},"diffcol");
    606     $cmd = "diffcol.pl -output xml -verbosity 10 $collection"; # need to run with ./diffcol.pl if bash script
     628   
     629    # help diffcol to know on what os the model cols were generated
     630    # and what os this test machine is (on which the test cols will be generated)
     631    $cmd = "diffcol.pl -testos $test_os -modelos $model_os -output xml -verbosity 10 $collection"; # need to run with ./diffcol.pl if bash script
    607632    &run_diff_script($cmd, $xml_fh, $diffcol_dir);
    608633
Note: See TracChangeset for help on using the changeset viewer.