~brianaker/libmemcached/1164440

« back to all changes in this revision

Viewing changes to libtest/cmdline.h

  • Committer: Continuous Integration
  • Date: 2012-10-22 05:56:09 UTC
  • mfrom: (1086.1.8 libmemcached-1.0)
  • Revision ID: ci@tangent.org-20121022055609-cbooaw9bcdal4qge
Merge lp:~tangent-org/libmemcached/1.0-build Build: jenkins-Libmemcached-1.0-87

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#define EXIT_SKIP 77
43
43
#define EXIT_FATAL 77
44
44
 
 
45
#ifndef EX_NOEXEC
 
46
#  define EX_NOEXEC 126
 
47
#endif
 
48
 
 
49
#ifndef EX_NOTFOUND
 
50
#  define EX_NOTFOUND 127
 
51
#endif
 
52
 
45
53
namespace libtest {
46
54
 
47
55
class Application {
53
61
  enum error_t {
54
62
    SUCCESS= EXIT_SUCCESS,
55
63
    FAILURE= EXIT_FAILURE,
56
 
    INVALID= 127
 
64
    UNINITIALIZED,
 
65
    SIGTERM_KILLED,
 
66
    UNKNOWN,
 
67
    UNKNOWN_SIGNAL,
 
68
    INVALID_POSIX_SPAWN= 127
57
69
  };
58
70
 
59
71
  static const char* toString(error_t arg)
63
75
    case Application::SUCCESS:
64
76
      return "EXIT_SUCCESS";
65
77
 
 
78
    case Application::UNINITIALIZED:
 
79
      return "UNINITIALIZED";
 
80
 
 
81
    case Application::SIGTERM_KILLED:
 
82
      return "Exit happened via SIGTERM";
 
83
 
66
84
    case Application::FAILURE:
67
85
      return "EXIT_FAILURE";
68
86
 
69
 
    case Application::INVALID:
70
 
      return "127";
71
 
 
 
87
    case Application::UNKNOWN_SIGNAL:
 
88
      return "Exit happened via a signal which was not SIGTERM";
 
89
 
 
90
    case Application::INVALID_POSIX_SPAWN:
 
91
      return "127: Invalid call to posix_spawn()";
 
92
 
 
93
    case Application::UNKNOWN:
72
94
    default:
73
95
      break;
74
96
    }
111
133
  void add_option(const std::string&, const std::string&);
112
134
  void add_long_option(const std::string& option_name, const std::string& option_value);
113
135
  error_t run(const char *args[]= NULL);
114
 
  error_t wait(bool nohang= true);
115
136
  Application::error_t join();
116
137
 
117
138
  libtest::vchar_t stdout_result() const
201
222
  pid_t _pid;
202
223
  libtest::vchar_t _stdout_buffer;
203
224
  libtest::vchar_t _stderr_buffer;
 
225
  int _status;
 
226
  pthread_t _thread;
 
227
  error_t _app_exit_state;
204
228
};
205
229
 
206
230
static inline std::ostream& operator<<(std::ostream& output, const enum Application::error_t &arg)