#define DEFAULT_TIMEOUT 4
#endif
+/*
+ * When a process exits either normally, with exit(), or
+ * by an uncaught signal, The lower 0x377 bits are passed
+ * to the parent. Of those, only the lower 8 bits are
+ * returned by the WEXITSTATUS() macro.
+ */
+#define WEXITSTATUS_MASK 0xFF
+
int check_major_version = CHECK_MAJOR_VERSION;
int check_minor_version = CHECK_MINOR_VERSION;
int check_micro_version = CHECK_MICRO_VERSION;
tf->loop_start = start;
tf->loop_end = end;
tf->signal = _signal; /* 0 means no signal expected */
- tf->allowed_exit_value = allowed_exit_value; /* 0 is default successful exit */
+ tf->allowed_exit_value = (WEXITSTATUS_MASK & allowed_exit_value); /* 0 is default successful exit */
tf->name = name;
check_list_add_end (tc->tflst, tf);
}
const char *tname,
int iter,
int status, int expected_signal,
- unsigned char allowed_exit_value);
+ signed char allowed_exit_value);
static void set_fork_info (TestResult *tr, int status, int expected_signal,
- unsigned char allowed_exit_value);
+ signed char allowed_exit_value);
static char *signal_msg (int sig);
static char *signal_error_msg (int signal_received, int signal_expected);
static char *exit_msg (int exitstatus);
const char *tname,
int iter,
int status, int expected_signal,
- unsigned char allowed_exit_value)
+ signed char allowed_exit_value)
{
TestResult *tr;
return tr;
}
-static void set_fork_info (TestResult *tr, int status, int signal_expected, unsigned char allowed_exit_value)
+static void set_fork_info (TestResult *tr, int status, int signal_expected, signed char allowed_exit_value)
{
int was_sig = WIFSIGNALED(status);
int was_exit = WIFEXITED(status);
- int exit_status = WEXITSTATUS(status);
+ signed char exit_status = WEXITSTATUS(status);
int signal_received = WTERMSIG(status);
if (was_sig) {