Skip to content

Commit

Permalink
Merge pull request #24627 from smuzaffar/103X-poisoned-datafiles
Browse files Browse the repository at this point in the history
Added unit test to make sure poisoned datafiles are not read from release
  • Loading branch information
cmsbuild committed Sep 25, 2018
2 parents 84f0523 + 74baff3 commit fd7eaa2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CondTools/Geometry/test/BuildFile.xml
Expand Up @@ -28,3 +28,4 @@
<flags EDM_PLUGIN="1"/>
</library>

<test name="test-data-file-deletion" command="test-data-file-deletion.sh"/>
18 changes: 18 additions & 0 deletions CondTools/Geometry/test/test-data-file-deletion.sh
@@ -0,0 +1,18 @@
#!/bin/bash -ex
cd $CMSSW_BASE
rm -rf test-data-file-deletion
mkdir -p test-data-file-deletion/src/Geometry/CMSCommonData/data/dir-for-data-file
#Create symlink for datafile to point to the directory. cmsRun should fail to open this datafile via FileInPath mechanism
ln -s dir-for-data-file test-data-file-deletion/src/Geometry/CMSCommonData/data/materials.xml
ERR=0
pushd test-data-file-deletion
CMSSW_SEARCH_PATH=$(pwd)/src:${CMSSW_SEARCH_PATH} cmsRun $CMSSW_BASE/src/CondTools/Geometry/test/writehelpers/geometryxmlwriter.py || ERR=$?
popd
let FILE_IN_PATH_ERROR=$(grep ' FileInPathError *= *' $CMSSW_RELEASE_BASE/src/FWCore/Utilities/interface/EDMException.h | sed 's|.*= *||;s|,.*$||')%256
rm -rf test-data-file-deletion
if [ "$ERR" = "$FILE_IN_PATH_ERROR" ] ; then
exit 0
fi

echo "ERROR: This tests should have failed with FileInPath error."
exit 1

0 comments on commit fd7eaa2

Please sign in to comment.