cms-sw / cmssw

CMS Offline Software
http://cms-sw.github.io/
Apache License 2.0
1.08k stars 4.3k forks source link

Improve Skeleton templates and scripts #29850

Open makortel opened 4 years ago

makortel commented 4 years ago

Some follow-up items from #29840

And to not forget, https://github.com/cms-sw/cmssw/issues/26618 has also a few items left.

makortel commented 4 years ago

assign core

cmsbuild commented 4 years ago

New categories assigned: core

@Dr15Jones,@smuzaffar,@makortel you have been requested to review this Pull request/Issue and eventually sign? Thanks

cmsbuild commented 4 years ago

A new Issue was created by @makortel Matti Kortelainen.

@Dr15Jones, @silviodonato, @dpiparo, @smuzaffar, @makortel can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

makortel commented 2 years ago

@smuzaffar The template scripts heavily assume being run in $CMSSW_BASE/src/Package. What would be the best way to craft a script testing these scripts? I'm thinking questions like

(spurred by https://mattermost.web.cern.ch/cms-o-and-c/pl/kgpdtbtdzfyi8ezs9brdqf7awc)

smuzaffar commented 2 years ago

@makortel I would suggest to do something like the following in the testing script

#!/bin/bash -ex
#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 cms-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 Test Subsystem for testing the mkedanlzr
mkdir Test
pushd Test
  mkedanlzr Analyzer
  mkedanlzr Producer
popd
git add Test
git commit -a -m 'Added Test/Analyzer'
scram b code-checks-all
scram b code-format-all
git diff
if [ $(git diff --name-only | grep Test/Analyzer |wc -l) -gt 0 ] ; then
  exit 1
fi
scram build
makortel commented 2 years ago

Thanks @smuzaffar! I followed your suggestion in https://github.com/cms-sw/cmssw/pull/37125, and at least in local tests it seems to work fine.