diff --git a/test/simulation/008-ntpera b/test/simulation/008-ntpera index 3c63419..360a97d 100755 --- a/test/simulation/008-ntpera +++ b/test/simulation/008-ntpera @@ -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') diff --git a/test/simulation/105-ntpauth b/test/simulation/105-ntpauth index 4c77f10..9ec4fba 100755 --- a/test/simulation/105-ntpauth +++ b/test/simulation/105-ntpauth @@ -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" diff --git a/test/simulation/115-cmdmontime b/test/simulation/115-cmdmontime index 2806a1f..ada08da 100755 --- a/test/simulation/115-cmdmontime +++ b/test/simulation/115-cmdmontime @@ -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" diff --git a/test/simulation/133-hwtimestamp b/test/simulation/133-hwtimestamp index 1448c21..4939f7d 100755 --- a/test/simulation/133-hwtimestamp +++ b/test/simulation/133-hwtimestamp @@ -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 diff --git a/test/simulation/test.common b/test/simulation/test.common index 18dd9e1..81e9ed6 100644 --- a/test/simulation/test.common +++ b/test/simulation/test.common @@ -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