Skip to content

Commit

Permalink
Merge pull request flux-framework#6508 from garlick/macos6
Browse files Browse the repository at this point in the history
fix macos portability issues (sixth batch)
  • Loading branch information
mergify[bot] authored and chu11 committed Dec 16, 2024
2 parents 1088270 + a472a28 commit 37e1532
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ jobs:
run: scripts/configure-macos.sh
- name: make, including test programs
run: make check -j4 TESTS=
- name: check what works so far
run: scripts/check-macos.sh

generate-matrix:
# https://stackoverflow.com/questions/59977364
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ EXTRA_DIST = \
scripts/install-deps-deb.sh \
scripts/install-deps-rpm.sh \
scripts/install-deps-macos.sh \
scripts/configure-macos.sh
scripts/configure-macos.sh \
scripts/check-macos.sh

ACLOCAL_AMFLAGS = -I config

Expand Down
13 changes: 11 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,18 @@ RRA_WITH_SYSTEMD_UNITDIR


##
# Embedded libev
# libev
##
m4_include([src/common/libev/libev.m4])
AC_ARG_WITH([external-libev],
AS_HELP_STRING([--with-external-libev], [Use external libev]))
AS_IF([test "x$with_external_libev" = "xyes"], [
AC_SEARCH_LIBS([ev_run], [ev], [], [
AC_MSG_ERROR([--with-external-libev requested but external libev not found])
])
],[
m4_include([src/common/libev/libev.m4])
])
AM_CONDITIONAL([INTERNAL_LIBEV],[test "x$with_external_libev" != "xyes"])

AC_PKGCONFIG

Expand Down
27 changes: 27 additions & 0 deletions scripts/check-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Check what should work so far in src/common on macos

die() {
echo "$(basename $0): $@" >&2
exit 1
}

CONF_SCRIPT=scripts/configure-macos.sh

test -f $CONF_SCRIPT || die "please run from the top level of the source tree"
test -f configure || die "please run $CONF_SCRIPT first"

COMMON_WORKING="libtap libtestutil libyuarel libpmi liblsd libutil libflux libfluxutil libkvs libjob liboptparse libidset libtomlc99 libschedutil libeventlog libioencode librouter libdebugged libcontent libjob libhostlist libczmqcontainers libccan libzmqutil libtaskmap libfilemap libsdexec libmissing"
COMMON_BROKEN="libsubprocess libterminus librlist"

make -j4 -C src/common check SUBDIRS="$COMMON_WORKING" || die "check failed"

cat >&2 <<-EOT
=============================================
* Well the unit tests that worked before on macos still work!
* However, please note that the macos port of flux-core is incomplete.
* Search for 'macos' at https://github.com/flux-framework/flux-core/issues
* for portability issues that still need to be resolved.
=============================================
EOT
7 changes: 4 additions & 3 deletions scripts/configure-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ test -d macos-venv || die "please run $DEPS_SCRIPT first"

eval "$(/opt/homebrew/bin/brew shellenv)"

CPPFLAGS=-I${HOMEBREW_PREFIX}/include/lua
CPPFLAGS="-I${HOMEBREW_PREFIX}/include/lua"
CPPFLAGS="-I$(brew --prefix libev)/include ${CPPFLAGS}"
CPPFLAGS="-I$(brew --prefix epoll-shim)/include/libepoll-shim ${CPPFLAGS}"
LDFLAGS=-L${HOMEBREW_PREFIX}/lib

Expand All @@ -25,5 +26,5 @@ source macos-venv/bin/activate

./autogen.sh

CPPFLAGS=$CPPFLAGS LDFLAGS=$LDFLAGS PKG_CONFIG_PATH=$PKG_CONFIG_PATH \
./configure
CPPFLAGS="$CPPFLAGS" LDFLAGS=$LDFLAGS PKG_CONFIG_PATH=$PKG_CONFIG_PATH \
./configure --with-external-libev
1 change: 1 addition & 0 deletions scripts/install-deps-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ brew install \
make \
pkg-config \
epoll-shim \
libev \
zeromq \
jansson \
lz4 \
Expand Down
8 changes: 6 additions & 2 deletions src/common/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
SUBDIRS = \
libtap \
libtestutil \
libev \
libyuarel \
libpmi \
liblsd \
Expand Down Expand Up @@ -30,6 +29,9 @@ SUBDIRS = \
libfilemap \
libsdexec \
libmissing
if INTERNAL_LIBEV
SUBDIRS += libev
endif

AM_CFLAGS = $(WARNING_CFLAGS) $(CODE_COVERAGE_CFLAGS)
AM_LDFLAGS = $(CODE_COVERAGE_LIBS)
Expand All @@ -45,7 +47,6 @@ libflux_internal_la_LIBADD = \
$(builddir)/libccan/libccan.la \
$(builddir)/libutil/libutil.la \
$(builddir)/libidset/libidset.la \
$(builddir)/libev/libev.la \
$(builddir)/libyuarel/libyuarel.la \
$(builddir)/libtomlc99/libtomlc99.la \
$(builddir)/libeventlog/libeventlog.la \
Expand All @@ -62,6 +63,9 @@ libflux_internal_la_LIBADD = \
$(LIBDL) \
$(LIBRT) \
$(FLUX_SECURITY_LIBS)
if INTERNAL_LIBEV
libflux_internal_la_LIBADD += $(builddir)/libev/libev.la
endif
libflux_internal_la_LDFLAGS = $(san_ld_zdef_flag)

lib_LTLIBRARIES = libflux-core.la \
Expand Down
6 changes: 0 additions & 6 deletions src/common/libev/ev.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,6 @@ struct signalfd_siginfo
# endif
#endif

/* disable timerfd on macos */
#ifdef __APPLE__
# undef EV_USE_TIMERFD
# define EV_USE_TIMERFD 0
#endif

/*****************************************************************************/

#if EV_VERIFY >= 3
Expand Down
4 changes: 4 additions & 0 deletions src/common/libflux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ AM_CPPFLAGS = \
$(JANSSON_CFLAGS) \
$(LIBUUID_CFLAGS)

if INTERNAL_LIBEV
AM_CPPFLAGS += -I$(top_srcdir)/src/common/libev
endif

fluxcoreinclude_HEADERS = \
flux.h \
types.h \
Expand Down
3 changes: 1 addition & 2 deletions src/common/libflux/reactor.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
#include <errno.h>
#include <stdbool.h>
#include <fcntl.h>
#include <ev.h>
#include <flux/core.h>

#include "src/common/libev/ev.h"

#include "reactor_private.h"

struct flux_reactor {
Expand Down
2 changes: 1 addition & 1 deletion src/common/libflux/test/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void test_load ()
"flux_plugin_strerror returns expected result");
ok (flux_plugin_load_dso (p, "/tmp") < 0,
"flux_plugin_load_dso on directory fails");
like (flux_plugin_strerror (p), "^dlopen: .*Is a directory",
like (flux_plugin_strerror (p), "^dlopen: .*(Is a directory|not a file)",
"flux_plugin_strerror returns expected result");

ok (flux_plugin_set_conf (p, "{\"foo\":\"bar\"}") == 0,
Expand Down
3 changes: 1 addition & 2 deletions src/common/libflux/watcher_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
#include "config.h"
#endif
#include <assert.h>
#include <ev.h>
#include <flux/core.h>

#include "src/common/libev/ev.h"

#include "reactor_private.h"
#include "watcher_private.h"

Expand Down
6 changes: 3 additions & 3 deletions src/common/libjob/test/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,19 +486,19 @@ static void check_waitstatus_to_exitcode (void)
"error.text is cleared");
ok (flux_job_waitstatus_to_exitcode (9, &error) == 128+9,
"flux_job_waitstatus_to_exitcode (9) == %d", 128+9);
is (error.text, "job shell Killed",
like (error.text, "job shell Killed",
"error.text is %s", error.text);
ok (flux_job_waitstatus_to_exitcode (1<<8, &error) == 1,
"flux_job_waitstatus_to_exitcode (1<<8) = 1");
is (error.text, "task(s) exited with exit code 1",
"error.text is %s", error.text);
ok (flux_job_waitstatus_to_exitcode ((128+15)<< 8, &error) == 128+15,
"flux_job_waitstatus_to_exitcode ((128+15)<<8) = 128+15");
is (error.text, "task(s) Terminated",
like (error.text, "task\\(s\\) Terminated",
"error.text is %s", error.text);
ok (flux_job_waitstatus_to_exitcode ((128+11)<<8, &error) == 128+11,
"flux_job_waitstatus_to_exitcode ((128+11)<<8) = 128+11");
is (error.text, "task(s) Segmentation fault",
like (error.text, "task\\(s\\) Segmentation fault",
"error.text is %s", error.text);
}

Expand Down

0 comments on commit 37e1532

Please sign in to comment.