Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-23 03:13:12

0001 #!/bin/bash
0002 
0003 test=testParameterSet
0004 
0005 function die { echo Failure $1: status $2 ; exit $2 ; }
0006 
0007 LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
0008 
0009 # Intentionally fails because of an illegal parameter in a module.
0010   echo ${test} ------------------------------------------------------------
0011   cmsRun ${LOCAL_TEST_DIR}/${test}_cfg.py 2> ${test}.txt
0012   grep "Illegal parameter" ${test}.txt || die "cmsRun ${test}_cfg.py" $?
0013 
0014 # Intentionally fails because of an illegal parameter in a source.
0015   echo testIllegalSourceParameter_cfg.py ------------------------------------------------------------
0016   cmsRun ${LOCAL_TEST_DIR}/testIllegalSourceParameter_cfg.py 2> testIllegalSourceParameter_cfg.txt
0017   grep "Illegal parameter" testIllegalSourceParameter_cfg.txt || die "cmsRun testIllegalSourceParameter_cfg.py" $?
0018 
0019 # Intentionally fails because of an illegal parameter in a service.
0020   echo testIllegalServiceParameter_cfg.py ------------------------------------------------------------
0021   cmsRun ${LOCAL_TEST_DIR}/testIllegalServiceParameter_cfg.py 2> testIllegalServiceParameter_cfg.txt
0022   grep "Illegal parameter" testIllegalServiceParameter_cfg.txt || die "cmsRun testIllegalServiceParameter_cfg.py" $?
0023 
0024 # Note that DoodadESSource and WhatsItESProducer classes contain little tests for
0025 # validation of ESSource's and ESProducer's. They are not run here, but thought
0026 # this comment would be helpful for anyone trying to find those tests.
0027 
0028 # Auto generate a cfi file
0029   echo edmWriteConfigs ------------------------------------------------------------
0030   edmWriteConfigs pluginFWCoreIntegrationTestPSet.so || die "edmWriteConfigs pluginTestProducerWithPSetDesc.so" $?
0031 
0032 # Make sure we can run using the cfi file generated in the previous process
0033   echo cmsRun runAutoGeneratedCfi_cfg.py ------------------------------------------------------------
0034   cmsRun ${LOCAL_TEST_DIR}/runAutoGeneratedCfi_cfg.py || die "cmsRun runAutoGeneratedCfi_cfg.py" $?
0035 
0036 # Compare the cfi file to a reference file to ensure it is correct
0037   mkdir testcfi
0038   cp ${LOCAL_TEST_DIR}/cfi_dumpPython.py testcfi
0039   cp testProducerWithPsetDesc_cfi.py testcfi
0040   cp ProducerWithPSetDesc.py testcfi
0041   PYTHON3PATH=${PWD}:${PYTHON3PATH} python3 -m testcfi.cfi_dumpPython > dumpPython.log
0042   python3 ${LOCAL_TEST_DIR}/unit_test_outputs/testProducerWithPsetDesc_cfi.py > dumpPython_ref.log
0043   diff ./dumpPython.log dumpPython_ref.log || die "comparing testProducerWithPsetDesc_cfi.py" $?
0044 
0045 # This time try a cfi without any of the required parameters to test that we properly insert
0046 # required missing parameters into the ParameterSet
0047   echo cmsRun runNotAutoGeneratedCfi_cfg.py ------------------------------------------------------------
0048   cmsRun ${LOCAL_TEST_DIR}/runNotAutoGeneratedCfi_cfg.py || die "cmsRun runNotAutoGeneratedCfi_cfg.py" $?
0049 
0050 # Compare the output of the PSetAnalyzer with a reference file
0051   echo cmsRun testPSetAnalyzer_cfg.py ------------------------------------------------------------
0052   cmsRun ${LOCAL_TEST_DIR}/testPSetAnalyzer_cfg.py 2>&1 | grep " PSet test " > testPSetAnalyzer.txt
0053   diff ./testPSetAnalyzer.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testPSetAnalyzer.txt || die "comparing testPSetAnalyzer.txt" $?
0054 
0055 # Print human readable from the ParameterSetDescription
0056   echo edmPluginHelp -p ProducerWithPSetDesc ------------------------------
0057   edmPluginHelp -p ProducerWithPSetDesc &> testProducerWithPsetDesc_doc.txt || die "edmPluginHelp -p ProducerWithPSetDesc" $?
0058   diff ./testProducerWithPsetDesc_doc.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testProducerWithPsetDesc_doc.txt || die "comparing testProducerWithPsetDesc_doc.txt" $?
0059 
0060 # Print human readable from the ParameterSetDescription, test comments in ParameterDescription constructor arguments
0061   echo edmPluginHelp -p TestDescriptionComments ------------------------------
0062   edmPluginHelp -p TestDescriptionComments &> testDescriptionComments_doc.txt || die "edmPluginHelp -p TestDescriptionComments" $?
0063   diff ./testDescriptionComments_doc.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testDescriptionComments_doc.txt || die "comparing testDescriptionComments_doc.txt" $?
0064 
0065 # Print human readable from the ParameterSetDescription, brief format
0066   echo edmPluginHelp -p ProducerWithPSetDesc -b ---------------------------
0067   edmPluginHelp -p ProducerWithPSetDesc -b &> testProducerWithPsetDesc_briefdoc.txt || die "edmPluginHelp -p ProducerWithPSetDesc -b" $?
0068   diff ./testProducerWithPsetDesc_briefdoc.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testProducerWithPsetDesc_briefdoc.txt || die "comparing testProducerWithPsetDesc_briefdoc.txt" $?
0069 
0070   echo edmPluginHelp -t options -b ---------------------------
0071   edmPluginHelp -t options -b &> testEdmPluginHelpOptions.txt || die "edmPluginHelp -t options -b" $?
0072   grep "numberOfThreads[[:blank:]]\+untracked uint32[[:blank:]]\+1" testEdmPluginHelpOptions.txt || die "testing edmPluginHelp -t options -b" $?
0073 
0074 # Test for errors and success when importing a restricted file in various ways
0075   echo cmsRun importRestrictions1.py ------------------------------------------------------------
0076   cmsRun ${LOCAL_TEST_DIR}/importRestrictions1.py 2> importRestrictions1.txt
0077   grep "Event 2" importRestrictions1.txt || die " cmsRun importRestrictions1.py" $?
0078   echo cmsRun importRestrictions2.py ------------------------------------------------------------
0079   cmsRun ${LOCAL_TEST_DIR}/importRestrictions2.py 2> importRestrictions2.txt
0080   grep "ImportError" importRestrictions2.txt || die " cmsRun importRestrictions2.py" $?
0081   echo cmsRun importRestrictions3.py ------------------------------------------------------------
0082   cmsRun ${LOCAL_TEST_DIR}/importRestrictions3.py 2> importRestrictions3.txt
0083   grep "Event 2" importRestrictions3.txt || die " cmsRun importRestrictions3.py" $?
0084 
0085 exit 0