aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2018-01-26 14:51:24 +0100
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2018-01-26 14:51:24 +0100
commitf2de5ae16bc0fdbd29de69d0e0b82aaaa3f4c9e6 (patch)
tree231b036b4de36d4e5603e27dc25304b7125b10f6
parent47424b650961d0a7c3cdc80a3646941c1fe6b798 (diff)
downloadembedlog-f2de5ae16bc0fdbd29de69d0e0b82aaaa3f4c9e6.tar.gz
embedlog-f2de5ae16bc0fdbd29de69d0e0b82aaaa3f4c9e6.tar.bz2
embedlog-f2de5ae16bc0fdbd29de69d0e0b82aaaa3f4c9e6.zip
add: tests when --disable-monotonic or --disable-realtime
-rw-r--r--man/el_option.310
-rw-r--r--src/el-options.c8
-rw-r--r--tst/test-el-options.c22
3 files changed, 37 insertions, 3 deletions
diff --git a/man/el_option.3 b/man/el_option.3
index 5996c36..02e9012 100644
--- a/man/el_option.3
+++ b/man/el_option.3
@@ -223,6 +223,11 @@ Long timestamp will be added to log in format
. RS
Input argument is invalid
. RE
+. PP
+. B ENOSYS
+. RS
+Timestamp support was not compiled in and setting this options is disabled
+. RE
. RE
.RE
.PP
@@ -289,6 +294,11 @@ or NTP)
. RS
Input argument is invalid
. RE
+. PP
+. B ENODEV
+. RS
+Specified timer source was not compiled in and is no available
+. RE
. RE
.RE
.PP
diff --git a/src/el-options.c b/src/el-options.c
index 38241ee..0342f58 100644
--- a/src/el-options.c
+++ b/src/el-options.c
@@ -200,6 +200,14 @@ static int el_vooption
value_int = va_arg(ap, int);
VALID(EINVAL, 0 <= value_int && value_int < EL_TS_TM_ERROR);
+#ifndef ENABLE_REALTIME
+ VALID(ENODEV, value_int != EL_TS_TM_REALTIME);
+#endif
+
+#ifndef ENABLE_MONOTONIC
+ VALID(ENODEV, value_int != EL_TS_TM_MONOTONIC);
+#endif
+
options->timestamp_timer = value_int;
return 0;
diff --git a/tst/test-el-options.c b/tst/test-el-options.c
index 77a0c8c..4154e7d 100644
--- a/tst/test-el-options.c
+++ b/tst/test-el-options.c
@@ -318,6 +318,22 @@ static void options_opt_timestamp_timer(void)
for (i = EL_TS_TM_CLOCK; i != EL_TS_TM_ERROR; ++i)
{
#if ENABLE_TIMESTAMP
+# ifndef ENABLE_REALTIME
+ if (i == EL_TS_TM_REALTIME)
+ {
+ mt_ferr(el_option(EL_TS_TM, i), ENODEV);
+ continue;
+ }
+# endif
+
+# ifndef ENABLE_MONOTONIC
+ if (i == EL_TS_TM_MONOTONIC)
+ {
+ mt_ferr(el_option(EL_TS_TM, i), ENODEV);
+ continue;
+ }
+# endif
+
mt_fok(el_option(EL_TS_TM, i));
mt_fail(g_options.timestamp_timer == i);
#else
@@ -344,10 +360,10 @@ static void options_ooption_test(void)
#if ENABLE_TIMESTAMP
- el_ooption(&opts, EL_TS_TM, EL_TS_TM_MONOTONIC);
- mt_fail(opts.timestamp_timer == EL_TS_TM_MONOTONIC);
+ el_ooption(&opts, EL_TS_TM, EL_TS_TM_CLOCK);
+ mt_fail(opts.timestamp_timer == EL_TS_TM_CLOCK);
#else
- mt_ferr(el_ooption(&opts, EL_TS_TM, EL_TS_TM_MONOTONIC), ENOSYS);
+ mt_ferr(el_ooption(&opts, EL_TS_TM, EL_TS_TM_CLOCK), ENOSYS);
#endif
}