diff --git a/test/Makefile b/test/Makefile index b8db69d..a6f9c98 100644 --- a/test/Makefile +++ b/test/Makefile @@ -54,6 +54,10 @@ TESTPROD += mcat mcat_SRCS += mcat.cpp # not a unittest +TESTPROD += mailbox +mailbox_SRCS += mailbox.cpp +# not a unittest + PROD_SYS_LIBS += event_core PROD_SYS_LIBS_DEFAULT += event_pthreads diff --git a/test/mailbox.cpp b/test/mailbox.cpp new file mode 100644 index 0000000..9a05e07 --- /dev/null +++ b/test/mailbox.cpp @@ -0,0 +1,62 @@ +/** + * Copyright - See the COPYRIGHT that is included with this distribution. + * pvxs is distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. + */ + +#include + +#include +#include +#include +#include + +DEFINE_LOGGER(app, "mailbox"); + +namespace { +using namespace pvxs; +using namespace pvxs::server; + +void usage(const char* cmd) +{ + std::cerr<<"Usage: "<\n"; +} + +} // namespace + +int main(int argc, char* argv[]) +{ + if(argc<=1) { + usage(argv[0]); + return 1; + } + + pvxs::logger_level_set(app.name, pvxs::Level::Info); + pvxs::logger_config_env(); + + auto initial = nt::NTScalar{TypeCode::Float64}.create(); + initial["value"] = 42.0; + + auto src(StaticSource::build()); + + auto pv(SharedPV::buildMailbox()); + pv.open(initial); + + src.add(argv[1], pv); + + auto serv = Server::Config::from_env() + .build() + .addSource("box", src.source()); + + auto& conf = serv.config(); + + std::cout<<"Serving from :\n"; + for(auto& iface : conf.interfaces) { + std::cout<<" "<