예제 #1
0
    def test_method(self):
        rtc = self.config.rtc
        self.info("Using select(2) on /dev/rtc")

        def _rtc_counter():
            irqcount = 0
            while irqcount < 5:
                rd, wr, ex = select.select([rtc], [], [], 5)
                if rtc in rd:
                    count, status = rtc.read()  # will not block
                    irqcount += 1
                    self.info(" counted %d (rtc count = %d, status = %s)" %
                              (irqcount, count, status))
            return irqcount

        rtc.update_interrupt_on()
        try:
            # should take 5 seconds to run, timeout is 7 seconds
            irqcount = self.config.sched.iotimeout(_rtc_counter, timeout=7)
        except TimeoutError:
            rtc.update_interrupt_off()
            return self.failed(
                "rtc.read() from select did not finish before timeout")
        rtc.update_interrupt_off()
        self.assert_equal(irqcount, 5, "wrong count of timer events")
        return self.passed("counted %d events" % (irqcount, ))
예제 #2
0
    def test_method(self):
        # Turn on update interrupts (one per second) */
        self.info("RTC Driver (and Python rtc module) Test.")
        self.irqcount = 0
        rtc = self.config.rtc

        def _rtc_counter():
            irqcount = 0
            while irqcount < 5:
                count, status = rtc.read()  # will block
                irqcount += 1
                self.info(" counted %d (rtc count = %d, status = %s)" % (irqcount, count, status))
            return irqcount
        
        rtc.update_interrupt_on()
        self.info("Counting 5 update (1/sec) interrupts from reading /dev/rtc")
        try:
            # should take 5 seconds to run, timeout is 7 seconds
            irqcount = self.config.sched.iotimeout(_rtc_counter, timeout=7)
        except TimeoutError:
            rtc.update_interrupt_off()
            return self.failed("rtc.read() did not finish before timeout")
        rtc.update_interrupt_off()
        self.assert_equal(irqcount, 5, "wrong count of timer events")
        return self.passed("counted %d events" % (irqcount,))
예제 #3
0
    def test_method(self):
        # Turn on update interrupts (one per second) */
        self.info("RTC Driver (and Python rtc module) Test.")
        self.irqcount = 0
        rtc = self.config.rtc

        def _rtc_counter():
            irqcount = 0
            while irqcount < 5:
                count, status = rtc.read()  # will block
                irqcount += 1
                self.info(" counted %d (rtc count = %d, status = %s)" %
                          (irqcount, count, status))
            return irqcount

        rtc.update_interrupt_on()
        self.info("Counting 5 update (1/sec) interrupts from reading /dev/rtc")
        try:
            # should take 5 seconds to run, timeout is 7 seconds
            irqcount = self.config.sched.iotimeout(_rtc_counter, timeout=7)
        except TimeoutError:
            rtc.update_interrupt_off()
            return self.failed("rtc.read() did not finish before timeout")
        rtc.update_interrupt_off()
        self.assert_equal(irqcount, 5, "wrong count of timer events")
        return self.passed("counted %d events" % (irqcount, ))
예제 #4
0
    def test_method(self):
        rtc = self.config.rtc
        self.info("Using select(2) on /dev/rtc")

        def _rtc_counter():
            irqcount = 0
            while irqcount < 5:
                rd, wr, ex = select.select([rtc], [], [], 5)
                if rtc in rd:
                    count, status = rtc.read()  # will not block
                    irqcount += 1
                    self.info(" counted %d (rtc count = %d, status = %s)" % (irqcount, count, status))
            return irqcount

        rtc.update_interrupt_on()
        try:
            # should take 5 seconds to run, timeout is 7 seconds
            irqcount = self.config.sched.iotimeout(_rtc_counter, timeout=7)
        except TimeoutError:
            rtc.update_interrupt_off()
            return self.failed("rtc.read() from select did not finish before timeout")
        rtc.update_interrupt_off()
        self.assert_equal(irqcount, 5, "wrong count of timer events")
        return self.passed("counted %d events" % (irqcount,))