Skip to content

Commit

Permalink
[CORE] Various fixes/improvements for unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Mar 22, 2023
1 parent 7530dfd commit 6fa8be9
Show file tree
Hide file tree
Showing 25 changed files with 87 additions and 144 deletions.
15 changes: 4 additions & 11 deletions DataFormats/FWLite/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<environment>
<use name="cppunit"/>
</environment>
<bin name="testDataFormatsFWLiteMakeInput" file="TestRunnerDataFormatsFWLite.cpp">
<flags TEST_RUNNER_ARGS=" /bin/bash DataFormats/FWLite/test RefTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>
<use name="cppunit"/>
<test name="testDataFormatsFWLiteMakeInput" command="RefTest.sh"/>

<bin name="testDataFormatsFWLite" file="test.cppunit.cpp,format_type_name.cppunit.cpp">
<flags PRE_TEST="testDataFormatsFWLiteMakeInput"/>
Expand All @@ -13,8 +8,6 @@
<use name="DataFormats/TestObjects"/>
</bin>

<bin file="TestRunnerDataFormatsFWLite.cpp">
<test name="TestRunnerDataFormatsFWLite" command="run_all_t.sh">
<flags PRE_TEST="testDataFormatsFWLite"/>
<flags TEST_RUNNER_ARGS=" /bin/bash DataFormats/FWLite/test run_all_t.sh"/>
<use name="FWCore/Utilities"/>
</bin>
</test>
8 changes: 4 additions & 4 deletions DataFormats/FWLite/test/MergeTest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
rm -f ${LOCAL_TEST_DIR}/prod1.root ${LOCAL_TEST_DIR}/prod2.root ${LOCAL_TEST_DIR}/prodmerge.root
rm -f ${SCRAM_TEST_PATH}/prod1.root ${SCRAM_TEST_PATH}/prod2.root ${SCRAM_TEST_PATH}/prodmerge.root
rm -f prod1.root prod2.root prodmerge.root
cmsRun ${LOCAL_TEST_DIR}/ProdTest1_cfg.py
cmsRun ${LOCAL_TEST_DIR}/ProdTest2_cfg.py
cmsRun ${LOCAL_TEST_DIR}/ProdTestMerge_cfg.py
cmsRun ${SCRAM_TEST_PATH}/ProdTest1_cfg.py
cmsRun ${SCRAM_TEST_PATH}/ProdTest2_cfg.py
cmsRun ${SCRAM_TEST_PATH}/ProdTestMerge_cfg.py
10 changes: 5 additions & 5 deletions DataFormats/FWLite/test/RefTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ rm -f other_onlyDataFormatsFWLite.root good_delta5DataFormatsFWLite.root
rm -f partialEventDataFormatsFWLite.root refTestCopyDropDataFormatsFWLite.root

echo RefTest_cfg.py
cmsRun ${LOCAL_TEST_DIR}/RefTest_cfg.py || die "cmsRun RefTest_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/RefTest_cfg.py || die "cmsRun RefTest_cfg.py" $?
echo RefTest2_cfg.py
cmsRun ${LOCAL_TEST_DIR}/RefTest2_cfg.py || die "cmsRun RefTest2_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/RefTest2_cfg.py || die "cmsRun RefTest2_cfg.py" $?
echo EmptyFile_cfg.py
cmsRun ${LOCAL_TEST_DIR}/EmptyFile_cfg.py || die "cmsRun EmptyFile_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/EmptyFile_cfg.py || die "cmsRun EmptyFile_cfg.py" $?
echo PartialEventTest_cfg.py
cmsRun ${LOCAL_TEST_DIR}/PartialEventTest_cfg.py || die "cmsRun PartialEventTest_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/PartialEventTest_cfg.py || die "cmsRun PartialEventTest_cfg.py" $?
echo RefTestCopyDrop_cfg.py
cmsRun ${LOCAL_TEST_DIR}/RefTestCopyDrop_cfg.py || die "cmsRun RefTestCopyDrop_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/RefTestCopyDrop_cfg.py || die "cmsRun RefTestCopyDrop_cfg.py" $?

exit 0
8 changes: 4 additions & 4 deletions DataFormats/FWLite/test/RefTest_a.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
rm -f ${LOCAL_TEST_DIR}/good_a.root ${LOCAL_TEST_DIR}/good_b.root ${LOCAL_TEST_DIR}/empty_a.root
rm -f ${SCRAM_TEST_PATH}/good_a.root ${SCRAM_TEST_PATH}/good_b.root ${SCRAM_TEST_PATH}/empty_a.root
rm -f good_a.root good_b.root empty_a.root
cmsRun ${LOCAL_TEST_DIR}/RefTest_a_cfg.py
cmsRun ${LOCAL_TEST_DIR}/RefTest_b_cfg.py
cmsRun ${LOCAL_TEST_DIR}/EmptyFile_a_cfg.py
cmsRun ${SCRAM_TEST_PATH}/RefTest_a_cfg.py
cmsRun ${SCRAM_TEST_PATH}/RefTest_b_cfg.py
cmsRun ${SCRAM_TEST_PATH}/EmptyFile_a_cfg.py
3 changes: 0 additions & 3 deletions DataFormats/FWLite/test/TestRunnerDataFormatsFWLite.cpp

This file was deleted.

4 changes: 2 additions & 2 deletions DataFormats/FWLite/test/VIPTest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
rm -f ${LOCAL_TEST_DIR}/vectorinttest.root
rm -f ${SCRAM_TEST_PATH}/vectorinttest.root
rm -f vectorinttest.root
cmsRun ${LOCAL_TEST_DIR}/vip_cfg.py
cmsRun ${SCRAM_TEST_PATH}/vip_cfg.py
44 changes: 22 additions & 22 deletions DataFormats/FWLite/test/run_all_t.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
# Pass in name and status
function die { echo $1: status $2 ; exit $2; }

${LOCAL_TEST_DIR}/RefTest_a.sh || die 'Failed to create file' $?
root -b -n -q ${LOCAL_TEST_DIR}/event_looping_cint.C || die 'Failed in event_looping_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/event_looping_consumes_cint.C || die 'Failed in event_looping_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/chainevent_looping_cint.C || die 'Failed in chainevent_looping_cint.C' $?
python3 ${LOCAL_TEST_DIR}/chainEvent_python.py || die 'Failed in chainEvent_python.py' $?
#root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_std.C || die 'Failed in autoload_with_std.C' $?
#root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_missing_std.C || die 'Failed in autoload_with_missing_std.C' $?
${SCRAM_TEST_PATH}/RefTest_a.sh || die 'Failed to create file' $?
root -b -n -q ${SCRAM_TEST_PATH}/event_looping_cint.C || die 'Failed in event_looping_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/event_looping_consumes_cint.C || die 'Failed in event_looping_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/chainevent_looping_cint.C || die 'Failed in chainevent_looping_cint.C' $?
python3 ${SCRAM_TEST_PATH}/chainEvent_python.py || die 'Failed in chainEvent_python.py' $?
#root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_std.C || die 'Failed in autoload_with_std.C' $?
#root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_missing_std.C || die 'Failed in autoload_with_missing_std.C' $?

${LOCAL_TEST_DIR}/MergeTest.sh || die 'Failed to create file' $?
root -b -n -q ${LOCAL_TEST_DIR}/runlumi_looping_cint.C || die 'Failed in runlumi_looping_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/productid_cint.C || die 'Failed in productid_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/triggernames_cint.C || die 'Failed in triggernames_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/triggernames_multi_cint.C || die 'Failed in triggernames_multi_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/triggerResultsByName_cint.C || die 'Failed in triggerResultsByName_cint.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/triggerResultsByName_multi_cint.C || die 'Failed in triggerResultsByName_multi_cint.C' $?
${SCRAM_TEST_PATH}/MergeTest.sh || die 'Failed to create file' $?
root -b -n -q ${SCRAM_TEST_PATH}/runlumi_looping_cint.C || die 'Failed in runlumi_looping_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/productid_cint.C || die 'Failed in productid_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/triggernames_cint.C || die 'Failed in triggernames_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/triggernames_multi_cint.C || die 'Failed in triggernames_multi_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/triggerResultsByName_cint.C || die 'Failed in triggerResultsByName_cint.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/triggerResultsByName_multi_cint.C || die 'Failed in triggerResultsByName_multi_cint.C' $?

${LOCAL_TEST_DIR}/VIPTest.sh || die 'Failed to create file' $?
root -b -n -q ${LOCAL_TEST_DIR}/vector_int_cint.C || die 'Failed in vector_int_cint.C' $?
${SCRAM_TEST_PATH}/VIPTest.sh || die 'Failed to create file' $?
root -b -n -q ${SCRAM_TEST_PATH}/vector_int_cint.C || die 'Failed in vector_int_cint.C' $?

python3 ${LOCAL_TEST_DIR}/pyroot_handle_reuse.py || die 'Failed in pyroot_handle_reuse.py' $?
python3 ${LOCAL_TEST_DIR}/pyroot_multichain.py inputFiles=file:prodmerge.root secondaryInputFiles=file:prod1.root,file:prod2.root || die 'Failed in pyroot_multichain.py (non-empty files)' $?
python3 ${LOCAL_TEST_DIR}/pyroot_multichain.py inputFiles=file:empty_a.root secondaryInputFiles=file:good_a.root || die 'Failed in pyroot_multichain.py (empty file)' $?
python3 ${SCRAM_TEST_PATH}/pyroot_handle_reuse.py || die 'Failed in pyroot_handle_reuse.py' $?
python3 ${SCRAM_TEST_PATH}/pyroot_multichain.py inputFiles=file:prodmerge.root secondaryInputFiles=file:prod1.root,file:prod2.root || die 'Failed in pyroot_multichain.py (non-empty files)' $?
python3 ${SCRAM_TEST_PATH}/pyroot_multichain.py inputFiles=file:empty_a.root secondaryInputFiles=file:good_a.root || die 'Failed in pyroot_multichain.py (empty file)' $?

#NOTE: ROOT has a bug which keeps the AssociationVector from running its ioread rule and therefore it never clears its cache
#test AssociationVector reading
#rm -f ${LOCAL_TEST_DIR}/avtester.root
#rm -f ${SCRAM_TEST_PATH}/avtester.root
#rm -f avtester.root
#cmsRun ${LOCAL_TEST_DIR}/make_associationvector_file_cfg.py || die "cmsRun make_associationvector_file_cfg.py " $?
#python ${LOCAL_TEST_DIR}/pyroot_read_associationvector.py || die 'Failed in pyroot_read_associationvector.py'
#cmsRun ${SCRAM_TEST_PATH}/make_associationvector_file_cfg.py || die "cmsRun make_associationvector_file_cfg.py " $?
#python ${SCRAM_TEST_PATH}/pyroot_read_associationvector.py || die 'Failed in pyroot_read_associationvector.py'
9 changes: 2 additions & 7 deletions FWCore/FWLite/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<environment>
<use name="cppunit"/>
</environment>
<use name="cppunit"/>
<bin name="testFWCoreFWLite" file="ref_t.cppunit.cpp">
<use name="FWCore/FWLite"/>
<use name="DataFormats/TestObjects"/>
</bin>

<bin file="TestRunnerFWCoreFWLite.cpp">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/FWLite/test run_all_t.sh"/>
<use name="FWCore/Utilities"/>
</bin>
<test name="TestRunnerFWCoreFWLite" command="run_all_t.sh"/>
10 changes: 5 additions & 5 deletions FWCore/FWLite/test/RefTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

function die { echo Failure $1: status $2 ; exit $2 ; }

rm -f ${LOCAL_TEST_DIR}/good.root
rm -f ${LOCAL_TEST_DIR}/good2.root
rm -f ${LOCAL_TEST_DIR}/good_delta5.root
rm -f ${SCRAM_TEST_PATH}/good.root
rm -f ${SCRAM_TEST_PATH}/good2.root
rm -f ${SCRAM_TEST_PATH}/good_delta5.root
rm -f good.root
rm -f good2.root
rm -f good_delta5.root

cmsRun ${LOCAL_TEST_DIR}/RefTest_cfg.py || die "cmsRun RefTest_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/RefTest_cfg.py || die "cmsRun RefTest_cfg.py" $?

cmsRun ${LOCAL_TEST_DIR}/RefTest2_cfg.py || die "cmsRun RefTest2_cfg.py" $?
cmsRun ${SCRAM_TEST_PATH}/RefTest2_cfg.py || die "cmsRun RefTest2_cfg.py" $?
3 changes: 0 additions & 3 deletions FWCore/FWLite/test/TestRunnerFWCoreFWLite.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions FWCore/FWLite/test/run_all_t.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# Pass in name and status
function die { echo $1: status $2 ; exit $2; }

root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_namespace.C || die 'Failed in autoload_with_namespace.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_std.C || die 'Failed in autoload_with_std.C' $?
root -b -n -q ${LOCAL_TEST_DIR}/autoload_with_missing_std.C || die 'Failed in autoload_with_missing_std.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_namespace.C || die 'Failed in autoload_with_namespace.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_std.C || die 'Failed in autoload_with_std.C' $?
root -b -n -q ${SCRAM_TEST_PATH}/autoload_with_missing_std.C || die 'Failed in autoload_with_missing_std.C' $?


20 changes: 8 additions & 12 deletions FWCore/Modules/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<environment>
<bin file="TestIntegration.cpp" name="TestFWCoreModules">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Modules/test FWCoreModulesTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>
<test name="TestFWCoreModules" command="FWCoreModulesTest.sh"/>

<test name="TestFWCoreModulesEmptySourceLumiForRuns" command="cmsRun ${LOCALTOP}/src/FWCore/Modules/test/emptysource_firstLuminosityBlockForEachRun_cfg.py"/>
<test name="TestFWCoreModulesEmptySourceRunsAndLumis" command="cmsRun ${LOCALTOP}/src/FWCore/Modules/test/emptysource_RunsAndLumis_cfg.py"/>
<bin file="test_catch2_*.cc" name="TestFWCoreModulesTP">
<use name="FWCore/TestProcessor"/>
<use name="catch2"/>
</bin>
<test name="TestFWCoreModulesEmptySourceLumiForRuns" command="cmsRun ${LOCALTOP}/src/FWCore/Modules/test/emptysource_firstLuminosityBlockForEachRun_cfg.py"/>

</environment>
<test name="TestFWCoreModulesEmptySourceRunsAndLumis" command="cmsRun ${LOCALTOP}/src/FWCore/Modules/test/emptysource_RunsAndLumis_cfg.py"/>

<bin file="test_catch2_*.cc" name="TestFWCoreModulesTP">
<use name="FWCore/TestProcessor"/>
<use name="catch2"/>
</bin>
16 changes: 6 additions & 10 deletions FWCore/Modules/test/FWCoreModulesTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@

function die { echo $1: status $2; exit $2; }

pushd ${LOCAL_TMP_DIR}

echo ContentTest
cmsRun ${LOCAL_TEST_DIR}/ContentTest_cfg.py || die 'failed running cmsRun ContentTest_cfg.py' $?
cmsRun ${SCRAM_TEST_PATH}/ContentTest_cfg.py || die 'failed running cmsRun ContentTest_cfg.py' $?
echo printeventsetupcontent
cmsRun ${LOCAL_TEST_DIR}/printeventsetupcontent_cfg.py || die 'failed running cmsRun printeventsetupcontent_cfg.py' $?
cmsRun ${SCRAM_TEST_PATH}/printeventsetupcontent_cfg.py || die 'failed running cmsRun printeventsetupcontent_cfg.py' $?
echo geteventsetupcontent
cmsRun ${LOCAL_TEST_DIR}/geteventsetupcontent_cfg.py || die 'failed running cmsRun geteventsetupcontent_cfg.py' $?
cmsRun ${SCRAM_TEST_PATH}/geteventsetupcontent_cfg.py || die 'failed running cmsRun geteventsetupcontent_cfg.py' $?
echo checkcacheidentifier
cmsRun ${LOCAL_TEST_DIR}/checkcacheidentifier_cfg.py || die 'failed running cmsRun checkcacheidentifier_cfg.py' $?
cmsRun ${SCRAM_TEST_PATH}/checkcacheidentifier_cfg.py || die 'failed running cmsRun checkcacheidentifier_cfg.py' $?
echo testPathStatusFilter
cmsRun ${LOCAL_TEST_DIR}/testPathStatusFilter_cfg.py || die 'failed running cmsRun testPathStatusFilter_cfg.py' $?
cmsRun ${SCRAM_TEST_PATH}/testPathStatusFilter_cfg.py || die 'failed running cmsRun testPathStatusFilter_cfg.py' $?
echo sleepingModules
cmsRun ${LOCAL_TEST_DIR}/sleepingModules_cfg.py || die 'failed running cmsRun sleepingModules_cfg.py' $?

popd
cmsRun ${SCRAM_TEST_PATH}/sleepingModules_cfg.py || die 'failed running cmsRun sleepingModules_cfg.py' $?
3 changes: 0 additions & 3 deletions FWCore/Modules/test/TestIntegration.cpp

This file was deleted.

5 changes: 1 addition & 4 deletions FWCore/ParameterSet/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
<use name="boost"/>
</bin>

<bin file="TestFWCoreParameterSetDriver.cpp">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/ParameterSet/test runPythonTests.sh"/>
<use name="FWCore/Utilities"/>
</bin>
<test name="TestFWCoreParameterSetDriver" command="runPythonTests.sh"/>

<bin name="testDefaultModuleLabel" file="defaultModuleLabel_t.cc">
<use name="cppunit"/>
Expand Down
3 changes: 0 additions & 3 deletions FWCore/ParameterSet/test/TestFWCoreParameterSetDriver.cpp

This file was deleted.

5 changes: 1 addition & 4 deletions FWCore/PythonFramework/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<bin file="TestFWCorePythonFrameworkDriver.cpp">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/PythonFramework/test runPythonTests.sh"/>
<use name="FWCore/Utilities"/>
</bin>
<test name="TestFWCorePythonFrameworkDriver" command="runPythonTests.sh"/>

<library file="PythonTestProducer.cc" name="PythonTestProducer">
<flags EDM_PLUGIN="1"/>
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion FWCore/PythonFramework/test/runPythonTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ do
done

echo "running test_producer.py"
${python_cmd} ${LOCAL_TEST_DIR}/test_producer.py || die "test_producer.py failed" $?
${python_cmd} ${SCRAM_TEST_PATH}/test_producer.py || die "test_producer.py failed" $?
4 changes: 1 addition & 3 deletions FWCore/Utilities/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<use name="boost"/>
<use name="FWCore/Utilities"/>

<bin file="TestHelper_t.cpp">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Utilities/test one.sh two.sh testFriendlyNames.sh testAdler32.sh"/>
</bin>
<test name="TestHelper_t" command="${value}.sh" foreach="testFriendlyNames,testAdler32"/>

<bin file="atomic_value_ptr_t.cpp">
</bin>
Expand Down
2 changes: 0 additions & 2 deletions FWCore/Utilities/test/TestHelper_t.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion FWCore/Utilities/test/testAdler32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
echo "===== Running test of cms_adler32 ======"

expect="fd466a74"
results=`cms_adler32 $LOCAL_TEST_DIR/doNotModify.txt | awk '{print $1}'`
results=`cms_adler32 ${SCRAM_TEST_PATH}/doNotModify.txt | awk '{print $1}'`

if [ "$results" != "$expect" ]; then
echo "result: " $results
Expand Down
4 changes: 1 addition & 3 deletions IOMC/RandomEngine/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@
<flags EDM_PLUGIN="1"/>
</library>

<bin file="TestIOMCRandomEngineService.cpp">
<flags TEST_RUNNER_ARGS=" /bin/bash IOMC/RandomEngine/test testRandomService.sh"/>
</bin>
<test name="TestIOMCRandomEngineService" command="testRandomService.sh"/>
3 changes: 0 additions & 3 deletions IOMC/RandomEngine/test/TestIOMCRandomEngineService.cpp

This file was deleted.

Loading

0 comments on commit 6fa8be9

Please sign in to comment.