Skip to content

Commit e5c35d7

Browse files
committed
Reorganize IOPool/Input unit tests
1 parent ab76956 commit e5c35d7

File tree

4 files changed

+96
-90
lines changed

4 files changed

+96
-90
lines changed

IOPool/Input/test/BuildFile.xml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<environment>
2-
<test name="TestPoolInput" command="TestPoolInput.sh"/>
3-
42
<library file="IOExerciser.cc" name="IOExerciser">
53
<flags EDM_PLUGIN="1"/>
64
<use name="FWCore/Framework"/>
@@ -21,10 +19,24 @@
2119
<use name="FWCore/Utilities"/>
2220
</library>
2321

22+
<test name="TestPoolInput" command="TestPoolInput.sh"/>
23+
<test name="TestPoolInputRunPerLumi" command="TestPoolInputRunPerLumi.sh"/>
24+
<test name="TestPoolInputOldFormat" command="TestPoolInputOldFormat.sh">
25+
<lib name="GetTriggerNamesAnalyzer"/>
26+
</test>
27+
28+
<!-- test merging of heterogeneous files with extra provenenace in subsequent files -->
29+
<test name="TestPoolInputMergeHeterogeneousFiles" command="cmsRun ${LOCALTOP}/src/IOPool/Input/test/preMerge_cfg.py &amp;&amp; cmsRun ${LOCALTOP}/src/IOPool/Input/test/preMerge2_cfg.py &amp;&amp; cmsRun ${LOCALTOP}/src/IOPool/Input/test/HeteroMerge_cfg.py"/>
30+
31+
<test name="TestPoolInputMultiLumi" command="cmsRun ${LOCALTOP}/src/IOPool/Input/test/test_make_multi_lumi_cfg.py &amp;&amp; cmsRun ${LOCALTOP}/src/IOPool/Input/test/test_read_multi_lumi_as_one_cfg.py"/>
32+
<test name="TestPoolInputOverlappingLumis" command="cmsRun ${LOCALTOP}/src/IOPool/Input/test/test_make_overlapping_lumis_cfg.py &amp;&amp; cmsRun ${LOCALTOP}/src/IOPool/Input/test/test_read_overlapping_lumis_cfg.py"/>
33+
2434
<test name="TestIOPoolInputRepeating" command="testRepeatingCachedRootSource.sh"/>
2535
<test name="TestIOPoolInputNoParentDictionary" command="testNoParentDictionary.sh"/>
2636
<test name="TestFileOpenErrorExitCode" command="testFileOpenErrorExitCode.sh"/>
27-
<test name="TestIOPoolInputSchemaEvolution" command="testSchemaEvolution.sh"/>
37+
<test name="TestIOPoolInputSchemaEvolution" command="testSchemaEvolution.sh">
38+
<lib name="SchemaEvolutionTest"/>
39+
</test>
2840
<test name="TestIOPoolInputRefProductIDMetadataConsistency" command="testRefProductIDMetadataConsistencyRoot.sh"/>
2941

3042
</environment>

IOPool/Input/test/TestPoolInput.sh

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -58,90 +58,3 @@ cmsRun ${LOCAL_TEST_DIR}/PoolAliasSubProcessTestStep1_cfg.py || die 'Failure usi
5858

5959
cmsRun ${LOCAL_TEST_DIR}/PoolAliasSubProcessTestStep2_cfg.py || die 'Failure using PoolAliasSubProcessTestStep2_cfg.py' $?
6060

61-
cmsRun ${LOCAL_TEST_DIR}/PrePoolInputTest_cfg.py RunPerLumiTest.root 50 1 25 1 5 || die 'Failure using PrePoolInputTest_cfg.py' $?
62-
63-
cmsRun ${LOCAL_TEST_DIR}/RunPerLumiTest_cfg.py 25 >& RunPerLumiTest.txt || die 'Failure using RunPerLumiTest_cfg.py' $?
64-
grep 'record' RunPerLumiTest.txt | cut -d ' ' -f 4-11 > RunPerLumiTest.filtered.txt
65-
diff ${LOCAL_TEST_DIR}/unit_test_outputs/RunPerLumiTest.filtered.txt RunPerLumiTest.filtered.txt || die 'incorrect output using RunPerLumiTest_cfg.py' $?
66-
67-
cmsRun ${LOCAL_TEST_DIR}/RunPerLumiTest_cfg.py 50 >& tooManyLumis.txt && die 'RunPerLumiTest_cfg.py should have failed but did not' 1
68-
grep "MismatchedInputFiles" tooManyLumis.txt || die 'RunPerLumiTest_cfg.py should have failed but did not' $?
69-
70-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRunTest_cfg.py 'file:RunPerLumiTest.root' 25 1 25 1 5 || die 'Failure using firstLuminosityBlockForEachRunTest_cfg.py' $?
71-
cmsRun ${LOCAL_TEST_DIR}/PrePoolInputTest_cfg.py firstLumiTest1.root 25 1 100 1 5 || die 'Failure using PrePoolInputTest_cfg.py' $?
72-
cmsRun ${LOCAL_TEST_DIR}/PrePoolInputTest_cfg.py firstLumiTest2.root 25 1 100 6 5 || die 'Failure using PrePoolInputTest_cfg.py' $?
73-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRunTest_cfg.py 'file:firstLumiTest1.root,file:firstLumiTest2.root' 50 1 25 1 5 || die 'Failure using firstLuminosityBlockForEachRunTest_cfg.py with 2 files' $?
74-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRunTest_cfg.py 'file:firstLumiTest1.root,file:firstLumiTest2.root' 50 1 25 1 5 shareRun || die 'Failure using firstLuminosityBlockForEachRunTest_cfg.py with 2 files which share a run' $?
75-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py 'file:firstLumiTest1.root' 2 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py with first lumi 2' $?
76-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py 'file:firstLumiTest1.root' 4 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py with first lumi 4' $?
77-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py 'file:firstLumiTest1.root' 3 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py with first lumi 3' $?
78-
79-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py 'file:firstLumiTest1.root' 2 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py with first lumi 2' $?
80-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py 'file:firstLumiTest1.root' 4 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py with first lumi 4' $?
81-
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py 'file:firstLumiTest1.root' 3 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py with first lumi 3' $?
82-
83-
84-
#test merging of heterogeneous files with extra provenenace in subsequent files
85-
86-
cmsRun ${LOCAL_TEST_DIR}/preMerge_cfg.py || die 'Failure using preMerge_cfg.py' $?
87-
88-
cmsRun ${LOCAL_TEST_DIR}/preMerge2_cfg.py || die 'Failure using preMerge2_cfg.py' $?
89-
90-
cmsRun ${LOCAL_TEST_DIR}/HeteroMerge_cfg.py || die 'Failure using HeteroMerge_cfg.py' $?
91-
92-
#test reading of the old format files
93-
IOPoolInputData=$CMSSW_BASE/src
94-
for dir in $(echo $CMSSW_SEARCH_PATH | tr : '\n') ; do
95-
if [ -d ${dir}/IOPool/Input/data ] ; then
96-
IOPoolInputData=${dir}
97-
break
98-
fi
99-
done
100-
101-
for file in ${IOPoolInputData}/IOPool/Input/data/raw*.root
102-
do
103-
cmsRun ${LOCAL_TEST_DIR}/test_old_raw_data_step1_cfg.py "$file" || die "Failed to read old raw data file $file" $?
104-
cmsRun ${LOCAL_TEST_DIR}/test_old_raw_data_step2_cfg.py || die "Failed to read raw data file converted from $file" $?
105-
rm -fr converted.root
106-
done
107-
108-
for file in ${IOPoolInputData}/IOPool/Input/data/old*.root
109-
do
110-
cmsRun ${LOCAL_TEST_DIR}/test_old_formats_cfg.py "$file" || die "Failed to read old file $file" $?
111-
done
112-
113-
for file in ${IOPoolInputData}/IOPool/Input/data/empty*.root
114-
do
115-
cmsRun ${LOCAL_TEST_DIR}/test_empty_old_formats_cfg.py "$file" || die "Failed to read old empty file $file" $?
116-
done
117-
118-
# Note that the expected sequence of runs, lumis, and events changed slightly at 3_8_0 so
119-
# a different test config is required to run the following test for earlier releases.
120-
for file in ${IOPoolInputData}/IOPool/Input/data/complex*.root
121-
do
122-
case $file in
123-
"${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_2_2_13.root" | "${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_3_5_0.root" | "${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_3_7_0.root")
124-
script=test_complex_before_3_8_0_cfg.py
125-
;;
126-
*)
127-
script=test_complex_old_formats_cfg.py
128-
;;
129-
esac
130-
cmsRun ${LOCAL_TEST_DIR}/$script "$file" || die "Failed to read old complex file $file" $?
131-
done
132-
133-
cmsRun ${LOCAL_TEST_DIR}/test_merge_two_files.py ${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_4_2_7.root ${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_4_2_8.root || die 'Failure using test_merge_two_files.py' $?
134-
135-
cmsRun ${LOCAL_TEST_DIR}/test_reduced_ProcessHistory_cfg.py merged_files.root || die 'Failure using test_reduced_ProcessHistory_cfg.py' $?
136-
137-
cmsRun ${LOCAL_TEST_DIR}/test_reduced_ProcessHistory_dup_cfg.py merged_files.root || die 'Failure using test_reduced_ProcessHistory_dup_cfg.py' $?
138-
139-
cmsRun ${LOCAL_TEST_DIR}/test_reduced_ProcessHistory_end_cfg.py merged_files.root || die 'Failure using test_reduced_ProcessHistory_end_cfg.py' $?
140-
141-
cmsRun ${LOCAL_TEST_DIR}/test_make_multi_lumi_cfg.py || die 'Failure using test_make_multi_lumi_cfg.py' $?
142-
cmsRun ${LOCAL_TEST_DIR}/test_read_multi_lumi_as_one_cfg.py || die 'Failure using test_read_multi_lumi_as_one_cfg.py' $?
143-
144-
cmsRun ${LOCAL_TEST_DIR}/test_make_overlapping_lumis_cfg.py || die 'Failure using test_make_overlapping_lumis_cfg.py' $?
145-
cmsRun ${LOCAL_TEST_DIR}/test_read_overlapping_lumis_cfg.py || die 'Failure using test_read_overlapping_lumis_cfg.py' $?
146-
147-
exit 0
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh -ex
2+
# Pass in name and status
3+
function die { echo $1: status $2 ; exit $2; }
4+
5+
LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
6+
7+
#test reading of the old format files
8+
IOPoolInputData=$CMSSW_BASE/src
9+
for dir in $(echo $CMSSW_SEARCH_PATH | tr : '\n') ; do
10+
if [ -d ${dir}/IOPool/Input/data ] ; then
11+
IOPoolInputData=${dir}
12+
break
13+
fi
14+
done
15+
16+
for file in ${IOPoolInputData}/IOPool/Input/data/raw*.root
17+
do
18+
cmsRun ${LOCAL_TEST_DIR}/test_old_raw_data_step1_cfg.py "$file" || die "Failed to read old raw data file $file" $?
19+
cmsRun ${LOCAL_TEST_DIR}/test_old_raw_data_step2_cfg.py || die "Failed to read raw data file converted from $file" $?
20+
rm -fr converted.root
21+
done
22+
23+
for file in ${IOPoolInputData}/IOPool/Input/data/old*.root
24+
do
25+
cmsRun ${LOCAL_TEST_DIR}/test_old_formats_cfg.py "$file" || die "Failed to read old file $file" $?
26+
done
27+
28+
for file in ${IOPoolInputData}/IOPool/Input/data/empty*.root
29+
do
30+
cmsRun ${LOCAL_TEST_DIR}/test_empty_old_formats_cfg.py "$file" || die "Failed to read old empty file $file" $?
31+
done
32+
33+
# Note that the expected sequence of runs, lumis, and events changed slightly at 3_8_0 so
34+
# a different test config is required to run the following test for earlier releases.
35+
for file in ${IOPoolInputData}/IOPool/Input/data/complex*.root
36+
do
37+
case $file in
38+
"${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_2_2_13.root" | "${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_3_5_0.root" | "${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_3_7_0.root")
39+
script=test_complex_before_3_8_0_cfg.py
40+
;;
41+
*)
42+
script=test_complex_old_formats_cfg.py
43+
;;
44+
esac
45+
cmsRun ${LOCAL_TEST_DIR}/$script "$file" || die "Failed to read old complex file $file" $?
46+
done
47+
48+
cmsRun ${LOCAL_TEST_DIR}/test_merge_two_files.py ${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_4_2_7.root ${IOPoolInputData}/IOPool/Input/data/complex_old_format_CMSSW_4_2_8.root || die 'Failure using test_merge_two_files.py' $?
49+
50+
cmsRun ${LOCAL_TEST_DIR}/test_reduced_ProcessHistory_cfg.py merged_files.root || die 'Failure using test_reduced_ProcessHistory_cfg.py' $?
51+
52+
cmsRun ${LOCAL_TEST_DIR}/test_reduced_ProcessHistory_dup_cfg.py merged_files.root || die 'Failure using test_reduced_ProcessHistory_dup_cfg.py' $?
53+
54+
cmsRun ${LOCAL_TEST_DIR}/test_reduced_ProcessHistory_end_cfg.py merged_files.root || die 'Failure using test_reduced_ProcessHistory_end_cfg.py' $?
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh -ex
2+
# Pass in name and status
3+
function die { echo $1: status $2 ; exit $2; }
4+
5+
LOCAL_TEST_DIR=${SCRAM_TEST_PATH}
6+
7+
cmsRun ${LOCAL_TEST_DIR}/PrePoolInputTest_cfg.py RunPerLumiTest.root 50 1 25 1 5 || die 'Failure using PrePoolInputTest_cfg.py' $?
8+
9+
cmsRun ${LOCAL_TEST_DIR}/RunPerLumiTest_cfg.py 25 >& RunPerLumiTest.txt || die 'Failure using RunPerLumiTest_cfg.py' $?
10+
grep 'record' RunPerLumiTest.txt | cut -d ' ' -f 4-11 > RunPerLumiTest.filtered.txt
11+
diff ${LOCAL_TEST_DIR}/unit_test_outputs/RunPerLumiTest.filtered.txt RunPerLumiTest.filtered.txt || die 'incorrect output using RunPerLumiTest_cfg.py' $?
12+
13+
cmsRun ${LOCAL_TEST_DIR}/RunPerLumiTest_cfg.py 50 >& tooManyLumis.txt && die 'RunPerLumiTest_cfg.py should have failed but did not' 1
14+
grep "MismatchedInputFiles" tooManyLumis.txt || die 'RunPerLumiTest_cfg.py should have failed but did not' $?
15+
16+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRunTest_cfg.py 'file:RunPerLumiTest.root' 25 1 25 1 5 || die 'Failure using firstLuminosityBlockForEachRunTest_cfg.py' $?
17+
cmsRun ${LOCAL_TEST_DIR}/PrePoolInputTest_cfg.py firstLumiTest1.root 25 1 100 1 5 || die 'Failure using PrePoolInputTest_cfg.py' $?
18+
cmsRun ${LOCAL_TEST_DIR}/PrePoolInputTest_cfg.py firstLumiTest2.root 25 1 100 6 5 || die 'Failure using PrePoolInputTest_cfg.py' $?
19+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRunTest_cfg.py 'file:firstLumiTest1.root,file:firstLumiTest2.root' 50 1 25 1 5 || die 'Failure using firstLuminosityBlockForEachRunTest_cfg.py with 2 files' $?
20+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRunTest_cfg.py 'file:firstLumiTest1.root,file:firstLumiTest2.root' 50 1 25 1 5 shareRun || die 'Failure using firstLuminosityBlockForEachRunTest_cfg.py with 2 files which share a run' $?
21+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py 'file:firstLumiTest1.root' 2 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py with first lumi 2' $?
22+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py 'file:firstLumiTest1.root' 4 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py with first lumi 4' $?
23+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py 'file:firstLumiTest1.root' 3 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis_Test_cfg.py with first lumi 3' $?
24+
25+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py 'file:firstLumiTest1.root' 2 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py with first lumi 2' $?
26+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py 'file:firstLumiTest1.root' 4 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py with first lumi 4' $?
27+
cmsRun ${LOCAL_TEST_DIR}/firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py 'file:firstLumiTest1.root' 3 || die 'Failure using firstLuminosityBlockForEachRun_skipLumis2_Test_cfg.py with first lumi 3' $?

0 commit comments

Comments
 (0)