add rtctime libs and rtc02 case
v2 cover add rtctime libs and rtc02 case
From: Cixi Geng <[email protected]>
This file is a implementation for rtc test function
in tst_rtctime lib, support tst_rtc_gettime and tst_rtc_settime; at the same file, also add rtctime and time_t convert functions. in tst_wallclock.s, add tst_rtc_save and tst_rtc_restore for testcase used in SETUP and CLEANUP.
the rtc02 testcase is verify set rtctime a exact timestamp.
V2 changes:
1. add passing rtd_dev int tst_rtc_gettime, tst_rtc_settime, tst_rtc_clock_save and tst_rtc_clock_restore functions.
2. move check device exist functions from lib into testcase
3. rename tst_rtctime_save|tst_rtctime_restore to tst_rtc_clock_save| tst_rtc_clock_restore
4. test description and identifiers format issues.
NO chanages:
1. keep tst_rtc_gettime and tst_rtc_settime no change to "static inline"(V1) for some compile warning and referring to tst_clock_gettime in tst_clocks.h
2. in .h, use identifiers format "/* XXX /*" rather than "// XXX" for kernel checkpatch "WARNING" as follow:
``` WARNING: Improper SPDX comment style for 'include/tst_rtctime.h', please use '/*' instead \#26: FILE: include/tst_rtctime.h:1: +// SPDX-License-Identifier: GPL-2.0-or-later WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 \#26: FILE: include/tst_rtctime.h:1: +// SPDX-License-Identifier: GPL-2.0-or-later ```
Cixi Geng (3):
lib: add tst_rtctime* for rtc test
lib: implement rtc_clock_save and rtc_clock_restore function device-drivers/rtc: add verify rtc set time case
include/tst_rtctime.h | 15 ++ include/tst_wallclock.h | 4 + lib/tst_rtctime.c | 159 ++++++++++++++++++ lib/tst_wallclock.c | 44 +++++ runtest/kernel_misc | 1 + .../kernel/device-drivers/rtc/.gitignore | 1 + testcases/kernel/device-drivers/rtc/rtc02.c | 111 ++++++++++++ 7 files changed, 335 insertions(+) create mode 100644 include/tst_rtctime.h create mode 100644 lib/tst_rtctime.c create mode 100644 testcases/kernel/device-drivers/rtc/rtc02.c
Signature · 1 line
2.25.1
PATCH v2 1/3 lib: add tst_rtctime* for rtc test
From: Cixi Geng <[email protected]>
Add:
get rtc time and set rtc time;
Implemented a function that covert rtc time to time_t this will be used in tst_rtc_save and tst_rtc_restore
--- include/tst_rtctime.h | 15 ++++ lib/tst_rtctime.c | 159 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 include/tst_rtctime.h create mode 100644 lib/tst_rtctime.c
include/tst_rtctime.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2020 Unisoc Inc. +*/ + +#ifndef TST_RTCTIME +#define TST_RTCTIME + +#include <linux/rtc.h> + +int tst_rtc_gettime (char *rtc_dev,struct rtc_time *rtc_tm); + +int tst_rtc_settime (char *rtc_dev,struct rtc_time *rtc_tm); + +#endif /* TST_RTCTIME */
lib/tst_rtctime.c new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 2/3 lib: implement rtc_clock_save and rtc_clock_restore function
In reply to [email protected]From: Cixi Geng <[email protected]>
* Reading the RTC in the setup as well as timestamping with monotonic timer
* Getting a second monotonic timestamp in the cleanup
* Setting the RTC to the value taken in setup plus the difference in the monotonic timer timestamps
--- include/tst_wallclock.h | 4 ++++ lib/tst_wallclock.c | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+)
include/tst_wallclock.h +4 -0
@@ -12,4 +12,8 @@ void tst_wallclock_save(void);void tst_wallclock_restore (void ); +void tst_rtc_clock_save (char *rtc_dev); + +void tst_rtc_clock_restore (char *rtc_dev); +#endif /* TST_WALLCLK_H__ */
lib/tst_wallclock.c +44 -0
58 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 3/3 device-drivers/rtc: add verify rtc set time case
In reply to [email protected]From: Cixi Geng <[email protected]>
Test for the Real Time Clock driver.
* Veirify that,
* 1) set a RTC time
* 2) read the RTC time after set RTC time at once
* 3) compare the set time and the read is identical
--- runtest/kernel_misc | 1 + .../kernel/device-drivers/rtc/.gitignore | 1 + testcases/kernel/device-drivers/rtc/rtc02.c | 111 ++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 testcases/kernel/device-drivers/rtc/rtc02.c
runtest/kernel_misc +1 -0
@@ -1,6 +1,7 @@ kmsg01 kmsg01 fw_load fw_load rtc01 rtc01 +rtc02 rtc02 block_dev block_dev tpci tpci tbio tbio
testcases/kernel/device-drivers/rtc/.gitignore +1 -0
@@ -1 +1,2 @@ /rtc01 +/rtc02
testcases/kernel/device-drivers/rtc/rtc02.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.25.1
v2 cover add rtctime libs and rtc02 case
In reply to [email protected]Hi!
I've fixed a few problems in the patchset and pushed, thanks.
Mostly minor changes such as constifying the rtc_dev string pointer and a few typo fixes, but also added missing function prototypes to the rtc_time.h
Quoted 3 lines
1. keep
tst_rtc_gettimeandtst_rtc_settimeno change to "static inline"(V1) for some compile warning and referring totst_clock_gettimeintst_clocks.h
This was due to missing include to sys/ioctl.h which declares the _IO() macro used to define RTC_RD_TIME and RTC_SET_TIME
Quoted 2 lines
2. in .h, use identifiers format "/* XXX /*" rather than "// XXX" for kernel checkpatch "WARNING" as follow:
I guess that we may as well switch to the kernel format then.
Signature · 2 lines
Cyril Hrubis [email protected]