test: add function for checking config.h in tests

This commit is contained in:
Miroslav Lichvar 2018-09-26 17:29:23 +02:00
parent 31b1f2e8a1
commit 3e876d4218
5 changed files with 10 additions and 4 deletions

View file

@ -16,7 +16,7 @@ check_packet_interval || test_fail
check_sync || test_fail
# The following tests need 64-bit time_t
grep -q 'HAVE_LONG_TIME_T 1' ../../config.h || test_skip
check_config_h 'HAVE_LONG_TIME_T 1' || test_skip
for year in 1990 2090; do
export CLKNETSIM_START_DATE=$(date -d "Jan 1 00:00:00 UTC $year" +'%s')

View file

@ -23,7 +23,7 @@ EOF
keys=4
if grep -q 'FEAT_SECHASH 1' ../../config.h; then
if check_config_h 'FEAT_SECHASH 1'; then
hashes="MD5 SHA1 SHA256 SHA384 SHA512"
else
hashes="MD5"

View file

@ -5,7 +5,7 @@
test_start "cmdmon timestamps"
# The following tests need 64-bit time_t
grep -q 'HAVE_LONG_TIME_T 1' ../../config.h || test_skip
check_config_h 'HAVE_LONG_TIME_T 1' || test_skip
limit=2
client_server_options="noselect"

View file

@ -20,7 +20,7 @@ check_chronyd_exit || test_fail
check_source_selection || test_fail
check_sync || test_fail
if grep -q 'FEAT_DEBUG 1' ../../config.h; then
if check_config_h 'FEAT_DEBUG 1'; then
check_log_messages "HW clock samples" 190 200 || test_fail
check_log_messages "HW clock reset" 0 0 || test_fail
check_log_messages "Received.*tss=1" 1 1 || test_fail

View file

@ -211,6 +211,12 @@ get_chronyd_conf() {
fi
}
# Check if chrony was built with specified option in config.h
check_config_h() {
local pattern=$1
grep -q "^#define $pattern" ../../config.h
}
# Check if the clock was well synchronized
check_sync() {
local i sync_time max_time_error max_freq_error ret=0