]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: fix tests to skip when missing required feature
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 26 Sep 2018 16:04:09 +0000 (18:04 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 27 Sep 2018 09:42:38 +0000 (11:42 +0200)
15 files changed:
test/simulation/106-refclock
test/simulation/107-allowdeny
test/simulation/110-chronyc
test/simulation/112-port
test/simulation/113-leapsecond
test/simulation/115-cmdmontime
test/simulation/119-smoothtime
test/simulation/121-orphan
test/simulation/124-tai
test/simulation/128-nocontrol
test/simulation/133-hwtimestamp
test/simulation/134-log
test/simulation/test.common
test/unit/ntp_core.c
test/unit/ntp_sources.c

index 5c5794ca47317cb75c50d08320d5239a375a9236..c4cec202a5a5cd1b53e8e1d8a973a0b81879e671 100755 (executable)
@@ -3,6 +3,10 @@
 . ./test.common
 test_start "SHM refclock"
 
+check_config_h 'FEAT_REFCLOCK 1' || test_skip
+check_config_h 'FEAT_PHC 1' || test_skip
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
 servers=0
 limit=1000
 refclock_jitter=$jitter
index b11db32410784daf9864cc0f7587a8374ae113ca..3ab83ff778c63dda425b9be18d6df4a4029db25e 100755 (executable)
@@ -4,6 +4,8 @@
 
 test_start "allow/deny directives"
 
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
 limit=500
 
 # Note that start_client in clknetsim.bash always adds allow to the config
index 7fe5dcfe55af62e058f5fa4a5057f6caa6747102..5736ae4d7867d3d5df812f5772d21951d8bd8700 100755 (executable)
@@ -4,6 +4,9 @@
 
 test_start "chronyc"
 
+check_config_h 'FEAT_REFCLOCK 1' || test_skip
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
 refclock_jitter=$jitter
 client_conf="
 refclock SHM 0 noselect
index e98375719f795eedb262d1c4e017505824cf85d3..a8efabd1d5dbc14c40a3bcc92178a2482d76e877 100755 (executable)
@@ -4,6 +4,8 @@
 
 test_start "port and acquisitionport directives"
 
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
 run_test || test_fail
 check_chronyd_exit || test_fail
 check_source_selection || test_fail
index 5b9758fd65de343a1f68676757df6a17fa26aede..2fb81b8875437d508445a5d9d41bc47941a8a473 100755 (executable)
@@ -1,8 +1,11 @@
 #!/bin/bash
 
 . ./test.common
+
 test_start "leap second"
 
+check_config_h 'FEAT_REFCLOCK 1' || test_skip
+
 export CLKNETSIM_START_DATE=$(TZ=UTC date -d 'Dec 30 2008 0:00:00' +'%s')
 
 leap=$[2 * 24 * 3600]
index ada08da63a1508b7ccb7e74a6e1ac606fb503510..732decda86f253d2a82dc87f633833f3db94d2e7 100755 (executable)
@@ -6,6 +6,7 @@ test_start "cmdmon timestamps"
 
 # The following tests need 64-bit time_t
 check_config_h 'HAVE_LONG_TIME_T 1' || test_skip
+check_config_h 'FEAT_CMDMON 1' || test_skip
 
 limit=2
 client_server_options="noselect"
index 6b4ae394356d0c8978833789f61c93213c53480a..3f907159c449d9a57a6672302193b5c9381c1c5e 100755 (executable)
@@ -1,8 +1,11 @@
 #!/bin/bash
 
 . ./test.common
+
 test_start "smoothtime option"
 
+check_config_h 'FEAT_REFCLOCK 1' || test_skip
+
 server_strata=2
 server_conf="smoothtime 400 0.001"
 server_server_options="minpoll 8"
index 1b47f7667b25b3dd56ba4f87c1cff8055c1fd897..bbebc9d4021012fdafe9c91734e14d26f6a75310 100755 (executable)
@@ -4,6 +4,8 @@
 
 test_start "orphan option"
 
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
 server_strata=3
 server_conf="local stratum 5 orphan
 server 192.168.123.1
index b5be030615696bd72d50be9d7be1f42d65014506..d41d29d82f1452e3dfaf27ed1d2c5bd669ad07ba 100755 (executable)
@@ -1,8 +1,11 @@
 #!/bin/bash
 
 . ./test.common
+
 test_start "tai option"
 
+check_config_h 'FEAT_REFCLOCK 1' || test_skip
+
 export CLKNETSIM_START_DATE=$(TZ=UTC date -d 'Dec 31 2008 23:50:00' +'%s')
 
 leap=$[10 * 60]
index 0a98cd7843a65f7236bed514620aa171fba4cd8d..cca82f4e49b64677c0084f4180a85e02c7bd78f5 100755 (executable)
@@ -4,6 +4,8 @@
 
 test_start "-x option"
 
+check_config_h 'FEAT_CMDMON 1' || test_skip
+
 wander=0.0
 time_offset=0.0
 freq_offset=0.0
index 4939f7d03908f8ddf82ca65d54f3920424b4570f..113ea69014a297c5029e84cd76c97e6c2e939e32 100755 (executable)
@@ -4,6 +4,8 @@
 
 test_start "hwtimestamp directive"
 
+check_config_h 'HAVE_LINUX_TIMESTAMPING 1' || test_skip
+
 export CLKNETSIM_TIMESTAMPING=2
 
 refclock_jitter=1e-8
index f5293c42afb078315381eb6c64cba8f8b586f903..0a6ef76f030fda26835d62e9258e8faa55364bb4 100755 (executable)
@@ -1,8 +1,11 @@
 #!/bin/bash
 
 . ./test.common
+
 test_start "log directive"
 
+check_config_h 'FEAT_PHC 1' || test_skip
+
 refclock_jitter=$jitter
 client_server_options="maxpoll 6"
 client_conf="refclock PHC /dev/ptp0 dpoll 4 poll 6 noselect
index 81e9ed69f5956243b054f78f673160575aede6dd..951a794b61ab29784292a2cdfed104ee82adc79d 100644 (file)
@@ -84,6 +84,8 @@ done
 test_start() {
        rm -f tmp/*
        echo "Testing $@:"
+
+       check_config_h 'FEAT_NTP 1' || test_skip
 }
 
 test_pass() {
index 5e519e5641c4e8273542e2e245a3832b8645f26d..c977a7866e64003c32fe432805a188d1cabdba39 100644 (file)
@@ -28,6 +28,8 @@
 #include <local.h>
 #include "test.h"
 
+#ifdef FEAT_NTP
+
 static struct timespec current_time;
 static NTP_Receive_Buffer req_buffer, res_buffer;
 static int req_length, res_length;
@@ -475,3 +477,11 @@ test_unit(void)
   CNF_Finalise();
   HSH_Finalise();
 }
+
+#else
+void
+test_unit(void)
+{
+  TEST_REQUIRE(0);
+}
+#endif
index ea8f19cbb6d4893a2691abbbc089f84b2768683d..f13852e26d9db5c62abee7c24645762d64529fcd 100644 (file)
  **********************************************************************
  */
 
+#include <config.h>
+#include "test.h"
+
+#ifdef FEAT_NTP
+
 #include <ntp_sources.c>
 #include <conf.h>
 #include <ntp_io.h>
-#include "test.h"
 
 void
 test_unit(void)
@@ -98,3 +102,11 @@ test_unit(void)
   CNF_Finalise();
   HSH_Finalise();
 }
+
+#else
+void
+test_unit(void)
+{
+  TEST_REQUIRE(0);
+}
+#endif