chrony/test/system/100-clockupdate
Miroslav Lichvar 6e52a9be7a test: add system tests
Add a new set of tests for testing basic functionality, starting chronyd
with root privileges on the actual system instead of the simulator.

Tests numbered in the 100-199 range are considered destructive and
intended to be used only on machines dedicated for development or
testing. They are started by the run script only with the -d option.
They may adjust/step the system clock and other clocks, block the RTC,
enable HW timestamping, create SHM segments, etc.

Other tests should not interfere with the system and should work even
when another NTP server/client is running.
2019-04-18 16:11:45 +02:00

30 lines
742 B
Bash
Executable file

#!/bin/bash
. ./test.common
test_start "update of system clock"
clock_control=1
minimal_config=1
start_chronyd || test_fail
run_chronyc "dfreq 1e-3" || test_fail
check_chronyc_output "200 OK" || test_fail
before=$(date '+%s')
run_chronyc "doffset -1.0" || test_fail
check_chronyc_output "200 OK" || test_fail
run_chronyc "makestep" || test_fail
check_chronyc_output "200 OK" || test_fail
after=$(date '+%s')
test_message 1 0 "checking system clock"
[ "$before" -lt "$after" ] && test_ok || test_bad || test_fail
run_chronyc "doffset 1.0" || test_fail
run_chronyc "makestep" || test_fail
stop_chronyd || test_fail
check_chronyd_messages || test_fail
check_chronyd_message_count "System clock was stepped by" 2 2 || test_fail
test_pass