Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:31

0001 #!/bin/bash
0002 
0003 test=testParameterSet
0004 
0005 function die { echo Failure $1: status $2 ; exit $2 ; }
0006 
0007 pushd ${LOCAL_TMP_DIR}
0008 
0009 # Intentionally fails because of an illegal parameter in a module.
0010   echo ${test} ------------------------------------------------------------
0011   cmsRun -p ${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 -p ${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 -p ${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 pluginTestProducerWithPSetDesc.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 -p ${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   diff ${LOCAL_TMP_DIR}/testProducerWithPsetDesc_cfi.py ${LOCAL_TEST_DIR}/unit_test_outputs/testProducerWithPsetDesc_cfi.py || die "comparing testProducerWithPsetDesc_cfi.py" $?
0038 
0039 # This time try a cfi without any of the required parameters to test that we properly insert
0040 # required missing parameters into the ParameterSet
0041   echo cmsRun runNotAutoGeneratedCfi_cfg.py ------------------------------------------------------------
0042   cmsRun -p ${LOCAL_TEST_DIR}/runNotAutoGeneratedCfi_cfg.py || die "cmsRun runNotAutoGeneratedCfi_cfg.py" $?
0043 
0044 # Compare the output of the PSetAnalyzer with a reference file
0045   echo cmsRun testPSetAnalyzer_cfg.py ------------------------------------------------------------
0046   cmsRun -p ${LOCAL_TEST_DIR}/testPSetAnalyzer_cfg.py 2>&1 | grep " PSet test " > testPSetAnalyzer.txt
0047   diff ${LOCAL_TMP_DIR}/testPSetAnalyzer.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testPSetAnalyzer.txt || die "comparing testPSetAnalyzer.txt" $?
0048 
0049 # Print human readable from the ParameterSetDescription
0050   echo edmPluginHelp -p ProducerWithPSetDesc ------------------------------
0051   edmPluginHelp -p ProducerWithPSetDesc &> testProducerWithPsetDesc_doc.txt || die "edmPluginHelp -p ProducerWithPSetDesc" $?
0052   diff ${LOCAL_TMP_DIR}/testProducerWithPsetDesc_doc.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testProducerWithPsetDesc_doc.txt || die "comparing testProducerWithPsetDesc_doc.txt" $?
0053 
0054 # Print human readable from the ParameterSetDescription, test comments in ParameterDescription constructor arguments
0055   echo edmPluginHelp -p TestDescriptionComments ------------------------------
0056   edmPluginHelp -p TestDescriptionComments &> testDescriptionComments_doc.txt || die "edmPluginHelp -p TestDescriptionComments" $?
0057   diff ${LOCAL_TMP_DIR}/testDescriptionComments_doc.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testDescriptionComments_doc.txt || die "comparing testDescriptionComments_doc.txt" $?
0058 
0059 # Print human readable from the ParameterSetDescription, brief format
0060   echo edmPluginHelp -p ProducerWithPSetDesc -b ---------------------------
0061   edmPluginHelp -p ProducerWithPSetDesc -b &> testProducerWithPsetDesc_briefdoc.txt || die "edmPluginHelp -p ProducerWithPSetDesc -b" $?
0062   diff ${LOCAL_TMP_DIR}/testProducerWithPsetDesc_briefdoc.txt ${LOCAL_TEST_DIR}/unit_test_outputs/testProducerWithPsetDesc_briefdoc.txt || die "comparing testProducerWithPsetDesc_briefdoc.txt" $?
0063 
0064   echo edmPluginHelp -t options -b ---------------------------
0065   edmPluginHelp -t options -b &> testEdmPluginHelpOptions.txt || die "edmPluginHelp -t options -b" $?
0066   grep "numberOfThreads[[:blank:]]\+untracked uint32[[:blank:]]\+1" testEdmPluginHelpOptions.txt || die "testing edmPluginHelp -t options -b" $?
0067 
0068 # Test for errors and success when importing a restricted file in various ways
0069   echo cmsRun importRestrictions1.py ------------------------------------------------------------
0070   cmsRun -p ${LOCAL_TEST_DIR}/importRestrictions1.py 2> importRestrictions1.txt
0071   grep "Event 2" importRestrictions1.txt || die " cmsRun importRestrictions1.py" $?
0072   echo cmsRun importRestrictions2.py ------------------------------------------------------------
0073   cmsRun -p ${LOCAL_TEST_DIR}/importRestrictions2.py 2> importRestrictions2.txt
0074   grep "ImportError" importRestrictions2.txt || die " cmsRun importRestrictions2.py" $?
0075   echo cmsRun importRestrictions3.py ------------------------------------------------------------
0076   cmsRun -p ${LOCAL_TEST_DIR}/importRestrictions3.py 2> importRestrictions3.txt
0077   grep "Event 2" importRestrictions3.txt || die " cmsRun importRestrictions3.py" $?
0078 
0079 
0080 popd
0081 
0082 exit 0