[chrony-dev] Re: [PATCH] test: check if RTC is RTC_UIE_ON capable

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]




On Tue, Dec 10, 2019 at 4:06 PM Vincent Blut <vincent.debian@xxxxxxx> wrote:
On 2019-12-10T15:52+0100, Christian Ehrhardt wrote:
>The test might run on different platforms.
>If the platform happens to have a RTC that does exist but unable to
>have RTC_UIE_ON set the test will fall into an infinite hang.
>
>Exampls of bad clocks are:
>- ppc64el: rtc-generic
>- arm64: rtc-efi
>
>To avoid that check the capability via `hwclock` before the test and skip
>if it is unable to use it.
>
>Signed-off-by: Christian Ehrhardt <christian.ehrhardt@xxxxxxxxxxxxx>
>---
> test/system/101-rtc | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/test/system/101-rtc b/test/system/101-rtc
>index fa9a70d..cbffd1c 100755
>--- a/test/system/101-rtc
>+++ b/test/system/101-rtc
>@@ -4,6 +4,7 @@
>
> check_chronyd_features RTC || test_skip "RTC support disabled"
> [ -c "/dev/rtc" ] || test_skip "missing /dev/rtc"
>+hwclock -r --test  | grep -q '^ioctl.*RTC_UIE_ON.*Invalid argument$' && test_skip "RTC not RTC_UIE_ON capable"

                                                    ^^^^^^^^^^^^^^^^
Careful here, hwclock is internationalized.

Thanks for the warning, the ioctl and the flag RTC_UIE_ON should be always the same.
The errno might be changing, but we could just drop that from the check maybe and be safe?
 
> test_start "real-time clock"


--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/