summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Conrad <[email protected]>2019-09-25 12:18:10 -0400
committerNathan Conrad <[email protected]>2019-09-25 12:46:45 -0400
commit6c6a01cbcdc98a1e1346fc74b0d79db90443c7e3 (patch)
tree6369464f0a07bed6c70646f6c2c3449cc8c75200
parent3a87dd65d735085845cbf799add77596cf737f44 (diff)
USBTMC: Minor updates to testing script.
-rw-r--r--examples/device/usbtmc/visaQuery.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/examples/device/usbtmc/visaQuery.py b/examples/device/usbtmc/visaQuery.py
index 4d4b50c4b..44b5fd875 100644
--- a/examples/device/usbtmc/visaQuery.py
+++ b/examples/device/usbtmc/visaQuery.py
@@ -11,6 +11,7 @@ def test_idn():
def test_echo(m,n):
longstr = "0123456789abcdefghijklmnopqrstuvwxyz" * 50
+ t0 = time.monotonic()
#Next try echo from 1 to 175 characters (200 is max buffer size on DUT)
for i in range(m,n):
@@ -22,7 +23,9 @@ def test_echo(m,n):
#print (":".join("{:02x}".format(ord(c)) for c in xt))
#print (":".join("{:02x}".format(ord(c)) for c in y))
assert(xt == y), f"failed i={i}"
- inst.read_stb();# Just to make USB logging easier by sending a control query
+ #inst.read_stb();# Just to make USB logging easier by sending a control query (bad thing is that this made things slow)
+ t = time.monotonic() - t0
+ print(f" elapsed: {t:0.3} sec")
def test_trig():
# clear SRQ
@@ -70,13 +73,13 @@ def test_read_timeout():
inst.read_stb()
assert (inst.read_stb() == 0)
inst.write("delay 500")
- t0 = time.time()
+ t0 = time.monotonic()
try:
rsp = inst.read()
assert(false), "Read should have resulted in timeout"
except visa.VisaIOError:
- print("Got expected exception")
- t = time.time() - t0
+ print(" Got expected exception")
+ t = time.monotonic() - t0
assert ((t*1000.0) > (inst.timeout - 300))
assert ((t*1000.0) < (inst.timeout + 300))
print(f"Delay was {t:0.3}")
@@ -92,16 +95,16 @@ def test_abort_in():
assert (inst.read_stb() == 0)
inst.write("delay 500")
inst.write("xxx")
- t0 = time.time()
+ t0 = time.monotonic()
try:
rsp = inst.read()
assert(false), "Read should have resulted in timeout"
except visa.VisaIOError:
- print("Got expected exception")
- t = time.time() - t0
+ print(" Got expected exception")
+ t = time.monotonic() - t0
assert ((t*1000.0) > (inst.timeout - 300))
assert ((t*1000.0) < (inst.timeout + 300))
- print(f"Delay was {t:0.3}")
+ print(f" Delay was {t:0.3}")
# Response is still in queue, so send a clear (to be more helpful to the next test)
inst.timeout = 800
y = inst.read()
@@ -180,5 +183,11 @@ test_indicate()
print("+ TRIG")
test_trig()
+# Untested:
+# abort bulk out
+# LLO, GTL, etc
+# Throughput rate?
+# Transmitting a message using multiple transfers
+
inst.close()
print("Test complete")