int main(int argc, char *argv[]) { tst_parse_opts(argc, argv, options, help); tst_require_root(); if (access(rtc_dev, F_OK) == -1) tst_brkm(TCONF, NULL, "couldn't find rtc device '%s'", rtc_dev); rtc_fd = open(rtc_dev, O_RDONLY); if (rtc_fd < 0) tst_brkm(TBROK | TERRNO, NULL, "couldn't open %s", rtc_dev); /*Read and alarm tests */ read_alarm_test(); /*Update interrupts test */ update_interrupts_test(); close(rtc_fd); tst_resm(TINFO, "RTC Tests Done!"); tst_exit(); }
int main(int argc, char **argv) { char *rtc_dev = "/dev/rtc"; if (argc == 2) rtc_dev = argv[1]; rtc_fd = open(rtc_dev, O_RDONLY); if (rtc_fd < 0) tst_brkm(TBROK | TERRNO, NULL, "couldn't open %s", rtc_dev); /*Read and alarm tests */ read_alarm_test(); /*Update interrupts test */ update_interrupts_test(); close(rtc_fd); tst_resm(TINFO, "RTC Tests Done!"); tst_exit(); }