aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/sntp/tests/sntptest.h
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2015-03-30 13:30:15 +0000
committerCy Schubert <cy@FreeBSD.org>2015-03-30 13:30:15 +0000
commit2b15cb3d0922bd70ea592f0da9b4a5b167f4d53f (patch)
tree388af01c574ac107295ae453bab1e272bbfcda27 /contrib/ntp/sntp/tests/sntptest.h
parenta83592093c063d2b02127a1de7c7c93d5f600bd2 (diff)
parentf7cba3a80d9ebefc57776fffd17a4ae68f72e494 (diff)
MFV ntp 4.2.8p1 (r258945, r275970, r276091, r276092, r276093, r278284)
Thanks to roberto for providing pointers to wedge this into HEAD. Approved by: roberto
Notes
Notes: svn path=/head/; revision=280849
Diffstat (limited to 'contrib/ntp/sntp/tests/sntptest.h')
-rw-r--r--contrib/ntp/sntp/tests/sntptest.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/contrib/ntp/sntp/tests/sntptest.h b/contrib/ntp/sntp/tests/sntptest.h
new file mode 100644
index 000000000000..d5add9cbf465
--- /dev/null
+++ b/contrib/ntp/sntp/tests/sntptest.h
@@ -0,0 +1,35 @@
+#ifndef SNTPTEST_H
+#define SNTPTEST_H
+
+#include "tests_main.h"
+
+extern "C" {
+#include "ntp_stdlib.h"
+#include "sntp-opts.h"
+};
+
+class sntptest : public ntptest {
+protected:
+ sntptest() {
+ optionSaveState(&sntpOptions);
+ }
+
+ ~sntptest() {
+ optionRestore(&sntpOptions);
+ }
+
+ void ActivateOption(const char* option, const char* argument) {
+ const int ARGV_SIZE = 4;
+
+ char* opts[ARGV_SIZE];
+
+ opts[0] = estrdup("sntpopts");
+ opts[1] = estrdup(option);
+ opts[2] = estrdup(argument);
+ opts[3] = estrdup("127.0.0.1");
+
+ optionProcess(&sntpOptions, ARGV_SIZE, opts);
+ }
+};
+
+#endif // SNTPTEST_H