Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hurd support #295

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ qb_sys_mmap_file_open(char *path, const char *file, size_t bytes,
if (is_absolute) {
(void)strlcpy(path, file, PATH_MAX);
} else {
#if defined(QB_LINUX) || defined(QB_CYGWIN)
#if defined(QB_LINUX) || defined(QB_CYGWIN) || defined(QB_GNU)
snprintf(path, PATH_MAX, "/dev/shm/%s", file);
#else
snprintf(path, PATH_MAX, "%s/%s", SOCKETDIR, file);
Expand Down
2 changes: 1 addition & 1 deletion tests/_syslog_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifndef QB_SYSLOG_OVERRIDE_H_DEFINED
#define QB_SYSLOG_OVERRIDE_H_DEFINED

#include <limits.h>
#include "os_base.h"

extern int _syslog_opened;
extern int _syslog_option;
Expand Down
9 changes: 9 additions & 0 deletions tests/check_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,13 @@
/* add_tcase(<dest-suite>, <testcase-tmp-storage>, <function>[, <timeout>]) */
#define add_tcase(...) add_tcase_select(VA_ARGS_CNT(__VA_ARGS__))(__VA_ARGS__)

/* expected failure (the timeout argument is mandatory here) */
#define add_tcase_xfail(suite, tcase, func, timeout) \
do { \
(tcase) = tcase_create(STRINGIFY(func) + sizeof("test")); \
tcase_add_exit_test((tcase), func, 1); \
tcase_set_timeout((tcase), (timeout)); \
suite_add_tcase((suite), (tcase)); \
} while (0)

#endif
78 changes: 43 additions & 35 deletions tests/check_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,21 +1551,28 @@ make_shm_suite(void)
TCase *tc;
Suite *s = suite_create("shm");

add_tcase(s, tc, test_ipc_txrx_shm_timeout, 30);
add_tcase(s, tc, test_ipc_server_fail_shm, 8);
add_tcase(s, tc, test_ipc_txrx_shm_block, 8);
add_tcase(s, tc, test_ipc_txrx_shm_tmo, 8);
add_tcase(s, tc, test_ipc_fc_shm, 8);
add_tcase(s, tc, test_ipc_dispatch_shm, 16);
add_tcase(s, tc, test_ipc_stress_test_shm, 16);
add_tcase(s, tc, test_ipc_bulk_events_shm, 16);
add_tcase(s, tc, test_ipc_exit_shm, 8);
add_tcase(s, tc, test_ipc_event_on_created_shm, 10);
add_tcase(s, tc, test_ipc_service_ref_count_shm, 10);
add_tcase(s, tc, test_ipc_stress_connections_shm, 3600);
#undef add_cond_tcase
#ifdef DISABLE_IPC_SHM
#define add_cond_tcase(func, timeout) add_tcase_xfail(s, tc, func, timeout)
#else
#define add_cond_tcase(func, timeout) add_tcase(s, tc, func, timeout)
#endif

add_cond_tcase(test_ipc_txrx_shm_timeout, 30);
add_cond_tcase(test_ipc_server_fail_shm, 8);
add_cond_tcase(test_ipc_txrx_shm_block, 8);
add_cond_tcase(test_ipc_txrx_shm_tmo, 8);
add_cond_tcase(test_ipc_fc_shm, 8);
add_cond_tcase(test_ipc_dispatch_shm, 16);
add_cond_tcase(test_ipc_stress_test_shm, 16);
add_cond_tcase(test_ipc_bulk_events_shm, 16);
add_cond_tcase(test_ipc_exit_shm, 8);
add_cond_tcase(test_ipc_event_on_created_shm, 10);
add_cond_tcase(test_ipc_service_ref_count_shm, 10);
add_cond_tcase(test_ipc_stress_connections_shm, 3600);

#ifdef HAVE_FAILURE_INJECTION
add_tcase(s, tc, test_ipcc_truncate_when_unlink_fails_shm, 8);
add_cond_tcase(test_ipcc_truncate_when_unlink_fails_shm, 8);
#endif

return s;
Expand All @@ -1577,24 +1584,32 @@ make_soc_suite(void)
Suite *s = suite_create("socket");
TCase *tc;

add_tcase(s, tc, test_ipc_txrx_us_timeout, 30);
#undef add_cond_tcase
#ifdef QB_GNU
/* SO_SNDBUF isn't implemented in pflocal on Hurd */
#define add_cond_tcase(func, timeout) add_tcase_xfail(s, tc, func, timeout)
#else
#define add_cond_tcase(func, timeout) add_tcase(s, tc, func, timeout)
#endif

add_cond_tcase(test_ipc_txrx_us_timeout, 30);
/* Commented out for the moment as space in /dev/shm on the CI machines
causes random failures */
/* add_tcase(s, tc, test_ipc_max_dgram_size, 30); */
add_tcase(s, tc, test_ipc_server_fail_soc, 8);
add_tcase(s, tc, test_ipc_txrx_us_block, 8);
add_tcase(s, tc, test_ipc_txrx_us_tmo, 8);
add_tcase(s, tc, test_ipc_fc_us, 8);
add_tcase(s, tc, test_ipc_exit_us, 8);
add_tcase(s, tc, test_ipc_dispatch_us, 16);
/* add_cond_tcase(test_ipc_max_dgram_size, 30); */
add_cond_tcase(test_ipc_server_fail_soc, 8);
add_cond_tcase(test_ipc_txrx_us_block, 8);
add_cond_tcase(test_ipc_txrx_us_tmo, 8);
add_cond_tcase(test_ipc_fc_us, 8);
add_cond_tcase(test_ipc_exit_us, 8);
add_cond_tcase(test_ipc_dispatch_us, 16);
#ifndef __clang__ /* see variable length array in structure' at the top */
add_tcase(s, tc, test_ipc_stress_test_us, 60);
add_cond_tcase(test_ipc_stress_test_us, 60);
#endif
add_tcase(s, tc, test_ipc_bulk_events_us, 16);
add_tcase(s, tc, test_ipc_event_on_created_us, 10);
add_tcase(s, tc, test_ipc_disconnect_after_created_us, 10);
add_tcase(s, tc, test_ipc_service_ref_count_us, 10);
add_tcase(s, tc, test_ipc_stress_connections_us, 3600);
add_cond_tcase(test_ipc_bulk_events_us, 16);
add_cond_tcase(test_ipc_event_on_created_us, 10);
add_cond_tcase(test_ipc_disconnect_after_created_us, 10);
add_cond_tcase(test_ipc_service_ref_count_us, 10);
add_cond_tcase(test_ipc_stress_connections_us, 3600);

return s;
}
Expand All @@ -1605,19 +1620,12 @@ main(void)
int32_t number_failed;
SRunner *sr;
Suite *s;
int32_t do_shm_tests = QB_TRUE;

set_ipc_name("ipc_test");
#ifdef DISABLE_IPC_SHM
do_shm_tests = QB_FALSE;
#endif /* DISABLE_IPC_SHM */

s = make_soc_suite();
sr = srunner_create(s);

if (do_shm_tests) {
srunner_add_suite(sr, make_shm_suite());
}
srunner_add_suite(sr, make_shm_suite());

qb_log_init("check", LOG_USER, LOG_EMERG);
atexit(qb_log_fini);
Expand Down