File indexing completed on 2024-08-06 22:36:35
0001
0002
0003 SCRAM_TEST_NAME=TestFWCoreReflectionClassVersionUpdate
0004 rm -rf $SCRAM_TEST_NAME
0005 mkdir $SCRAM_TEST_NAME
0006 cd $SCRAM_TEST_NAME
0007
0008
0009 NEW_CMSSW_BASE=$(/bin/pwd -P)/$CMSSW_VERSION
0010 scram -a $SCRAM_ARCH project $CMSSW_VERSION
0011 pushd $CMSSW_VERSION/src
0012
0013
0014 for DIR in ${CMSSW_BASE} ${CMSSW_RELEASE_BASE} ${CMSSW_FULL_RELEASE_BASE} ; do
0015 if [ -d ${DIR}/src/FWCore/Reflection ]; then
0016 mkdir FWCore
0017 cp -Lr ${DIR}/src/FWCore/Reflection FWCore/
0018 break
0019 fi
0020 done
0021 if [ ! -e FWCore/Reflection ]; then
0022 echo "Failed to symlink FWCore/Reflection from local or release area"
0023 exit 1;
0024 fi
0025
0026
0027 chmod -R u+w FWCore/Reflection/test/stubs
0028
0029
0030
0031
0032
0033
0034 echo "#define FWCORE_REFLECTION_TEST_INTOBJECT_V4" | cat - FWCore/Reflection/test/stubs/TestObjects.h > TestObjects.h.tmp
0035 mv TestObjects.h.tmp FWCore/Reflection/test/stubs/TestObjects.h
0036
0037
0038
0039 (eval $(scram run -sh) ; scram build -j $(nproc))
0040
0041 popd
0042
0043
0044 export LD_LIBRARY_PATH=${NEW_CMSSW_BASE}/lib/${SCRAM_ARCH}:${LD_LIBRARY_PATH}
0045 export ROOT_INCLUDE_PATH=${NEW_CMSSW_BASE}/src:${ROOT_INCLUDE_PATH}
0046
0047
0048 echo "Initial setup complete, now for the actual test"
0049 XMLPATH=${SCRAM_TEST_PATH}/stubs
0050 LIBFILE=libFWCoreReflectionTestObjects.so
0051
0052 function die { echo Failure $1: status $2 ; exit $2 ; }
0053 function runFailure {
0054 $1 -l ${LIBFILE} -x ${XMLPATH}/$2 > log.txt && die "$1 for $2 did not fail" 1
0055 grep -q "$3" log.txt
0056 RET=$?
0057 if [ "$RET" != "0" ]; then
0058 echo "$1 for $2 did not contain '$3', log is below"
0059 cat log.txt
0060 exit 1
0061 fi
0062 }
0063
0064 echo "edmCheckClassVersion tests"
0065
0066 runFailure edmCheckClassVersion classes_def.xml "error: class 'edmtest::reflection::IntObject' has a different checksum for ClassVersion 3. Increment ClassVersion to 4 and assign it to checksum 2954816125"
0067 runFailure edmCheckClassVersion test_def_v4.xml "error: for class 'edmtest::reflection::IntObject' ROOT says the ClassVersion is 3 but classes_def.xml says it is 4. Are you sure everything compiled correctly?"
0068
0069 edmCheckClassVersion -l ${LIBFILE} -x ${XMLPATH}/classes_def.xml -g || die "edmCheckClassVersion -g failed" $?
0070 diff -u ${XMLPATH}/test_def_v4.xml classes_def.xml.generated || die "classes_def.xml.generated differs from expectation" $?
0071
0072
0073 echo "edmDumpClassVersion tests"
0074
0075 edmDumpClassVersion -l ${LIBFILE} -x ${XMLPATH}/classes_def.xml -o dump.json
0076 diff -u ${SCRAM_TEST_PATH}/dumpClassVersion_reference_afterUpdate.json dump.json || die "Unexpected class version dump" $?