Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:09

0001 #!/bin/bash
0002 
0003 # Pass in name and status
0004 function die { echo $1: status $2 ;  exit $2; }
0005 
0006 mkdir -p SITECONF
0007 mkdir -p SITECONF/local
0008 mkdir -p SITECONF/local/JobConfig
0009 
0010 export SITECONFIG_PATH=${PWD}/SITECONF/local
0011 LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
0012 
0013 cp ${LOCAL_TEST_DIR}/sitelocalconfig/noFallbackFile/site-local-config.xml  ${SITECONFIG_PATH}/JobConfig/
0014 cp ${LOCAL_TEST_DIR}/sitelocalconfig/noFallbackFile/local/storage.json ${SITECONFIG_PATH}/
0015 F1=${LOCAL_TEST_DIR}/test_fileOpenErrorExitCode_cfg.py
0016 cmsRun -j NoFallbackFile_jobreport.xml $F1 --input FileThatDoesNotExist.root && die "$F1 should have failed but didn't, exit code was 0" 1
0017 
0018 CMSRUN_EXIT_CODE=$(edmFjrDump --exitCode NoFallbackFile_jobreport.xml)
0019 echo "Exit code after first run of test_fileOpenErrorExitCode_cfg.py is ${CMSRUN_EXIT_CODE}"
0020 if [ "x${CMSRUN_EXIT_CODE}" != "x8020" ]; then
0021   echo "Unexpected cmsRun exit code after FileOpenError, exit code from jobReport ${CMSRUN_EXIT_CODE} which is different from the expected 8020"
0022   exit 1
0023 fi
0024 
0025 cp ${LOCAL_TEST_DIR}/sitelocalconfig/useFallbackFile/site-local-config.xml  ${SITECONFIG_PATH}/JobConfig/
0026 cp ${LOCAL_TEST_DIR}/sitelocalconfig/useFallbackFile/local/storage.json ${SITECONFIG_PATH}/
0027 cmsRun -j UseFallbackFile_jobreport.xml $F1 --input FileThatDoesNotExist.root > UseFallbackFile_output.log 2>&1 && die "$F1 should have failed after file fallback but didn't, exit code was 0" 1
0028 grep -q "Input file abc/store/FileThatDoesNotExist.root could not be opened, and fallback was attempted" UseFallbackFile_output.log
0029 RET=$?
0030 if [ "${RET}" != "0" ]; then
0031     cat UseFallbackFile_output.log
0032     die "UseFallbackFile_output.log did not contain the detailed error message of the first file open failure " $RET
0033 fi
0034 
0035 CMSRUN_EXIT_CODE=$(edmFjrDump --exitCode UseFallbackFile_jobreport.xml)
0036 echo "Exit code after second run of test_fileOpenErrorExitCode_cfg.py is ${CMSRUN_EXIT_CODE}"
0037 if [ "x${CMSRUN_EXIT_CODE}" != "x8028" ]; then
0038   echo "Unexpected cmsRun exit code after FallbackFileOpenError, exit code from jobReport ${CMSRUN_EXIT_CODE} which is different from the expected 8028"
0039   exit 1
0040 fi