Skip to content

Commit

Permalink
Reverted the macos CI process(using macos-fuse-t)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Sep 24, 2023
1 parent 64642e1 commit d7ed390
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 129 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,15 @@ jobs:
make ALL_TESTS=1 check -C test || (test/filter-suite-log.sh test/test-suite.log; exit 1)
# [NOTE]
# This Job does not work for macOS 11 and later because load_osxfuse returns exit code = 1.
# Apple states "You must be signed in as an administrator user to install new kernel
# extensions, and your Mac must be rebooted for the extensions to load.", so it needs
# to reboot OS.
# As of May 2023, GitHub Actions are no longer able to launch macos 10.15 as runner,
# so we can not run this Job.
# In the future, if it is found a solution, we will resume this Job execution.
# Using macos-fuse-t
# This product(package) is a workaround for osxfuse which required an OS reboot(macos 11 and later).
# see. https://github.com/macos-fuse-t/fuse-t
# About osxfuse
# This job doesn't work with Github Actions using macOS 11+ because "load_osxfuse" returns
# "exit code = 1".(requires OS reboot)
#
macos10:
if: false

runs-on: macos-10.15
macos12:
runs-on: macos-12

steps:
- name: Checkout source code
Expand All @@ -149,14 +146,15 @@ jobs:
TAPS="$(brew --repository)/Library/Taps";
if [ -e "$TAPS/caskroom/homebrew-cask" ]; then rm -rf "$TAPS/caskroom/homebrew-cask"; fi;
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/homebrew-cask
HOMEBREW_NO_AUTO_UPDATE=1 brew tap macos-fuse-t/homebrew-cask
- name: Install osxfuse
- name: Install fuse-t
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install osxfuse
HOMEBREW_NO_AUTO_UPDATE=1 brew install fuse-t
- name: Install brew other packages
run: |
S3FS_BREW_PACKAGES='automake cppcheck python3 coreutils gnu-sed shellcheck';
S3FS_BREW_PACKAGES='automake cppcheck python3 coreutils gnu-sed shellcheck jq';
for s3fs_brew_pkg in ${S3FS_BREW_PACKAGES}; do if brew list | grep -q ${s3fs_brew_pkg}; then if brew outdated | grep -q ${s3fs_brew_pkg}; then HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade ${s3fs_brew_pkg}; fi; else HOMEBREW_NO_AUTO_UPDATE=1 brew install ${s3fs_brew_pkg}; fi; done;
- name: Install awscli2
Expand All @@ -165,10 +163,6 @@ jobs:
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
- name: Check osxfuse permission
run: |
if [ -f /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs ]; then sudo chmod +s /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs; elif [ -f /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse ]; then sudo chmod +s /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse; else exit 1; fi
- name: Build
run: |
./autogen.sh
Expand All @@ -191,8 +185,6 @@ jobs:
- name: Test suite
run: |
make check -C src
echo "user_allow_other" | sudo tee -a /etc/fuse.conf >/dev/null
if [ -f /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs ]; then /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs; elif [ -f /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse ]; then /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse; else exit 1; fi
make ALL_TESTS=1 check -C test || (test/filter-suite-log.sh test/test-suite.log; exit 1)
MemoryTest:
Expand Down
24 changes: 13 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ CXXFLAGS="$CXXFLAGS -Wall -fno-exceptions -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOUR
dnl ----------------------------------------------
dnl For macOS
dnl ----------------------------------------------
found_fuse_t=no
case "$target" in
*-cygwin* )
# Do something specific for windows using winfsp
Expand All @@ -58,10 +57,17 @@ case "$target" in
;;
esac

dnl ----------------------------------------------
dnl Checking the FUSE library
dnl ----------------------------------------------
dnl Distinguish between Linux (libfuse) and macOS (FUSE-T).
dnl
found_fuse_t=no
PKG_CHECK_MODULES([FUSE_T], [fuse-t >= ${min_fuse_t_version}], [found_fuse_t=yes], [found_fuse_t=no])

AS_IF([test "x$found_fuse_t" = "xyes"],
[PKG_CHECK_MODULES([common_lib_checking], [fuse-t >= ${min_fuse_t_version} libcurl >= 7.0 libxml-2.0 >= 2.6 ])])
AS_IF([test "$found_fuse_t" = "yes"],
[PKG_CHECK_MODULES([fuse_library_checking], [fuse-t >= ${min_fuse_t_version}])],
[PKG_CHECK_MODULES([fuse_library_checking], [fuse >= ${min_fuse_version}])])

dnl ----------------------------------------------
dnl Choice SSL library
Expand Down Expand Up @@ -188,17 +194,13 @@ AS_IF(

dnl
dnl For PKG_CONFIG before checking nss/gnutls.
dnl this is redundant checking, but we need checking before following.
dnl
AS_IF([test "x$found_fuse_t" = "xyes"],
[PKG_CHECK_MODULES([common_lib_checking], [fuse-t >= ${min_fuse_t_version} libcurl >= 7.0 libxml-2.0 >= 2.6 ])],
[PKG_CHECK_MODULES([common_lib_checking], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 ])])

AC_MSG_CHECKING([compile s3fs with])
case "${auth_lib}" in
openssl)
AC_MSG_RESULT(OpenSSL)
AS_IF([test "x$found_fuse_t" = "xyes"],
AS_IF([test "$found_fuse_t" = "yes"],
[PKG_CHECK_MODULES([DEPS], [fuse-t >= ${min_fuse_t_version} libcurl >= 7.0 libxml-2.0 >= 2.6 libcrypto >= 0.9 ])],
[PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 libcrypto >= 0.9 ])])

Expand All @@ -218,7 +220,7 @@ gnutls)
AS_IF([test "$gnutls_nettle" = ""], [AC_CHECK_LIB(gcrypt, gcry_control, [gnutls_nettle=0])])
AS_IF([test $gnutls_nettle = 0],
[
AS_IF([test "x$found_fuse_t" = "xyes"],
AS_IF([test "$found_fuse_t" = "yes"],
[PKG_CHECK_MODULES([DEPS], [fuse-t >= ${min_fuse_t_version} libcurl >= 7.0 libxml-2.0 >= 2.6 gnutls >= 2.12.0 ])],
[PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 gnutls >= 2.12.0 ])])
LIBS="-lgnutls -lgcrypt $LIBS"
Expand All @@ -234,7 +236,7 @@ nettle)
AS_IF([test "$gnutls_nettle" = ""], [AC_CHECK_LIB(nettle, nettle_MD5Init, [gnutls_nettle=1])])
AS_IF([test $gnutls_nettle = 1],
[
AS_IF([test "x$found_fuse_t" = "xyes"],
AS_IF([test "$found_fuse_t" = "yes"],
[PKG_CHECK_MODULES([DEPS], [fuse-t >= ${min_fuse_t_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nettle >= 2.7.1 ])],
[PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nettle >= 2.7.1 ])])
LIBS="-lgnutls -lnettle $LIBS"
Expand All @@ -245,7 +247,7 @@ nettle)
;;
nss)
AC_MSG_RESULT(NSS)
AS_IF([test "x$found_fuse_t" = "xyes"],
AS_IF([test "$found_fuse_t" = "yes"],
[PKG_CHECK_MODULES([DEPS], [fuse-t >= ${min_fuse_t_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nss >= 3.15.0 ])],
[PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nss >= 3.15.0 ])])
;;
Expand Down
4 changes: 2 additions & 2 deletions src/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ bool StatCache::AddStat(const std::string& key, const headers_t& meta, bool forc
// Since the file mode may change while the file is open, it is
// updated as well.
//
bool StatCache::UpdateMetaStats(const std::string& key, headers_t& meta)
bool StatCache::UpdateMetaStats(const std::string& key, const headers_t& meta)
{
if(CacheSize < 1){
return true;
Expand All @@ -423,7 +423,7 @@ bool StatCache::UpdateMetaStats(const std::string& key, headers_t& meta)
stat_cache_entry* ent = &iter->second;

// update only meta keys
for(headers_t::iterator metaiter = meta.begin(); metaiter != meta.end(); ++metaiter){
for(headers_t::const_iterator metaiter = meta.begin(); metaiter != meta.end(); ++metaiter){
std::string tag = lower(metaiter->first);
std::string value = metaiter->second;
if(tag == "content-type"){
Expand Down
2 changes: 1 addition & 1 deletion src/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class StatCache
bool AddStat(const std::string& key, const headers_t& meta, bool forcedir = false, bool no_truncate = false);

// Update meta stats
bool UpdateMetaStats(const std::string& key, headers_t& meta);
bool UpdateMetaStats(const std::string& key, const headers_t& meta);

// Change no truncate flag
void ChangeNoTruncateFlag(const std::string& key, bool no_truncate);
Expand Down
10 changes: 7 additions & 3 deletions src/curl_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//-------------------------------------------------------------------
// Class S3fsMultiCurl
//-------------------------------------------------------------------
S3fsMultiCurl::S3fsMultiCurl(int maxParallelism) : maxParallelism(maxParallelism), SuccessCallback(nullptr), NotFoundCallback(nullptr), RetryCallback(nullptr), pSuccessCallbackParam(nullptr), pNotFoundCallbackParam(nullptr)
S3fsMultiCurl::S3fsMultiCurl(int maxParallelism, bool not_abort) : maxParallelism(maxParallelism), not_abort(not_abort), SuccessCallback(nullptr), NotFoundCallback(nullptr), RetryCallback(nullptr), pSuccessCallbackParam(nullptr), pNotFoundCallbackParam(nullptr)
{
int result;
pthread_mutexattr_t attr;
Expand Down Expand Up @@ -218,6 +218,8 @@ int S3fsMultiCurl::MultiRead()
isPostpone = true;
}else if(400 > responseCode){
// add into stat cache
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownPointerToBool
if(SuccessCallback && !SuccessCallback(s3fscurl.get(), pSuccessCallbackParam)){
S3FS_PRN_WARN("error from success callback function(%s).", s3fscurl->url.c_str());
}
Expand All @@ -232,6 +234,8 @@ int S3fsMultiCurl::MultiRead()
S3FS_PRN_WARN("failed a request(%ld: %s)", responseCode, s3fscurl->url.c_str());
}
// Call callback function
// cppcheck-suppress unmatchedSuppression
// cppcheck-suppress knownPointerToBool
if(NotFoundCallback && !NotFoundCallback(s3fscurl.get(), pNotFoundCallbackParam)){
S3FS_PRN_WARN("error from not found callback function(%s).", s3fscurl->url.c_str());
}
Expand Down Expand Up @@ -272,7 +276,7 @@ int S3fsMultiCurl::MultiRead()
clist_req.push_back(std::move(s3fscurl)); // Re-evaluate at the end
iter = clist_req.begin();
}else{
if(!isRetry || 0 != result){
if(!isRetry || (!not_abort && 0 != result)){
// If an EIO error has already occurred, it will be terminated
// immediately even if retry processing is required.
s3fscurl->DestroyCurlHandle();
Expand Down Expand Up @@ -304,7 +308,7 @@ int S3fsMultiCurl::MultiRead()
}
clist_req.clear();

if(0 != result){
if(!not_abort && 0 != result){
// If an EIO error has already occurred, clear all retry objects.
for(s3fscurllist_t::iterator iter = clist_all.begin(); iter != clist_all.end(); ++iter){
S3fsCurl* s3fscurl = iter->get();
Expand Down
3 changes: 2 additions & 1 deletion src/curl_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class S3fsMultiCurl

s3fscurllist_t clist_all; // all of curl requests
s3fscurllist_t clist_req; // curl requests are sent
bool not_abort; // complete all requests without aborting on errors

S3fsMultiSuccessCallback SuccessCallback;
S3fsMultiNotFoundCallback NotFoundCallback;
Expand All @@ -62,7 +63,7 @@ class S3fsMultiCurl
static void* RequestPerformWrapper(void* arg);

public:
explicit S3fsMultiCurl(int maxParallelism);
explicit S3fsMultiCurl(int maxParallelism, bool not_abort = false);
~S3fsMultiCurl();

int GetMaxParallelism() const { return maxParallelism; }
Expand Down
8 changes: 4 additions & 4 deletions src/mpu_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ utility_incomp_type utility_mode = utility_incomp_type::NO_UTILITY_MODE;
//-------------------------------------------------------------------
// Functions
//-------------------------------------------------------------------
static void print_incomp_mpu_list(incomp_mpu_list_t& list)
static void print_incomp_mpu_list(const incomp_mpu_list_t& list)
{
printf("\n");
printf("Lists the parts that have been uploaded for a specific multipart upload.\n");
Expand All @@ -47,7 +47,7 @@ static void print_incomp_mpu_list(incomp_mpu_list_t& list)
printf("---------------------------------------------------------------\n");

int cnt = 0;
for(incomp_mpu_list_t::iterator iter = list.begin(); iter != list.end(); ++iter, ++cnt){
for(incomp_mpu_list_t::const_iterator iter = list.begin(); iter != list.end(); ++iter, ++cnt){
printf(" Path : %s\n", (*iter).key.c_str());
printf(" UploadId : %s\n", (*iter).id.c_str());
printf(" Date : %s\n", (*iter).date.c_str());
Expand All @@ -60,7 +60,7 @@ static void print_incomp_mpu_list(incomp_mpu_list_t& list)
}
}

static bool abort_incomp_mpu_list(incomp_mpu_list_t& list, time_t abort_time)
static bool abort_incomp_mpu_list(const incomp_mpu_list_t& list, time_t abort_time)
{
if(list.empty()){
return true;
Expand All @@ -70,7 +70,7 @@ static bool abort_incomp_mpu_list(incomp_mpu_list_t& list, time_t abort_time)
// do removing.
S3fsCurl s3fscurl;
bool result = true;
for(incomp_mpu_list_t::iterator iter = list.begin(); iter != list.end(); ++iter){
for(incomp_mpu_list_t::const_iterator iter = list.begin(); iter != list.end(); ++iter){
const char* tpath = (*iter).key.c_str();
std::string upload_id = (*iter).id;

Expand Down
2 changes: 1 addition & 1 deletion src/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3255,7 +3255,7 @@ static std::unique_ptr<S3fsCurl> multi_head_retry_callback(S3fsCurl* s3fscurl)

static int readdir_multi_head(const char* path, const S3ObjList& head, void* buf, fuse_fill_dir_t filler)
{
S3fsMultiCurl curlmulti(S3fsCurl::GetMaxMultiRequest());
S3fsMultiCurl curlmulti(S3fsCurl::GetMaxMultiRequest(), true); // [NOTE] run all requests to completion even if some requests fail.
s3obj_list_t headlist;
int result = 0;

Expand Down
28 changes: 18 additions & 10 deletions test/integration-test-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,16 @@ function start_s3fs {
fi

# On OSX only, we need to specify the direct_io and auto_cache flag.
#
# And Turn off creation and reference of spotlight index.
# (Leaving spotlight ON will result in a lot of wasted requests,
# which will affect test execution time)
#
if [ "$(uname)" = "Darwin" ]; then
local DIRECT_IO_OPT="-o direct_io -o auto_cache"

# disable spotlight
sudo mdutil -a -i off
else
local DIRECT_IO_OPT=""
fi
Expand All @@ -248,14 +256,13 @@ function start_s3fs {
fi

# [NOTE]
# On macos, running s3fs via stdbuf will result in no response.
# Therefore, when it is macos, it is not executed via stdbuf.
# This patch may be temporary, but no other method has been found at this time.
# For macos fuse-t, we need to specify the "noattrcache" option to
# disable NFS caching.
#
if [ "$(uname)" = "Darwin" ]; then
local VIA_STDBUF_CMDLINE=""
local FUSE_T_ATTRCACHE_OPT="-o noattrcache"
else
local VIA_STDBUF_CMDLINE="${STDBUF_BIN} -oL -eL"
local FUSE_T_ATTRCACHE_OPT=""
fi

# [NOTE]
Expand Down Expand Up @@ -289,7 +296,7 @@ function start_s3fs {
(
set -x
CURL_CA_BUNDLE="${S3PROXY_CACERT_FILE}" \
${VIA_STDBUF_CMDLINE} \
${STDBUF_BIN} -oL -eL \
${VALGRIND_EXEC} \
${S3FS} \
${TEST_BUCKET_1} \
Expand All @@ -303,6 +310,7 @@ function start_s3fs {
${DIRECT_IO_OPT} \
${S3FS_HTTP_PROXY_OPT} \
${NO_CHECK_CERT_OPT} \
${FUSE_T_ATTRCACHE_OPT} \
-o stat_cache_expire=1 \
-o stat_cache_interval_expire=1 \
-o dbglevel="${DBGLEVEL:=info}" \
Expand All @@ -320,15 +328,15 @@ function start_s3fs {
if [ "$(uname)" = "Darwin" ]; then
local TRYCOUNT=0
while [ "${TRYCOUNT}" -le "${RETRIES:=20}" ]; do
df | grep -q "${TEST_BUCKET_MOUNT_POINT_1}"
rc=$?
if [ "${rc}" -eq 0 ]; then
_DF_RESULT=$(df 2>/dev/null)
if echo "${_DF_RESULT}" | grep -q "${TEST_BUCKET_MOUNT_POINT_1}"; then
break;
fi
sleep 1
TRYCOUNT=$((TRYCOUNT + 1))
done
if [ "${rc}" -ne 0 ]; then
if [ "${TRYCOUNT}" -gt "${RETRIES}" ]; then
echo "Waited ${TRYCOUNT} seconds, but it could not be mounted."
exit 1
fi
else
Expand Down
Loading

0 comments on commit d7ed390

Please sign in to comment.