test/coredevice: WA for lack of constant string support in compiler (see issue #68)

This commit is contained in:
Sebastien Bourdeauducq 2015-07-13 22:22:26 +02:00
parent 32d141f5ac
commit 820ff2da2c
1 changed files with 24 additions and 11 deletions

View File

@ -11,6 +11,9 @@ class RTT(EnvExperiment):
self.attr_device("core")
self.attr_device("ttl_inout")
def set_rtt(self, rtt):
self.set_result("rtt", rtt)
@kernel
def run(self):
self.ttl_inout.output()
@ -23,8 +26,7 @@ class RTT(EnvExperiment):
delay(1*us)
t0 = now_mu()
self.ttl_inout.pulse(1*us)
self.set_result("rtt",
mu_to_seconds(self.ttl_inout.timestamp() - t0))
self.set_rtt(mu_to_seconds(self.ttl_inout.timestamp() - t0))
class Loopback(EnvExperiment):
@ -33,6 +35,9 @@ class Loopback(EnvExperiment):
self.attr_device("loop_in")
self.attr_device("loop_out")
def set_rtt(self, rtt):
self.set_result("rtt", rtt)
@kernel
def run(self):
self.loop_in.input()
@ -43,8 +48,7 @@ class Loopback(EnvExperiment):
delay(1*us)
t0 = now_mu()
self.loop_out.pulse(1*us)
self.set_result("rtt",
mu_to_seconds(self.loop_in.timestamp() - t0))
self.set_rtt(mu_to_seconds(self.loop_in.timestamp() - t0))
class ClockGeneratorLoopback(EnvExperiment):
@ -53,6 +57,9 @@ class ClockGeneratorLoopback(EnvExperiment):
self.attr_device("loop_clock_in")
self.attr_device("loop_clock_out")
def set_count(self, count):
self.set_result("count", count)
@kernel
def run(self):
self.loop_clock_in.input()
@ -63,8 +70,7 @@ class ClockGeneratorLoopback(EnvExperiment):
with sequential:
delay(200*ns)
self.loop_clock_out.set(1*MHz)
self.set_result("count",
self.loop_clock_in.count())
self.set_count(self.loop_clock_in.count())
class PulseRate(EnvExperiment):
@ -72,6 +78,9 @@ class PulseRate(EnvExperiment):
self.attr_device("core")
self.attr_device("loop_out")
def set_pulse_rate(self, pulse_rate):
self.set_result("pulse_rate", pulse_rate)
@kernel
def run(self):
dt = seconds_to_mu(1000*ns)
@ -84,8 +93,7 @@ class PulseRate(EnvExperiment):
dt += 1
self.core.break_realtime()
else:
self.set_result("pulse_rate",
mu_to_seconds(2*dt))
self.set_pulse_rate(mu_to_seconds(2*dt))
break
@ -106,6 +114,9 @@ class LoopbackCount(EnvExperiment):
self.attr_device("ttl_inout")
self.attr_argument("npulses")
def set_count(self, count):
self.set_result("count", count)
@kernel
def run(self):
self.ttl_inout.output()
@ -116,8 +127,7 @@ class LoopbackCount(EnvExperiment):
for i in range(self.npulses):
delay(25*ns)
self.ttl_inout.pulse(25*ns)
self.set_result("count",
self.ttl_inout.count())
self.set_count(self.ttl_inout.count())
class Underflow(EnvExperiment):
@ -149,9 +159,12 @@ class TimeKeepsRunning(EnvExperiment):
def build(self):
self.attr_device("core")
def set_time_at_start(self, time_at_start):
self.set_result("time_at_start", time_at_start)
@kernel
def run(self):
self.set_result("time_at_start", now_mu())
self.set_time_at_start(now_mu())
class Handover(EnvExperiment):