IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42058


Ignore:
Timestamp:
Feb 24, 2022, 2:36:09 PM (5 years ago)
Author:
eugene
Message:

add tap.skip, fix counting of tap tests based on context (warp, diff, camera), add option for ippCheck class to modify success criteria

Location:
branches/eam_branches/ipp-20211108/ippTests/ippCheck
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/ippCheck

    r42056 r42058  
    224224end
    225225
     226# The ippCheck class specifies the group of validation table to use for the analysis.
     227# When comparing a specific processing, planned or expected deviations from previous
     228# results can be encoded uniquely in the class
     229macro init.class
     230
     231  if (not($?IPPCHECK_CLASS))
     232    $IPPCHECK_CLASS = default
     233  end
     234
     235  # look for command-line argument of the form -class ()
     236  local i
     237
     238# for i 0 $argv:n
     239# NOTE: the opihi for-loop construct evaluates the loop conditions
     240# only once before the loop starts.  Changing the value of argv:n
     241# during the loop will cause problems in that context.  Also, we
     242# need to avoid incrementing $i when we strip off arguments
     243
     244# the opihi 'while' loop correctly reevaluates the condition on each loop
     245
     246  $i = 0
     247  while ($i < $argv:n)
     248    if ("$argv:$i" == "-class")
     249      if ($argv:n < $i + 2)
     250        echo "ERROR: incorrect usage: -class is missing classname: -class (classname)"
     251        break
     252      end
     253      list argv -del -class
     254      $IPPCHECK_CLASS = $argv:$i
     255      list argv -del $IPPCHECK_CLASS
     256    else
     257      $i ++
     258    end
     259  end
     260
     261  # class-specific macros to define the class tables
     262  # should be listed in ~/.ippcheckrc
     263  ippcheck.class.$IPPCHECK_CLASS
     264end
     265
    226266macro init.stage
    227267  if ($0 < 2)
    … …  
    230270  end
    231271
    232   if (("$1" == "cam") || ("$1" == "camera"))
    233     init.camera
    234     return
    235   end
    236   if (("$1" == "wrp") || ("$1" == "warp"))
    237     init.warp
    238     return
    239   end
    240   if (("$1" == "dif") || ("$1" == "diff"))
    241     init.diff
    242     return
    243   end
     272  if (("$1" == "cam") || ("$1" == "camera")) init.camera
     273  if (("$1" == "wrp") || ("$1" == "warp"))   init.warp
     274  if (("$1" == "dif") || ("$1" == "diff"))   init.diff
    244275 
    245   echo "ERROR : invalid stage $1"
    246   break
     276  if (not($?PSF_FIELDS))
     277    echo "ERROR : invalid stage $1 or PSF_FIELDS not defined"
     278    break
     279  end
     280  if (not($?PSF_KEYS))
     281    echo "ERROR : PSF_KEYS not defined"
     282    break
     283  end
     284  if (not($?HDR_KEYS))
     285    echo "ERROR : HDR_KEYS not defined"
     286    break
     287  end
     288
     289  # Load PASS/FAIL criteria definitions
     290  smf.compare.parse.book $PSF_FIELDS  psfFields
     291  smf.compare.parse.book $PSF_KEYS    psfKeys
     292  smf.compare.parse.book $HDR_KEYS    hdrKeys
     293
     294  # determine the number of tests per chip and cmf/smf file
     295  local Nfields
     296  book npages psfFields -var Nfields
     297  $NTESTS_CHIP = $Nfields + 4
     298  $NTESTS_CMF  = $NTESTS_CHIP * $NCHIPS + 2
    247299end
    248300
    … …  
    270322  end
    271323
     324  # loads the requested class (finds and removes -class CLASSNAME) argument
     325  init.class
     326
     327  # arguments to the script are given as $argv:0 - $argv:n
     328  # argument lists are passed to macros called below with $arglist
    272329  list argv -join arglist -start 1
    273330
    … …  
    294351      echo "   EG: ippCheck smf camera  (cctest) neb:///gpc1/ipc/o6370g0351o.2133651.smf neb:///gpc1/ipc/o6370g0351o.2497362.smf [+plot]"
    295352      echo "   EG: ippCheck cmf warp    (wwtest) neb:///gpc1/ipc/o6370g0351o.wrp.2109044.skycell.1278.000.cmf neb:///gpc1/ipc/o6370g0351o.wrp.2465875.skycell.1278.000.cmf [+plot]"
     353      exit 2
    296354    end
    297355
    … …  
    299357    list argv -join arglist -start 2
    300358
     359    # If we run on a single file, define the TAP test plan here.  The
     360    # value of NTESTS_CHIP is set by the init.stage call based on psfFields
     361    # The number of chips depends on the camera and stage
     362    # For warps and diffs, the number of chips is 1 since a single cmf holds a single table
     363    # there are 2 tests at the end of smf.compare.all.extensions
     364    tap.plan $NTESTS_CMF
    301365    smf.compare.all.extensions $arglist
     366    tap.done
     367
    302368    exit 0
    303369  end
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/smfcheck.pro

    r42056 r42058  
    180180  get.camera.metadata.by.datagroup $CAMERA $expname $dgrp2; $smfBase2 = $camPath
    181181
     182  tap.plan $NTESTS_CMF
     183
    182184  $options =
    183185  setargs +plot   BOOL  $SAVEPLOT
    … …  
    185187  echo smf.compare.all.extensions $output $smfBase1.smf $smfBase2.smf $options
    186188       smf.compare.all.extensions $output $smfBase1.smf $smfBase2.smf $options
     189  tap.done
    187190end
    188191
    … …  
    223226  end
    224227 
     228  tap.plan {$npages1 * $NTESTS_CMF}
     229
    225230  for i 0 $npages1
    226231    book getpage warpBook1 $i -var mypage1
    … …  
    238243    echo smf.compare.all.extensions $output.$skycellID $cmfBase1.cmf $cmfBase2.cmf $options
    239244         smf.compare.all.extensions $output.$skycellID $cmfBase1.cmf $cmfBase2.cmf $options
    240  end
    241 
    242  book delete warpBook1
    243  book delete warpBook2
     245  end
     246 
     247  book delete warpBook1
     248  book delete warpBook2
     249 
     250  tap.done
    244251end
    245252
    … …  
    279286  end
    280287 
     288  tap.plan {2 * $npages1 * $NTESTS_CMF}
     289
    281290  for i 0 $npages1
    282291    book getpage diffBook1 $i -var mypage1
    … …  
    299308      echo smf.compare.all.extensions $output.$skycellID.inv $cmfBase1.inv.cmf $cmfBase2.inv.cmf $options
    300309           smf.compare.all.extensions $output.$skycellID.inv $cmfBase1.inv.cmf $cmfBase2.inv.cmf $options
     310    else
     311      tap.skip $NTESTS_CMF
    301312    end
    302313 end
    … …  
    329340  if ("$smf1" == "")
    330341    echo "ERROR: missing smf/cmf file : $smfFile1"
     342    tap.skip $NTESTS_CMF
    331343    next
    332344  end
    333345  if ("$smf2" == "")
    334346    echo "ERROR: missing smf/cmf file : $smfFile2"
     347    tap.skip $NTESTS_CMF
    335348    next
    336349  end
    … …  
    338351  dirname $outroot -var mydir
    339352  mkdir $mydir
    340 
    341   # XXX this number depends on the schema of the smfs and the camera (gpc1 vs gpc2)
    342   # XXX can we calculate the number of tests based on the number of smf extensions?
    343   # plan 3125
    344   ## XXX if smf.compare.all.extensions is called by an external function, we probably need a different plan,
    345   ## or we need to call 'plan' at the outer level?
    346   plan $NTESTS_CMF
    347 
    348   # Load psfField definitions.  These variables are set by the
    349   # (init.camera, init.warp, init.diff) macros defined in .ippcheckrc.
    350   # These are called by init.stage
    351   smf.compare.parse.book $PSF_FIELDS  psfFields
    352   smf.compare.parse.book $PSF_KEYS    psfKeys
    353   smf.compare.parse.book $HDR_KEYS    hdrKeys
    354353
    355354  # does the smf have the right number of extensions?
    … …  
    381380    if ($Next2 == -1)
    382381      echo "not ok : missing extenion $ext0:$Next1"
     382      # XXX add a tap.skip here?
    383383      next
    384384    end
    385385
    386     ok ($ext0:$Next1 == $ext1:$Next2) "matching ext names"
     386    # tap.ok ($ext0:$Next1 == $ext1:$Next2) "matching ext names"
    387387    $extname = $ext0:$Next1
    388388    # NOTE: analysis below uses ext sequence number (i,j)
    … …  
    398398      echo "##### comparison results in $outroot.$extname.keys               #####"
    399399      exec ippCheckKeys $smf1 $Next1 $smf2 $Next2 >& $outroot.$extname.keys
    400       smf.compare.keys $outroot.$extname.keys hdrKeys
     400      smf.compare.keys $outroot.$extname.keys hdrKeys; # TAP: 1
    401401      if ($NfailKeys) set NfailHdr = $NfailHdr + 1
    402402    end
    … …  
    408408      echo "##### comparison results in $outroot.$extname.keys               #####"
    409409      exec ippCheckKeys $smf1 $Next1 $smf2 $Next2 >& $outroot.$extname.keys
    410       smf.compare.keys $outroot.$extname.keys psfKeys
     410      smf.compare.keys $outroot.$extname.keys psfKeys; # TAP: 1
    411411      if ($NfailKeys) set NfailPsf = $NfailPsf + 1
    412412
    … …  
    414414      echo "##### comparison results in $outroot.$extname.txt                  #####"
    415415      smf.compare.onechip $outroot.$extname $smf1 {$Next1-1} $smf2 {$Next2-1}; # Note smf.compare.onechip counts from 0 = first extension
     416      # TAP: 2 + Nfields
    416417    end
    417418
    … …  
    422423      echo "##### comparison results in $outroot.$extname.keys               #####"
    423424      exec ippCheckKeys $smf1 $Next1 $smf2 $Next2 >& $outroot.$extname.keys
    424       smf.compare.keys $outroot.$extname.keys hdrKeys
     425      smf.compare.keys $outroot.$extname.keys hdrKeys; # TAP: 1
    425426      if ($NfailKeys) set NfailHdr = $NfailHdr + 1
    426427    end
    … …  
    432433      echo "##### comparison results in $outroot.$extname.keys               #####"
    433434      exec ippCheckKeys $smf1 $Next1 $smf2 $Next2 >& $outroot.$extname.keys
    434       smf.compare.keys $outroot.$extname.keys psfKeys
     435      smf.compare.keys $outroot.$extname.keys psfKeys; # TAP: 1
    435436      if ($NfailKeys) set NfailPsf = $NfailPsf + 1
    436437
    … …  
    440441    end
    441442  end
    442   ok ($NfailHdr == 0) "$NfailHdr HDR headers failed comparison"
    443   ok ($NfailPsf == 0) "$NfailPsf PSF headers failed comparison"
    444 
    445   done
     443  tap.ok ($NfailHdr == 0) "$NfailHdr HDR headers failed comparison" ; # TAP: each file
     444  tap.ok ($NfailPsf == 0) "$NfailPsf PSF headers failed comparison" ; # TAP: each file
    446445end
    447446
    … …  
    474473  $smf2_has_data = ($tfields:n > 0) && ($table:Ny > 0)
    475474
    476   ok ($smf1_has_data == $smf2_has_data) "tables both have (or both lack) data"
     475  tap.ok ($smf1_has_data == $smf2_has_data) "tables both have (or both lack) data" ; # TAP: each chip
    477476  if (not($smf1_has_data) || not($smf2_has_data))
    478477    echo "no data in tables $smf1 $ext1 or $smf2 $ext2, skipping"
    479478    # I should account for the number of skipped tests
     479    local Nfields
     480    book npages psfFields -var Nfields
     481    tap.skip {$Nfields + 1}
    480482    return
    481483  end
    … …  
    554556  #
    555557  output $output.txt
    556   echo "$N1_keep & $N1_miss vs $N2_keep & $N2_miss"
     558  echo "PSF FIELDS: $N1_keep & $N1_miss vs $N2_keep & $N2_miss"
    557559  output stdout
    558 
    559   # positional consistency:
    560   set dX = X_PSF_$v1 - Xm_$v2
    561   set dY = Y_PSF_$v1 - Ym_$v2
    562 
    563   # add a test here?
    564   # XXX this test is equivalent to tests of the fields below
    565   # but cannot be as finely controlled
    566   # vstat -q dX
    567   # ok ($SIGMA < 0.1) "X position stdev $SIGMA < 0.1"
    568   # vstat -q dY
    569   # ok ($SIGMA < 0.1) "Y position stdev $SIGMA < 0.1"
    570560end
    571561
    … …  
    596586  end 
    597587
    598   ok ($NfailFieldsPSF == 0) "$NfailFieldsPSF fields failed comparison"
    599 
     588  tap.ok ($NfailFieldsPSF == 0) "$NfailFieldsPSF fields failed comparison"; # TAP: each chip
    600589end
    601590
    … …  
    715704    fprintf "%24s :  $PASS : SKIP" $field
    716705    output stdout
     706    tap.skip 1
    717707    return
    718708  end
    … …  
    728718  if ($hist:minVal < $minGood) set PASS = 0
    729719  if ($hist:maxVal > $maxGood) set PASS = 0
     720  if (isinf($hist:maxVal)) set PASS = 0
     721  if (isinf($hist:minVal)) set PASS = 0
    730722
    731723  # save the summary line to be written to a file by the calling function
    … …  
    734726  output stdout
    735727
    736   ok ($PASS) "PSF table field $field comparison"
     728  tap.ok ($PASS) "PSF table field $field comparison"; # TAP: each field
    737729end
    738730
    … …  
    796788    $NfailKeys ++
    797789  end
    798   ok ($NfailKeys == 0) "$NfailKeys keys failed comparison"
     790  tap.ok ($NfailKeys == 0) "$NfailKeys keys failed comparison" ; # TAP: called 2x per chip
    799791end
    800792
  • branches/eam_branches/ipp-20211108/ippTests/ippCheck/tap.pro

    r42024 r42058  
    33if (not($?TAP_VERBOSE)) set TAP_VERBOSE = 1
    44
    5 macro plan
     5macro tap.plan
    66 if ($0 != 2)
    77  echo "USAGE: plan (Ntest)"
    … …  
    1212 $tap_Npass = 0
    1313 $tap_Nfail = 0
     14 $tap_Nskip = 0
    1415 $tap_Ntest = 0
    1516end
    1617
    17 macro done
    18  if (not($?tap_Nplan))
    19   echo "ERROR: tap tests not planned"
     18macro tap.skip
     19 if ($0 != 2)
     20  echo "USAGE skip (Nskip)"
    2021  break
    2122 end
    2223
    23  echo "planned $tap_Nplan tests, ran $tap_Ntest"
    24  echo "passed $tap_Npass tests, failed $tap_Nfail tests"
    25 
    26  if (($tap_Nfail == 0) && ($tap_Ntest == $tap_Nplan) && ($tap_Npass == $tap_Ntest))
    27    echo "PASS: all tests run and passed"
    28    return 1
    29  end
    30 
    31  if ($tap_Nfail > 0)
    32    echo "FAIL: $tap_Nfail tests failed"
    33  end
    34 
    35  if ($tap_Ntest != $tap_Nplan)
    36    echo "FAIL: not all tests run"
    37  end
    38 
    39  if ($tap_Ntest != $tap_Npass + $tap_Nfail)
    40    echo "FAIL: inconsistent count: $tap_Ntest tests != $tap_Npass pass + $tap_Nfail fail"
    41  end
     24  $tap_Nskip += $1
    4225end
    4326
    44 macro ok
     27macro tap.ok
    4528 if ($0 != 3)
    46   echo "USAGE (condition) (label)"
     29  echo "USAGE: ok (condition) (label)"
    4730  break
    4831 end
    … …  
    6346end
    6447
     48macro tap.done
     49 if (not($?tap_Nplan))
     50  echo "ERROR: tap tests not planned"
     51  break
     52 end
     53
     54 echo "planned $tap_Nplan tests, ran $tap_Ntest, skipped $tap_Nskip"
     55 echo "passed $tap_Npass tests, failed $tap_Nfail tests"
     56
     57 if (($tap_Nfail == 0) && ($tap_Ntest + $tap_Nskip == $tap_Nplan) && ($tap_Npass == $tap_Ntest))
     58   echo "PASS: all tests run and passed"
     59   return 1
     60 end
     61
     62 if ($tap_Nfail > 0)
     63   echo "FAIL: $tap_Nfail tests failed"
     64 end
     65
     66 if ($tap_Ntest + $tap_Nskip != $tap_Nplan)
     67   echo "FAIL: not all tests run"
     68 end
     69
     70 if ($tap_Ntest != $tap_Npass + $tap_Nfail)
     71   echo "FAIL: inconsistent count: $tap_Ntest tests != $tap_Npass pass + $tap_Nfail fail"
     72 end
     73end
     74
Note: See TracChangeset for help on using the changeset viewer.