# TSThcve.def: Executes HCVE Tests # $Id: TSThcve.def,v 2.9 2012/01/03 13:34:48 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/TSThcve.def,v 2.9 2012/01/03 13:34:48 mschenke Exp $ # # Change History # 20120103 MSC Change the copyright notice. =head1 NAME TSThcve - Executes Health Check/Validation Engine Tests =head1 DESCRIPTION -T hcve This test module presents all possible rule sets for the current platform and executes the selected one. It removes all previous reports for that rule set. If the I<-d> option is specified, it displays step execution progress. The exit code is O when tests are successful, 1 in case of failures, or 2 when it detects execution errors. -T hcve: Executes the specified rule set. -T M:hcve: Produces the documentation of the specified rules set as a report. =cut echo tput('bold'),'Processing HCVE tests ...',tput('off') # Initialisation var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var @set = () var $cnt = 0 call setAbbr('HCVE') # Load the HCVE macros run HCVEinfo() # Select the rule set if getSetting('TST_ARGS') {var $set[1] = replace(last,'\.xml$','',true) if !getHcveName($set[1]) die 'Rule set ',$set[1],' not found' var $num = 1 } else {# List available rule sets var %ttl = ('A','Available Pre-Installation Rule Sets:',\ 'P','Available Post-Installation Rule Sets:') loop $typ ('A','P') {var @tbl = getHcveSets($typ) if @tbl {echo $ttl{$typ} loop $set (@tbl) {incr $cnt var $set[$cnt] = $set echo sprintf(' %2d. %s',$cnt,getHcveName($set)) } } } if !$cnt die 'No rule set found for this platform' # Get the HCVE rule set offset call setTempSetting('HCVE_ENTRIES',$cnt) call requestSetting('TSThcve') var $num = getSetting('HCVE_RULE_SET') } # Treat the HCVE rule set if and($num,$set[$num]) {var $set = $set[$num] # Load the diaglet var $xml = xmlLoadFile(getHcveFile($set),xmlNormalize(xmlParser(),-1)) if xmlError() die 'XML errors detected in ',$set if !xmlFind($xml,'sdp_diaglet') die 'Invalid diaglet: ',$set var ($xml) = last # Treat the diaglet if getSetting('TST_MAN') {# Generate a complete rule set description call setAbbr(concat('HCVE_',$set)) report man call wrt_hcve_man($set,$xml) if hasOutput(true) {call renderFile() dump 'Rule set description file: ',last } } else {# Apply target restrictions if xmlFind('sdp_meta type="target"') {var ($tgt) = last macro test_member {var ($lst,$str) = @arg loop $itm (split(',',$lst)) {if compare('eq',$itm,$str) return 0 } return 1 } if xmlValue($tgt,'host') {var ($val,$str) = (last,${RDA.HOST}) if test_member($val,$str) die 'Invalid host: ',$str } elsif xmlValue($tgt,'domain') {var ($val,$str) = (last,${RDA.DOMAIN}) if test_member($val,$str) die 'Invalid domain: ',$str } } # Get the diaglet information var %glb = ('set',$set) call get_hcve_desc(\%glb,$xml) # Treat rule sets loop $itm (xmlFind($xml,'sdp_content type="check"')) {# Get set information var %set = %glb call get_hcve_desc(\%set,$itm) # Load and perform the HCVE tests if get_hcve_rules($itm) die 'Identifier errors detected in ',$set var $hlt = exe_hcve_rules($set{'ini'}) call dsp_hcve_results($set{'ttl'},$hlt) # Purge old reports call setAbbr('HCVE') call purge('C',concat('(res|err)_',$set{'set'}),0) call setAbbr(concat('HCVE_',$set{'set'})) call purge('C','(res|err)',0) # Produce a complete report report res call wrt_hcve_results(\ concat('---+!! Health Check/Validation for "',$set{'ttl'},'"'),$hlt,true) if hasOutput(true) {call renderFile() dump 'Result file: ',last } report err call wrt_hcve_errors(\ concat('---+!! Health Check/Validation Errors for "',$set{'ttl'},'"')) if hasOutput(true) {call renderFile() dump 'Error file: ',last call setSetting('RDA_EXIT',2) } } } } =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.3: Joerg Doerris, Bill Loi, John Peeken, Wes Root. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut