-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfullCycleTest.py
More file actions
executable file
·73 lines (61 loc) · 1.94 KB
/
fullCycleTest.py
File metadata and controls
executable file
·73 lines (61 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
import testDriver, stopwatch
import logging
import sys, os
__all__ = [ "fullCycleTest", ]
def fullCycleTest(
config = "config/TestConfig.ini",
chimney = "EW00",
**kargs
):
reader = None
globalTimer = stopwatch.StopWatch()
try:
timer = stopwatch.StopWatch()
if not os.path.exists(config):
relConfig = os.path.join(os.pwd(), config)
if os.path.exists(relConfig): config = relConfig
# if
logging.info("fullCycleTest(): ChimneyReader setup")
kargs['configurationFile'] = config
kargs['chimney'] = chimney
timer.restart()
reader = testDriver.ChimneyReader(**kargs)
timer.stop()
logging.info("fullCycleTest(): ChimneyReader setup ended in {}".format(timer.toString()))
if not reader.scope: raise RuntimeError("Failed to contact the oscilloscope.")
logging.info("fullCycleTest(): readout loop")
timer.restart()
reader.start()
iRead = 0
while reader.readNext():
iRead += 1
print("Read #{}".format(iRead))
# while
timer.stop()
logging.info("fullCycleTest(): readout ended in {}".format(timer.toString()))
logging.info("fullCycleTest(): verification")
timer.restart()
success = reader.verify()
timer.stop()
logging.info("fullCycleTest(): verification ended in {}".format(timer.toString()))
if not success:
raise RuntimeError("Verification failed!")
logging.info("fullCycleTest(): archival script generation")
timer.restart()
reader.generateArchivalScript()
timer.stop()
logging.info("fullCycleTest(): script generation ended in {}".format(timer.toString()))
except Exception as e:
print >>sys.stderr, e
globalTimer.stop()
logging.info("fullCycleTest(): test took {}".format(globalTimer.toString()))
if reader:
reader.printTimers()
return reader
# fullCycleTest()
if __name__ == "__main__":
import sys
fullCycleTest(fake=True)
sys.exit(0)
# main