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 10, 2023
1 parent 166eab1 commit 795ad23
Show file tree
Hide file tree
Showing 47 changed files with 84 additions and 321 deletions.
9 changes: 3 additions & 6 deletions FWCore/Concurrency/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@

<bin file="test_threadSafeOutputFileStream.cpp">
<use name="FWCore/Concurrency"/>
<flags NO_TESTRUN="1"/>
<flags TEST_RUNNER_CMD="run_threadSafeOutputFileStream_test.sh"/>
</bin>

<bin file="ThreadSafeAddOnlyContainer_t.cpp">
<use name="FWCore/Concurrency"/>
</bin>

<bin file="TestFWCoreConcurrencyDriver.cpp">
<use name="FWCore/Utilities"/>
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Concurrency/test run_streamGrapher_test.sh run_threadSafeOutputFileStream_test.sh"/>
</bin>
<test name="TestFWCoreConcurrencyDriver" command="run_streamGrapher_test.sh"/>

<bin name="testFWCoreConcurrencyTBB.cc" file="TestTBB.cc">
<bin name="testFWCoreConcurrencyTBB" file="TestTBB.cc">
<use name="tbb"/>
</bin>

Expand Down
8 changes: 0 additions & 8 deletions FWCore/Concurrency/test/TestFWCoreConcurrencyDriver.cpp

This file was deleted.

1 change: 1 addition & 0 deletions FWCore/Concurrency/test/run_streamGrapher_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
cmsRun ${LOCAL_TEST_DIR}/streamGrapher_make_file_to_read_cfg.py || die "cmsRun streamGrapher_make_file_to_read_cfg.py" $?
cmsRun ${LOCAL_TEST_DIR}/streamGrapher_stallMonitor_cfg.py > raw_output.log 2>&1 || die "cmsRun streamGrapher_stallMonitor_cfg.py" $?
grep '+' raw_output.log > output_from_tracer.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
# linebreaks, I replaced the line breaks with semicolons, and compare
# accordingly.

pushd ${LOCAL_TMP_DIR}

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

test_threadSafeOutputFileStream || die "test_ThreadSafeOutputFileStream" $?
Expand All @@ -37,5 +35,3 @@ do
comparison="Thread index: ${thindex} Entry: 0;Thread index: ${thindex} Entry: 1;Thread index: ${thindex} Entry: 2;Thread index: ${thindex} Entry: 3;"
[[ "$( grep "Thread index: ${thindex}" thread_safe_ofstream_test.txt | tr \\n \; )" == "${comparison}" ]] || die "test_ThreadSafeOutputFileStream_output" $?
done

popd
193 changes: 31 additions & 162 deletions FWCore/Integration/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<environment>
<flags USE_UNITTEST_DIR="1"/>
<bin name="TestFWCoreIntegrationStandalone" file="testRunner.cpp,standalone_t.cppunit.cc">
<use name="cppunit"/>
<use name="FWCore/Framework"/>
Expand All @@ -7,158 +8,39 @@
<use name="FWCore/ParameterSetReader"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationEventHistory">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test eventHistoryTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationRef">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test refTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationTransRef">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test transRefTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationTableTest">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test testTables.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationProducedSource">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test inputSourceTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationExternalSource">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test inputExtSourceTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationEventSetup">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test eventSetupTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationHierarchyExample">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test hierarchy_example.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationServiceExample">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test service_example.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationView">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test ViewTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationSeriesOfProcesses">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_SeriesOfProcesses.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestParentageWithStreamerIO">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_ParentageWithStreamerIO.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationThinningTests">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_ThinningTests.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationGetBy">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_TestGetBy.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationOutput">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_TestOutput.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationDropOnInput">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_TestDropOnInput.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestSubProcess">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_SubProcess.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationUnscheduledFailOnOutput">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_unscheduledFailOnOutput.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationGetProductAtEnd">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_getProductAtEnd.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationParentless">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test parentlessTest.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationWaitingThread">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test waiting_thread_test.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationRunMerge">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_RunMerge.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationRunMerge2">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_RunMerge2.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationRefMerge">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_RefMerge.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationRefAlias">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_RefAlias.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationParameterSet">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_ParameterSet.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegrationSwitchProducer">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_TestSwitchProducer.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin file="TestIntegration.cpp" name="TestIntegration_TestEDAlias">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_TestEDAlias.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<test name="TestIntegrationEventHistory" command="eventHistoryTest.sh"/>
<test name="TestIntegrationRef" command="refTest.sh"/>
<test name="TestIntegrationTransRef" command="transRefTest.sh"/>
<test name="TestIntegrationTableTest" command="testTables.sh"/>
<test name="TestIntegrationProducedSource" command="inputSourceTest.sh"/>
<test name="TestIntegrationExternalSource" command="inputExtSourceTest.sh"/>
<test name="TestIntegrationEventSetup" command="eventSetupTest.sh"/>
<test name="TestIntegrationHierarchyExample" command="hierarchy_example.sh"/>
<test name="TestIntegrationServiceExample" command="service_example.sh"/>
<test name="TestIntegrationView" command="ViewTest.sh"/>
<test name="TestIntegrationSeriesOfProcesses" command="run_SeriesOfProcesses.sh"/>
<test name="TestParentageWithStreamerIO" command="run_ParentageWithStreamerIO.sh"/>
<test name="TestIntegrationThinningTests" command="run_ThinningTests.sh"/>
<test name="TestIntegrationGetBy" command="run_TestGetBy.sh"/>
<test name="TestIntegrationOutput" command="run_TestOutput.sh"/>
<test name="TestIntegrationDropOnInput" command="run_TestDropOnInput.sh"/>
<test name="TestSubProcess" command="run_SubProcess.sh"/>
<test name="TestIntegrationUnscheduledFailOnOutput" command="run_unscheduledFailOnOutput.sh"/>
<test name="TestIntegrationGetProductAtEnd" command="run_getProductAtEnd.sh"/>
<test name="TestIntegrationParentless" command="parentlessTest.sh"/>
<test name="TestIntegrationWaitingThread" command="waiting_thread_test.sh"/>
<test name="TestIntegrationRunMerge" command="run_RunMerge.sh"/>
<test name="TestIntegrationRunMerge2" command="run_RunMerge2.sh"/>
<test name="TestIntegrationRefMerge" command="run_RefMerge.sh"/>
<test name="TestIntegrationRefAlias" command="run_RefAlias.sh"/>
<test name="TestIntegrationParameterSet" command="run_ParameterSet.sh"/>
<test name="TestIntegrationSwitchProducer" command="run_TestSwitchProducer.sh"/>
<test name="TestIntegration_TestEDAlias" command="run_TestEDAlias.sh"/>
<test name="TestIntegrationProcessAccelerator" command="run_TestProcessAccelerator.sh"/>

<test name="TestFWCoreIntegrationModuleTypeResolver" command="run_TestModuleTypeResolver.sh"/>

<test name="CatchStdExceptiontest" command="CatchStdExceptiontest.sh"/>

<test name="CatchCmsExceptiontest" command="CatchCmsExceptiontest.sh"/>

<bin file="TestIntegration.cpp" name="TestIntegrationExistingDictionary">
<flags TEST_RUNNER_ARGS=" /bin/bash FWCore/Integration/test run_TestExistingDictionary.sh"/>
<use name="FWCore/Utilities"/>
</bin>
<test name="TestIntegrationExistingDictionary" command="run_TestExistingDictionary.sh"/>

<bin file="ProcessConfiguration_t.cpp,ProcessHistory_t.cpp" name="TestIntegrationDataFormatsProvenance">
<use name="FWCore/ParameterSet"/>
Expand Down Expand Up @@ -210,7 +92,6 @@
<test name="testFWCoreIntegrationTransform_noPut" command="! cmsRun ${LOCALTOP}/src/FWCore/Integration/test/transformTest_cfg.py -- --noPut"/>
<test name="testFWCoreIntegrationTransform_noPut_async" command="! cmsRun ${LOCALTOP}/src/FWCore/Integration/test/transformTest_cfg.py -- --noPut --async_"/>


<test name="TestFWCoreIntegrationModuleThread" command="cmsRun ${LOCALTOP}/src/FWCore/Integration/test/moduleThread_test_cfg.py"/>

<bin file="RandomIntProducer_t.cpp">
Expand All @@ -222,24 +103,12 @@
</bin>

<test name="TestFWCoreIntegrationInterProcess" command="cmsRun ${LOCALTOP}/src/FWCore/Integration/test/test_TestInterProcessProd_cfg.py"/>

<test name="TestFWCoreIntegrationPutOrMerge" command="cmsRun ${LOCALTOP}/src/FWCore/Integration/test/putOrMergeTest_cfg.py"/>

<test name="TestFWCoreIntegrationInputSourceAlias" command="cmsRun ${LOCALTOP}//src/FWCore/Integration/test/inputSource_alias_Test_cfg.py"/>

<test name="TestFWCoreIntegrationEDLooperESProcuer" command="cmsRun ${LOCALTOP}/src/FWCore/Integration/test/testEDLooperESProducer_cfg.py"/>

<test name="TestFWCoreIntegrationDelayedReaderTest" command="delayedreader_throw_test.sh"/>

<test name="TestFrameworkExceptionHandling1" command="run_TestFrameworkExceptionHandling.sh 1"/>
<test name="TestFrameworkExceptionHandling2" command="run_TestFrameworkExceptionHandling.sh 2"/>
<test name="TestFrameworkExceptionHandling3" command="run_TestFrameworkExceptionHandling.sh 3"/>
<test name="TestFrameworkExceptionHandling4" command="run_TestFrameworkExceptionHandling.sh 4"/>
<test name="TestFrameworkExceptionHandling5" command="run_TestFrameworkExceptionHandling.sh 5"/>
<test name="TestFrameworkExceptionHandling6" command="run_TestFrameworkExceptionHandling.sh 6"/>
<test name="TestFrameworkExceptionHandling7" command="run_TestFrameworkExceptionHandling.sh 7"/>
<test name="TestFrameworkExceptionHandling8" command="run_TestFrameworkExceptionHandling.sh 8"/>
<test name="TestFrameworkExceptionHandling9" command="run_TestFrameworkExceptionHandling.sh 9"/>
<test name="TestFrameworkExceptionHandling" command="run_TestFrameworkExceptionHandling.sh ${value}" for="1,9"/>

<test name="TestIntegrationProcessBlock1" command="run_TestProcessBlock.sh 1"/>
<test name="TestIntegrationProcessBlock2" command="run_TestProcessBlock.sh 2"/>
Expand Down
8 changes: 1 addition & 7 deletions FWCore/Integration/test/CatchCmsExceptiontest.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/bin/sh
set -x
LOCAL_TEST_DIR=${CMSSW_BASE}/src/FWCore/Integration/test
LOCAL_TMP_DIR=${CMSSW_BASE}/tmp/${SCRAM_ARCH}

LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
# Pass in name and status
function die { echo $1: status $2 ; exit $2; }

pushd ${LOCAL_TMP_DIR}

cmsRun ${LOCAL_TEST_DIR}/CatchCmsExceptiontest_cfg.py &> CatchCmsException.log && die 'Failed in using CatchCmsException_cfg.py' 1

grep -q WhatsItESProducer CatchCmsException.log || die 'Failed to find Producers name' $?
Expand All @@ -26,6 +22,4 @@ grep -q WhatsItESProducer CatchCmsException.log || die 'Failed to find Producers
cmsRun ${LOCAL_TEST_DIR}/testMissingDictionaryChecking_cfg.py &> testMissingDictionaryChecking.log && die 'Failed to get exception running testMissingDictionaryChecking_cfg.py' 1
grep -q MissingDictionaryTestF testMissingDictionaryChecking.log || die 'Failed to print out exception message with missing dictionary listed' $?

popd

#grep -w ESProducer CatcheStdException.log
7 changes: 1 addition & 6 deletions FWCore/Integration/test/CatchStdExceptiontest.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
#!/bin/sh
set -x
LOCAL_TEST_DIR=${CMSSW_BASE}/src/FWCore/Integration/test
LOCAL_TMP_DIR=${CMSSW_BASE}/tmp/${SCRAM_ARCH}
LOCAL_TEST_DIR=${SCRAM_TEST_PATH}

# Pass in name and status
function die { echo $1: status $2 ; echo === Test log === ; cat ${3:-/dev/null} ; echo === End test log === ; exit $2; }

pushd ${LOCAL_TMP_DIR}

cmsRun ${LOCAL_TEST_DIR}/CatchStdExceptiontest_cfg.py &> CatchStdException.log && die 'Failed in using CatchStdException_cfg.py' 1 CatchStdException.log

grep -q WhatsItESProducer CatchStdException.log || die 'Failed to find Producers name' $? CatchStdException.log
#grep -w ESProducer CatcheStdException.log

popd

3 changes: 0 additions & 3 deletions FWCore/Integration/test/TestIntegration.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion FWCore/Integration/test/ViewTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

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

cmsRun --parameter-set ${LOCAL_TEST_DIR}/ViewTest_cfg.py || die 'Failed in ViewTest_cfg.py' $?
cmsRun --parameter-set ${SCRAM_TEST_PATH}/ViewTest_cfg.py || die 'Failed in ViewTest_cfg.py' $?
9 changes: 2 additions & 7 deletions FWCore/Integration/test/delayedreader_throw_test.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#!/bin/bash
set -x
LOCAL_TEST_DIR=${CMSSW_BASE}/src/FWCore/Integration/test
LOCAL_TMP_DIR=${CMSSW_BASE}/tmp/${SCRAM_ARCH}

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

pushd ${LOCAL_TMP_DIR}
cmsRun ${SCRAM_TEST_PATH}/delayedreader_throw_cfg.py && die "cmsRun delayedreader_throw_cfg.py did not fail" 1

cmsRun ${LOCAL_TEST_DIR}/delayedreader_throw_cfg.py && die "cmsRun ${test}delayedreader_throw_cfg.py did not fail" 1

popd
exit 0
exit 0
2 changes: 1 addition & 1 deletion FWCore/Integration/test/detsetvector_t.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

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

cmsRun --parameter-set ${LOCAL_TEST_DIR}/detsetvector_t_cfg.py || die 'Failed in detsetvector_t_cfg.py' $?
cmsRun --parameter-set ${SCRAM_TEST_PATH}/detsetvector_t_cfg.py || die 'Failed in detsetvector_t_cfg.py' $?

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

pushd ${LOCAL_TMP_DIR}
LOCAL_TEST_DIR=${SCRAM_TEST_PATH}

# Write a file for the FIRST process
cmsRun --parameter-set ${LOCAL_TEST_DIR}/EventHistory_1_cfg.py || die 'Failed in EventHistory_1' $?
Expand Down Expand Up @@ -46,5 +46,3 @@ cmsRun --parameter-set ${LOCAL_TEST_DIR}/EventHistory_SubProcess_cfg.py || die '
echo "*************************************************"
echo "**************** Finished pass SubProcess *******"
echo "*************************************************"

popd
4 changes: 1 addition & 3 deletions FWCore/Integration/test/eventSetupTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function die { echo $1: status $2 ; exit $2; }
function diecat { echo "$1: status $2, log" ; cat $3; exit $2; }

pushd ${LOCAL_TMP_DIR}
LOCAL_TEST_DIR=${SCRAM_TEST_PATH}

cmsRun --parameter-set ${LOCAL_TEST_DIR}/EventSetupTest_cfg.py || die 'Failed in EventSetupTest_cfg.py' $?
cmsRun --parameter-set ${LOCAL_TEST_DIR}/EventSetupAppendLabelTest_cfg.py || die 'Failed in EventSetupAppendLabelTest_cfg.py' $?
Expand Down Expand Up @@ -46,5 +46,3 @@ cmsRun --parameter-set ${LOCAL_TEST_DIR}/testConcurrentIOVsAndRuns_cfg.py || die

echo testConcurrentIOVsAndRunsRead_cfg.py
cmsRun --parameter-set ${LOCAL_TEST_DIR}/testConcurrentIOVsAndRunsRead_cfg.py || die 'Failed in testConcurrentIOVsAndRunsRead_cfg.py' $?

popd
2 changes: 1 addition & 1 deletion FWCore/Integration/test/hierarchy_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

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

cmsRun --parameter-set ${LOCAL_TEST_DIR}/hierarchy_example_cfg.py || die 'Failed in hierarchy_example_cfg.py' $?
cmsRun --parameter-set ${SCRAM_TEST_PATH}/hierarchy_example_cfg.py || die 'Failed in hierarchy_example_cfg.py' $?

Loading

0 comments on commit 795ad23

Please sign in to comment.