Commit 1ad99987 authored by Joseph Jang's avatar Joseph Jang Committed by Shuah Khan

selftest: rtc: Check if could access /dev/rtc0 before testing

The rtctest requires the read permission on /dev/rtc0. The rtctest will
be skipped if the /dev/rtc0 is not readable.
Reviewed-by: default avatarKoba Ko <kobak@nvidia.com>
Reviewed-by: default avatarMatthew R. Ochs <mochs@nvidia.com>
Signed-off-by: default avatarJoseph Jang <jjang@nvidia.com>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 9852d85e
......@@ -412,6 +412,8 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
int main(int argc, char **argv)
{
int ret = -1;
switch (argc) {
case 2:
rtc_file = argv[1];
......@@ -423,5 +425,12 @@ int main(int argc, char **argv)
return 1;
}
return test_harness_run(argc, argv);
/* Run the test if rtc_file is accessible */
if (access(rtc_file, R_OK) == 0)
ret = test_harness_run(argc, argv);
else
ksft_exit_skip("[SKIP]: Cannot access rtc file %s - Exiting\n",
rtc_file);
return ret;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment