Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
#!/bin/bash -ex

SCRAM_TEST_NAME=TestFWCoreSkeletons

# Create a new CMSSW dev area
OLD_CMSSW_BASE=$CMSSW_BASE
rm -rf $SCRAM_TEST_NAME
mkdir $SCRAM_TEST_NAME
cd $SCRAM_TEST_NAME
scram -a $SCRAM_ARCH project $CMSSW_VERSION
cd $CMSSW_VERSION/src
eval `scram run -sh`
git init

# Copy FWCore/Skeletons in cause unit test is run during PR tests which contains changes for FWCore/Skeletons
if [ -d $OLD_CMSSW_BASE/src/FWCore/Skeletons ] ; then
    mkdir FWCore
    cp -r $OLD_CMSSW_BASE/src/FWCore/Skeletons FWCore/Skeletons
    scram build
fi

# Create TestSubsystem for testing the scripts
mkdir TestSubsystem

# Test output of scripts that can be easily compiled
pushd TestSubsystem

mkdqmedanalyzer TestDQMAnalyzerStream example_stream -author "Test Author"
mkdqmedanalyzer TestDQMAnalyzerGlobal example_global -author "Test Author"
mkdqmedanalyzer -debug TestDQMAnalyzerStrDbg example_stream -author "Test Author"
mkdqmedanalyzer -debug TestDQMAnalyzerGlbDbg example_global -author "Test Author"

mkedanlzr TestEDAnalyzer -author "Test Author"
mkedanlzr TestEDAnalyzerHisto example_histo -author "Test Author"

mkedfltr TestEDFilter -author "Test Author"

mkedprod TestEDProducer -author "Test Author"
mkedprod TestEDProducerParticle example_myparticle -author "Test Author"

mkrecord TestRecord -author "Test Author"

popd
git add TestSubsystem
git commit -a -m "Add skeleton modules that can be easily compiled"
scram build

# Test output of scripts for which compilation would be difficult, but
# code-checks/code-format still works
pushd TestSubsystem

mkdatapkg TestDataPackage -author "Test Author"

mkskel TestSkeleton -author "Test Author"

popd
git add TestSubsystem
git commit -a -m "Other skeletong code"
scram b code-checks-all
scram b code-format-all
git diff
if [ $(git diff --name-only | grep TestSubsystem | wc -l) -gt 0 ] ; then
    echo "code-checks or code-format caused differences, skeleton templates need to be updated!"
    exit 1
fi

# Test output of scripts for which compilation, code-checks, and
# code-format would be difficult
pushd TestSubsystem
mkedlpr TestEDLooper -author "Test Author"
mkedlpr TestEDLooperRecData TestRecord TestData1 TestData2 -author "Test Author"

mkesprod TestESProducer -author "Test Author"
mkesprod TestESProducerRec TestRecord -author "Test Author"
mkesprod TestESProducerRecData TestRecord TestData -author "Test Author"
popd