]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: add function for checking config.h in tests
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 26 Sep 2018 15:29:23 +0000 (17:29 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 27 Sep 2018 09:42:38 +0000 (11:42 +0200)
test/simulation/008-ntpera
test/simulation/105-ntpauth
test/simulation/115-cmdmontime
test/simulation/133-hwtimestamp
test/simulation/test.common

index 3c63419211b101ceb3c260fd90f82e42310f3680..360a97d5efc119f9d82d85f3858f9bd2976e4818 100755 (executable)
@@ -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')
index 4c77f108bf71d7978e157368c0e33428912ea420..9ec4fbab18dbc7c50da897b23e81e8d96a51874e 100755 (executable)
@@ -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"
index 2806a1f6bba1763a4a41eb7fae25a6f5dd3377f4..ada08da63a1508b7ccb7e74a6e1ac606fb503510 100755 (executable)
@@ -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"
index 1448c21c2a436577fd128e7e38f6bf96bd9ebf72..4939f7d03908f8ddf82ca65d54f3920424b4570f 100755 (executable)
@@ -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
index 18dd9e197791e86481d8d77ec009aaa04e41af6b..81e9ed69f5956243b054f78f673160575aede6dd 100644 (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