#include <spawn.h>
+// http://www.gnu.org/software/automake/manual/automake.html#Using-the-TAP-test-protocol
+#define EXIT_SKIP 77
+#define EXIT_FATAL 77
+
namespace libtest {
class Application {
INVALID= 127
};
+ static const char* toString(error_t arg)
+ {
+ switch (arg)
+ {
+ case Application::SUCCESS:
+ return "EXIT_SUCCESS";
+
+ case Application::FAILURE:
+ return "EXIT_FAILURE";
+
+ case Application::INVALID:
+ return "127";
+
+ default:
+ break;
+ }
+
+ return "EXIT_UNKNOWN";
+ }
+
class Pipe {
public:
Pipe(int);
void add_long_option(const std::string& option_name, const std::string& option_value);
error_t run(const char *args[]= NULL);
error_t wait(bool nohang= true);
+ Application::error_t join();
libtest::vchar_t stdout_result() const
{
Pipe stdin_fd;
Pipe stdout_fd;
Pipe stderr_fd;
- char * * built_argv;
+ libtest::vchar_ptr_t built_argv;
pid_t _pid;
libtest::vchar_t _stdout_buffer;
libtest::vchar_t _stderr_buffer;
static inline std::ostream& operator<<(std::ostream& output, const enum Application::error_t &arg)
{
- switch (arg)
- {
- case Application::SUCCESS:
- output << "EXIT_SUCCESS";
- break;
-
- case Application::FAILURE:
- output << "EXIT_FAILURE";
- break;
-
- case Application::INVALID:
- output << "127";
- break;
-
- default:
- output << "EXIT_UNKNOWN";
- }
-
- return output;
+ return output << Application::toString(arg);
}
int exec_cmdline(const std::string& executable, const char *args[], bool use_libtool= false);