|
||||
File indexing completed on 2024-04-06 12:19:09
0001 #!/bin/sh 0002 0003 function die { echo $1: status $2 ; exit $2; } 0004 0005 LOCAL_TEST_DIR=${SCRAM_TEST_PATH} 0006 0007 # The purpose of this is to test schema evolution in ROOT. 0008 0009 # In the first two cmsRun processes, there is no schema evolution 0010 # going on. The first one writes a data file containing a test 0011 # product. The second one reads the test products and checks 0012 # that the values read from it match values that the first process 0013 # should have written. The purpose here is to validate that the 0014 # test code is actually working properly and if we see failures 0015 # in the later cmsRun processes, they are more likely to be 0016 # caused by a failure in ROOT schema evolution. 0017 cmsRun ${LOCAL_TEST_DIR}/SchemaEvolution_create_test_file_cfg.py || die 'Failure using SchemaEvolution_create_test_file_cfg.py' $? 0018 cmsRun ${LOCAL_TEST_DIR}/SchemaEvolution_test_read_cfg.py || die 'Failure using SchemaEvolution_create_test_file_cfg.py' $? 0019 0020 # For each StreamerInfo in the input file, test for existence of StreamerInfo for 0021 # nested classes (members, base, elements of containers). 0022 root.exe -b -l -q file:SchemaEvolutionTest.root "${LOCAL_TEST_DIR}/testForStreamerInfo.C(gFile)" | sort -u > testForStreamerInfo1.log 0023 grep "Missing" testForStreamerInfo1.log && die "Missing nested streamer info" 1 0024 grep "SchemaEvolutionChangeOrder" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionChangeOrder in testForStreamerInfo1.log' $? 0025 grep "SchemaEvolutionAddMember" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionAddMember in testForStreamerInfo1.log' $? 0026 grep "SchemaEvolutionRemoveMember" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionRemoveMember in testForStreamerInfo1.log' $? 0027 grep "SchemaEvolutionMoveToBase" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionMoveToBase" in testForStreamerInfo1.log' $? 0028 grep "SchemaEvolutionChangeType" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionChangeType in testForStreamerInfo1.log' $? 0029 grep "SchemaEvolutionAddBase" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionAddBase in testForStreamerInfo1.log' $? 0030 grep "SchemaEvolutionPointerToMember" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionPointerToMember in testForStreamerInfo1.log' $? 0031 grep "SchemaEvolutionPointerToUniquePtr" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionPointerToUniquePtr in testForStreamerInfo1.log' $? 0032 grep "SchemaEvolutionCArrayToStdArray" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionCArrayToStdArray in testForStreamerInfo1.log' $? 0033 grep "SchemaEvolutionVectorToList" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionVectorToList in testForStreamerInfo1.log' $? 0034 grep "SchemaEvolutionMapToUnorderedMap" testForStreamerInfo1.log || die 'Failure cannot find SchemaEvolutionMapToUnorderedMap in testForStreamerInfo1.log' $? 0035 grep "VectorVectorElementNonSplit" testForStreamerInfo1.log || die 'Failure cannot find VectorVectorElementNonSplit in testForStreamerInfo1.log' $? 0036 0037 # Then we read permanently saved data files from the cms-data 0038 # repository. When these data files were written, the working area 0039 # was built with different class definitions used for the contents 0040 # of the test product. This forces ROOT to perform schema evolution 0041 # as it reads the test product. We check both that the job 0042 # completes successfully and that the values contained in 0043 # the test product after schema evolution are what we expect. 0044 # The plan is to generate new data files each time there is a major 0045 # revision to ROOT. 0046 0047 # The old files read below were generated as follows. 0048 # 0049 # Check out the release you want to use to generate the file 0050 # and build a working area. You will at least need to checkout 0051 # IOPool/Input and DataFormats/TestObjects. 0052 # 0053 # If the release is before the first release that includes this 0054 # file (testSchemaEvolution.sh), then you will need to manually 0055 # merge in the commit that added the file. Most of the files are 0056 # completely new files, although BuildFile.xml, classes.h, and 0057 # classes_def.xml already existed may require manually merging a 0058 # few lines of code. 0059 # 0060 # Manually edit 2 files. 0061 # 0062 # 1. Modify the following line in the file: 0063 # DataFormats/TestObjects/interface/SchemaEvolutionTestObjects.h 0064 # //#define DataFormats_TestObjects_USE_OLD 0065 # To generate an input file with the old format remove the "//" 0066 # at the beginning so the macro is defined. 0067 # 0068 # 2. In file: DataFormats/TestObjects/src/classes_def.xml 0069 # There is a section of code starting with SchemaEvolutionChangeOrder 0070 # continuing to SchemaEvolutionMapToUnorderedMap. This section appears 0071 # twice. The first section defines old formats that should be used 0072 # to generate old format data files (These are all ClassVersion= "3") 0073 # When reading, use the new version (the section with ClassVersion="4" 0074 # which should be the one enabled in the CMSSW repository). 0075 # Of these two sections, exactly one should be commented out. 0076 # To generate the input data files, you will need to manually 0077 # enable the ClassVersion 3 section. 0078 # 0079 # Then rebuild the working area. 0080 # 0081 # Then run the configuration IOPool/Input/test/SchemaEvolution_create_test_file_cfg.py 0082 # This will generate an output file named SchemaEvolutionTest.root. 0083 # Rename this file appropriately to include the release used and use 0084 # it as an input for this test by adding additional cases below. 0085 # The new data file will need to added to the cms-data repository 0086 # named IOPool-Input. 0087 0088 file=SchemaEvolutionTestOLD13_2_3.root 0089 inputfile=$(edmFileInPath IOPool/Input/data/$file) || die "Failure edmFileInPath IOPool/Input/data/$file" $? 0090 cmsRun ${LOCAL_TEST_DIR}/SchemaEvolution_test_read_cfg.py --inputFile "$inputfile" || die "Failed to read old file $file" $? 0091 0092 file=SchemaEvolutionTestOLD13_0_0.root 0093 inputfile=$(edmFileInPath IOPool/Input/data/$file) || die "Failure edmFileInPath IOPool/Input/data/$file" $? 0094 0095 # The next test demonstrates the FileReadError that can occur as a 0096 # result of the known ROOT bug in 13_0_0 (file has a problem when 0097 # written with 13_0_0 that causes an exception when read). 0098 # Note that this is also used to test the cmsRun exit code 0099 # after a FileReadError (should be 8021). It is very convenient 0100 # to test that here because it is hard to intentionally create 0101 # a file that will cause a FileReadError. So we take advantage 0102 # of the ROOT bug to implement the test. This bug actually 0103 # occurred, see Issue 42179 for details. 0104 echo "***" 0105 echo "***" 0106 echo "Exception in next test is INTENTIONAL. Test fails if not thrown or cmsRun returns wrong exit code" 0107 echo "***" 0108 echo "***" 0109 cmsRun -j FileReadErrorTest_jobreport.xml ${LOCAL_TEST_DIR}/SchemaEvolution_test_read_cfg.py --inputFile $inputfile && die 'SchemaEvolution_test_read_cfg.py with corrupt input did not throw an exception' 1 0110 CMSRUN_EXIT_CODE=$(edmFjrDump --exitCode FileReadErrorTest_jobreport.xml) 0111 if [ "x${CMSRUN_EXIT_CODE}" != "x8021" ]; then 0112 echo "cmsRun reported exit code ${CMSRUN_EXIT_CODE} which is different from the expected 8021 (FileReadError)" 0113 exit 1 0114 fi 0115 0116 # The test below would fail without the "--enableStreamerInfosFix" 0117 # because there was a bug in the version of ROOT associated with CMSSW_13_0_0. 0118 # The bug caused StreamerInfo objects to be missing from the ROOT file. In this case, 0119 # schema evolution fails without the fix and also the testForStreamerInfo.C script will 0120 # find missing StreamerInfo objects. 0121 cmsRun ${LOCAL_TEST_DIR}/SchemaEvolution_test_read_cfg.py --inputFile $inputfile --enableStreamerInfosFix || die "Failed to read old file $file with fix" $? 0122 0123 exit 0
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |