Skip to content

Commit 2477b0f

Browse files
committed
Add tests
1 parent f1fa4e0 commit 2477b0f

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

Utilities/StorageFactory/test/BuildFile.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ to wait until the framework decides on a threading model to implement a fix.
4242
file="threadsafe.cpp" name="test_StorageFactory_threadsafe"
4343
-->
4444

45+
<test name="test_StorageFactory_StorageProxies" command="test_storageproxies.sh"/>
46+
4547
<test name="test_StorageFactory_edmStorageTrace" command="python3 ${LOCALTOP}/src/Utilities/StorageFactory/scripts/edmStorageTrace.py --test"/>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Pass in name and status
4+
function die { echo $1: status $2 ; exit $2; }
5+
6+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_make_file_cfg.py || die "cmsRun test_storageproxy_make_file_cfg.py failed" $?
7+
8+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_test_cfg.py || die "cmsRun test_storageproxy_test_cfg.py failed" $?
9+
10+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_test_cfg.py --latencyRead || die "cmsRun test_storageproxy_test_cfg.py --latencyRead failed" $?
11+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_test_cfg.py --latencyWrite || die "cmsRun test_storageproxy_test_cfg.py --latencyWrite failed" $?
12+
13+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_test_cfg.py --trace || die "cmsRun test_storageproxy_test_cfg.py --trace failed" $?
14+
grep -q "o .* test.root" trace_0.txt || die "File open entry missing in trace_0.txt" $?
15+
grep -q "r " trace_0.txt || die "No read entries in trace_0.txt" $?
16+
grep -q "o .* output.root" trace_1.txt || die "File open entry missing in trace_1.txt" $?
17+
grep -q "w " trace_1.txt || die "No write entries in trace_0.txt" $?
18+
19+
edmStorageTrace.py --summary trace_0.txt | grep -q "Singular reads" || die "No reads in summary for trace_0.txt" $?
20+
edmStorageTrace.py --summary trace_1.txt | grep -q "Singular writes" || die "No reads in summary for trace_1.txt" $?
21+
22+
23+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_test_cfg.py --trace --latencyRead || die "cmsRun test_storageproxy_test_cfg.py --trace --latencyRead failed" $?
24+
edmStorageTrace.py --summary trace_0.txt | grep -q "Duration .* ms" || die "Read duration has non-ms units in trace_1.txt" $?
25+
26+
cmsRun ${SCRAM_TEST_PATH}/test_storageproxy_test_cfg.py --trace --latencyWrite || die "cmsRun test_storageproxy_test_cfg.py --trace --latencyWrite failed" $?
27+
edmStorageTrace.py --summary trace_1.txt | grep -q "Duration .* ms" || die "Write duration has non-ms trace_1.txt" $?
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
process = cms.Process("MAKE")
4+
5+
process.source = cms.Source("EmptySource")
6+
process.maxEvents.input = 10
7+
8+
process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string("test.root"))
9+
10+
process.Thing = cms.EDProducer("ThingProducer")
11+
process.OtherThing = cms.EDProducer("OtherThingProducer")
12+
process.EventNumber = cms.EDProducer("EventNumberIntProducer")
13+
14+
15+
process.o = cms.EndPath(process.out, cms.Task(process.Thing, process.OtherThing, process.EventNumber))
16+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
import argparse
4+
5+
parser = argparse.ArgumentParser(description="Test storage proxies")
6+
parser.add_argument("--trace", action="store_true", help="Enable StorageTraceProxy")
7+
parser.add_argument("--latencyRead", action="store_true", help="Add read latency")
8+
parser.add_argument("--latencyWrite", action="store_true", help="Add write latency")
9+
args = parser.parse_args()
10+
11+
process = cms.Process("TEST")
12+
13+
process.source = cms.Source("PoolSource",
14+
fileNames = cms.untracked.vstring("file:test.root")
15+
)
16+
17+
process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string("output.root"))
18+
19+
adaptor = cms.Service("AdaptorConfig", storageProxies = cms.untracked.VPSet())
20+
if args.latencyRead:
21+
adaptor.storageProxies.append(cms.PSet(
22+
type = cms.untracked.string("StorageAddLatencyProxy"),
23+
read = cms.untracked.uint32(100),
24+
readv = cms.untracked.uint32(100),
25+
))
26+
if args.latencyWrite:
27+
adaptor.storageProxies.append(cms.PSet(
28+
type = cms.untracked.string("StorageAddLatencyProxy"),
29+
write = cms.untracked.uint32(100),
30+
writev = cms.untracked.uint32(100),
31+
))
32+
if args.trace:
33+
adaptor.storageProxies.append(cms.PSet(
34+
type = cms.untracked.string("StorageTracerProxy"),
35+
traceFilePattern = cms.untracked.string("trace_%I.txt"),
36+
))
37+
38+
process.add_(adaptor)
39+
40+
process.ep = cms.EndPath(process.out)

0 commit comments

Comments
 (0)