From 95ff8f359cfc2189bd4d7e02e15373027d2bda32 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 29 May 2017 20:05:54 +0300 Subject: Implement openssl process --- tests/openssl/driver.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/openssl/driver.cxx (limited to 'tests/openssl/driver.cxx') diff --git a/tests/openssl/driver.cxx b/tests/openssl/driver.cxx new file mode 100644 index 0000000..769c77e --- /dev/null +++ b/tests/openssl/driver.cxx @@ -0,0 +1,35 @@ +// file : tests/openssl/driver.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include +#include +#include +#include + +#include +#include // operator<<(ostream, exception) +#include + +using namespace std; +using namespace butl; + +// Usage: argv[0] +// +int +main (int, const char* argv[]) +try +{ + openssl os (nullfd, path ("-"), 2, path ("openssl"), "rand", 128); + + vector r + ((istreambuf_iterator (os.in)), istreambuf_iterator ()); + + os.in.close (); + return os.wait () && r.size () == 128 ? 0 : 1; +} +catch (const system_error& e) +{ + cerr << argv[0] << ": " << e << endl; + return 1; +} -- cgit v1.1