test: fix tests to skip when missing required feature

This commit is contained in:
Miroslav Lichvar 2018-09-26 18:04:09 +02:00
parent 91dbe3c6c2
commit e8bc41e862
15 changed files with 55 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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]

View file

@ -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"

View file

@ -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"

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -84,6 +84,8 @@ done
test_start() {
rm -f tmp/*
echo "Testing $@:"
check_config_h 'FEAT_NTP 1' || test_skip
}
test_pass() {

View 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

View file

@ -18,10 +18,14 @@
**********************************************************************
*/
#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