(void) munmap(mf->poimf_xml, mf->poimf_mapsize);
_PROP_FREE(mf, M_TEMP);
#else
- assert(0);
+ abort();
#endif
}
#endif /* !_KERNEL && !_STANDALONE */
/*
* Language features.
*/
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) || defined(__minix)
#include <sys/cdefs.h>
#define _PROP_ARG_UNUSED __unused
#else
::kill(atf_process_child_pid(&m_child), SIGTERM);
atf_process_status_t s;
- atf_error_t err = atf_process_child_wait(&m_child, &s);
+#if defined(__minix) && !defined(NDEBUG)
+ atf_error_t err =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ atf_process_child_wait(&m_child, &s);
INV(!atf_is_error(err));
atf_process_status_fini(&s);
}
}
{
- atf_error_t err = atf_fs_rmdir(dir);
+#if defined(__minix) && !defined(NDEBUG)
+ atf_error_t err =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ atf_fs_rmdir(dir);
INV(!atf_is_error(err));
}
}
err = atf_check_result_init(r, argv, &dir);
if (atf_is_error(err)) {
- atf_error_t err2 = atf_fs_rmdir(&dir);
+#if defined(__minix) && !defined(NDEBUG)
+ atf_error_t err2 =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ atf_fs_rmdir(&dir);
INV(!atf_is_error(err2));
goto out;
}
const int atf_process_stream_type_redirect_fd = 4;
const int atf_process_stream_type_redirect_path = 5;
+#if defined(__minix) && !defined(NDEBUG)
static
bool
stream_is_valid(const atf_process_stream_t *sb)
(sb->m_type == atf_process_stream_type_redirect_fd) ||
(sb->m_type == atf_process_stream_type_redirect_path);
}
+#endif /* defined(__minix) && !defined(NDEBUG) */
atf_error_t
atf_process_stream_init_capture(atf_process_stream_t *sb)
if (ea->m_prehook != NULL)
ea->m_prehook();
- const int ret = const_execvp(atf_fs_path_cstring(ea->m_prog), ea->m_argv);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ const_execvp(atf_fs_path_cstring(ea->m_prog), ea->m_argv);
const int errnocopy = errno;
INV(ret == -1);
fprintf(stderr, "exec(%s) failed: %s\n",
// Don't bother keeping track of the memory allocated by construct_argv:
// we are going to exec or die immediately.
- const int ret = execv(shell.c_str(), const_cast< char** >(argv));
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ execv(shell.c_str(), const_cast< char** >(argv));
INV(ret == -1);
std::cerr << "Failed to execute " << shell << ": " << std::strerror(errno)
<< "\n";
cdf_read_sector(const cdf_info_t *info, void *buf, size_t offs, size_t len,
const cdf_header_t *h, cdf_secid_t id)
{
+#if defined(__minix) && !defined(NDEBUG)
size_t ss = CDF_SEC_SIZE(h);
+#endif /* defined(__minix) && !defined(NDEBUG) */
size_t pos = CDF_SEC_POS(h, id);
+#if defined(__minix) && !defined(NDEBUG)
+ /* MINIX: It seems even with NDEBUG, when built as a tool assert is
+ * still defined on linux. */
assert(ss == len);
+#endif /* defined(__minix) && !defined(NDEBUG) */
return cdf_read(info, (off_t)pos, ((char *)buf) + offs, len);
}
cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs,
size_t len, const cdf_header_t *h, cdf_secid_t id)
{
+#if defined(__minix) && !defined(NDEBUG)
size_t ss = CDF_SHORT_SEC_SIZE(h);
+#endif /* defined(__minix) && !defined(NDEBUG) */
size_t pos = CDF_SHORT_SEC_POS(h, id);
+#if defined(__minix) && !defined(NDEBUG)
assert(ss == len);
+#endif /* defined(__minix) && !defined(NDEBUG) */
if (pos > CDF_SEC_SIZE(h) * sst->sst_len) {
DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
SIZE_T_FORMAT "u\n",
const std::string contents(
static_cast< const char *>(raw_contents.memory), raw_contents.size);
- const bool more = stmt.step();
+#if defined(__minix) && !defined(NDEBUG)
+ const bool more =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ stmt.step();
INV(!more);
return contents;
fs::path(stmt.safe_column_text("root")),
stmt.safe_column_text("test_suite_name"),
get_metadata(db, stmt.safe_column_int64("metadata_id"))));
- const bool more = stmt.step();
+#if defined(__minix) && !defined(NDEBUG)
+ const bool more =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ stmt.step();
INV(!more);
LD(F("Loaded test program '%s'; getting test cases") %
namespace cmdline = utils::cmdline;
namespace text = utils::text;
+#if defined(__minix) && defined(NDEBUG)
+#undef PRE_MSG
+#define PRE_MSG(expr, msg) \
+ do { \
+ if (!(expr)) \
+ utils::sanity_failure(utils::precondition, __FILE__, __LINE__, msg); \
+ } while (0)
+#endif /* defined(__minix) && defined(NDEBUG) */
/// Constructs a generic option with both a short and a long name.
///
::timeval data;
{
- const int ret = ::gettimeofday(&data, NULL);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ ::gettimeofday(&data, NULL);
INV(ret != -1);
}
argv[1 + i] = args[i].c_str();
argv[1 + args.size()] = NULL;
- const int ret = ::execv(program.c_str(),
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ ::execv(program.c_str(),
(char* const*)(unsigned long)(const void*)argv);
const int original_errno = errno;
assert(ret == -1);
sigaddset(&mask, SIGHUP);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGTERM);
- const int ret = ::sigprocmask(SIG_BLOCK, &mask, &old_sigmask);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ ::sigprocmask(SIG_BLOCK, &mask, &old_sigmask);
INV(ret != -1);
}
static void
unmask_signals(void)
{
- const int ret = ::sigprocmask(SIG_SETMASK, &old_sigmask, NULL);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ ::sigprocmask(SIG_SETMASK, &old_sigmask, NULL);
INV(ret != -1);
}
close(void)
{
PRE(db != NULL);
- int error = ::sqlite3_close(db);
+#if defined(__minix) && !defined(NDEBUG)
+ int error =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ ::sqlite3_close(db);
// For now, let's consider a return of SQLITE_BUSY an error. We should
// not be trying to close a busy database in our code. Maybe revisit
// this later to raise busy errors as exceptions.
void
sqlite::statement::step_without_results(void)
{
- const bool data = step();
+#if defined(__minix) && !defined(NDEBUG)
+ const bool data =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ step();
INV_MSG(!data, "The statement should not have produced any rows, but it "
"did");
}
sqlite::statement::clear_bindings(void)
{
const int error = ::sqlite3_clear_bindings(_pimpl->stmt);
+#if defined(__minix) && defined(NDEBUG)
+#undef PRE_MSG
+#define PRE_MSG(expr, msg) \
+ do { \
+ if (!(expr)) \
+ utils::sanity_failure(utils::precondition, __FILE__, __LINE__, msg); \
+ } while (0)
+#endif /* defined(__minix) && defined(NDEBUG) */
PRE_MSG(error == SQLITE_OK, "SQLite3 contract has changed; it should "
"only return SQLITE_OK");
}
}
assert(false);
+#if defined(__minix) && defined(NDEBUG)
+ abort();
+#endif /* defined(__minix) && !defined(NDEBUG) */
}
kyua_oom_error_new(void)
{
// This is idempotent; no need to ensure that we call it only once.
- const bool ok = error_init(&oom_error, kyua_oom_error_type, NULL, 0,
- oom_format);
+#if defined(__minix) && !defined(NDEBUG)
+ const bool ok =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ error_init(&oom_error, kyua_oom_error_type, NULL, 0, oom_format);
assert(ok);
return &oom_error;
if (pid == -1) {
return kyua_libc_error_new(errno, "fork() failed");
} else if (pid == 0) {
- const int ret = execlp(UMOUNT, "umount", mount_point, NULL);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ execlp(UMOUNT, "umount", mount_point, NULL);
assert(ret == -1);
err(EXIT_FAILURE, "Failed to execute " UMOUNT);
}
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGHUP);
sigaddset(&mask, SIGTERM);
- const int ret = sigprocmask(operation, &mask, NULL);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ sigprocmask(operation, &mask, NULL);
assert(ret != -1);
}
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
- const int ret = sigaction(signo, &sa, old_sa);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ sigaction(signo, &sa, old_sa);
assert(ret != -1);
}
new_timer.it_interval.tv_usec = 0;
new_timer.it_value.tv_sec = seconds;
new_timer.it_value.tv_usec = 0;
- const int ret = setitimer(ITIMER_REAL, &new_timer, old_itimerval);
+#if defined(__minix) && !defined(NDEBUG)
+ const int ret =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ setitimer(ITIMER_REAL, &new_timer, old_itimerval);
assert(ret != -1);
}
kyua_run_wait(const pid_t pid, int* status, bool* timed_out)
{
int tmp_status;
- const pid_t waited_pid = waitpid(pid, &tmp_status, 0);
+#if defined(__minix) && !defined(NDEBUG)
+ const pid_t waited_pid =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ waitpid(pid, &tmp_status, 0);
assert(pid == waited_pid);
protect();
}
(void)close(STDIN_FILENO);
- const int input_fd = open("/dev/null", O_RDONLY);
+#if defined(__minix) && !defined(NDEBUG)
+ const int input_fd =
+#endif /* defined(__minix) && !defined(NDEBUG) */
+ open("/dev/null", O_RDONLY);
assert(input_fd == STDIN_FILENO);
const int output_fd = fileno(output);
cp_grant_id_t grant)
{
nwio_tcpopt_t tcpopt;
+#if !defined(NDEBUG)
struct tcp_pcb * pcb = (struct tcp_pcb *) sock->pcb;
+#endif /* !defined(NDEBUG) */
debug_tcp_print("socket num %ld", get_sock_num(sock));
cp_grant_id_t grant)
{
nwio_tcpopt_t tcpopt;
+#if !defined(NDEBUG)
struct tcp_pcb * pcb = (struct tcp_pcb *) sock->pcb;
+#endif /* !defined(NDEBUG) */
debug_tcp_print("socket num %ld", get_sock_num(sock));